Caution

You're reading an old version of this documentation. If you want up-to-date information, please have a look at 0.10.1.

librosa.get_samplerate

librosa.get_samplerate(path)[source]

Get the sampling rate for a given file.

Parameters:
pathstring, int, soundfile.SoundFile, or file-like

The path to the file to be loaded As in load, this can also be an integer or open file-handle that can be processed by soundfile. An existing soundfile.SoundFile object can also be supplied.

Returns:
srnumber > 0

The sampling rate of the given audio file

Examples

Get the sampling rate for the included audio file

>>> path = librosa.ex('trumpet')
>>> librosa.get_samplerate(path)
22050