Skip to content

Conversation

NicolasHug
Copy link
Contributor

@NicolasHug NicolasHug commented Mar 24, 2025

The most common decoding pattern for audio will be to decode an entire stream at once. Right now, the main way to do this is to call decoder.get_samples_played_in_range() which is a awkward:

  • it's a long name
  • we're not relying on the range feature

This PR introduces the decoder.get_all_samples() method which is a more natural alias, hopefully providing a better UX for the most common usage.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Meta Open Source bot. label Mar 24, 2025
Returns:
AudioSamples: The samples within the file.
"""
return self.get_samples_played_in_range()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a brief comment explaining that the defaults for get_samples_played_in_range() do what we want, and that this method is a way of advertising that to folks?

Copy link
Contributor Author

@NicolasHug NicolasHug Mar 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely, do you want it as a comment in the code or in the docstring?

@NicolasHug NicolasHug merged commit 90e1262 into meta-pytorch:main Mar 24, 2025
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants