Reputation: 1325
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 ?
Upvotes: 1
Views: 186
Reputation: 1461
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
Upvotes: 2