Skip to content

[fix] Fix error in Audio Decoder example #739

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 23, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions examples/audio_decoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,10 @@ def play_audio(samples):
# ------------------
#
# We can also decode the samples into a desired sample rate using the
# ``sample_rate`` parameter of :class:`~torchcodec.decoders.AudioDecoder`. The
# ouput will sound the same, but note that the number of samples greatly
# increased:
# ``sample_rate`` parameter of :class:`~torchcodec.decoders.AudioDecoder`.
# The number of samples has reduced from `4297722` to `1559264`, in the
# ratio `44100` to `16000`. The downsampled output loses high frequency
# content, which may or may not sound the same depending on the playback device.

decoder = AudioDecoder(raw_audio_bytes, sample_rate=16_000)
samples = decoder.get_all_samples()
Expand Down