mirror of
https://github.com/huggingface/lerobot.git
synced 2026-05-15 16:49:55 +00:00
fix(audio chunks): querying audio chunks in the past rather than in the future
This commit is contained in:
@@ -76,7 +76,7 @@ def decode_audio_torchcodec(
|
||||
audio_chunks = []
|
||||
for ts in timestamps:
|
||||
current_audio_chunk = audio_decoder.get_samples_played_in_range(
|
||||
start_seconds=ts, stop_seconds=ts + duration
|
||||
start_seconds=ts - duration, stop_seconds=ts
|
||||
)
|
||||
|
||||
if log_loaded_timestamps:
|
||||
@@ -114,7 +114,7 @@ def decode_audio_torchaudio(
|
||||
|
||||
audio_chunks = []
|
||||
for ts in timestamps:
|
||||
reader.seek(ts) # Default to closest audio sample
|
||||
reader.seek(ts - duration) # Default to closest audio sample
|
||||
status = reader.fill_buffer()
|
||||
if status != 0:
|
||||
logging.warning("Audio stream reached end of recording before decoding desired timestamps.")
|
||||
|
||||
Reference in New Issue
Block a user