Default sample rate for librosa.core.load is not the native sample rate
See original GitHub issueCurrently, the default sample rate is 22050 Hz when loading an audio file. In order to use the native sample rate, sr
must be set to None
. I often forget to set this to None
when I want the native sample rate, and I have noticed many students do the same.
Have others experienced confusion over this? Should this change in a later release so that the native sample rate is the default?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:31 (25 by maintainers)
Top Results From Across the Web
librosa.load — librosa 0.10.0.dev0 documentation
Audio will be automatically resampled to the given rate (default sr=22050 ). To preserve the native sampling rate of the file, use sr=None...
Read more >Sampling rate issue with Librosa - python - Stack Overflow
If you want to use the original sample rate, you have to explicitly set the the target sample rate to None: sr=None ....
Read more >librosa.core.load — librosa 0.6.0 documentation
Load an audio file as a floating point time series. Audio will be automatically resampled to the given rate (default sr=22050). To preserve...
Read more >Python Audio
Per default, librosa.load resamples the audio to 22050 Hz. Setting sr=None keeps the native sampling rate. The loaded audio is converted to a...
Read more >Librosa: A Python Audio Libary. by - Medium
The default sampling rate used by Librosa is 22050, but you can pass in almost any sampling rate you like. Some common sampling...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @NumesSanguis. Thank you for the feedback.
To be fair, librosa does not really change the sample rate “at load time”. It loads the whole file as a numpy array at its native sample rate, and then calls
librosa.resample
to perform resampling of that numpy array. Callinglibrosa.load
withsr=None
simply skips the second step.So, if
librosa.load
were to be deprecated, the recommended way to perform its default behavior would be:-1 to
loadn
loadn
strikes me as akin to idioms likekill -9
, where you have to append something to the command so that it ends up doing what its name implies.