1

I'm trying to get the sampling rate of wav file using several python libraries, and I'm getting different results:

(1):

import wave
wave_file = wave.open(fname, 'rb')
frame_rate = wave_file.getframerate()

output of frame_rate = 16000

(2):

from scipy.io.wavfile import read as read_wav
sampling_rate, data = read_wav(fname)

output of sampling_rate = 16000

(3)

import librosa
X, sample_rate = librosa.load(fname)

output of sample_rate = 22050

Why the output of librosa library is different ?

Boom
  • 1,145
  • 18
  • 44
  • Does this answer your question? [Sampling rate issue with Librosa](https://stackoverflow.com/questions/38188359/sampling-rate-issue-with-librosa) – Hendrik Dec 09 '20 at 08:47

1 Answers1

2

Because librosa.load() makes a resampling to that frequency if you don't specify the keyword argument sr.

You can find a detailed answered here: Sampling rate issue with Librosa

fullfine
  • 1,371
  • 1
  • 4
  • 11