0

By default scipy.io.wavfile.read(file) set sample rate 8000, where I in Librosa by default is 22.05k.

I want to set a 22.05k sample rate in scipy.io.wavfile.read.

In the documentation, there is no way to define the sample rate explicitly.

1 Answers1

0

No, that's not how it works. Each wave file HAS a sample rate. scipy.io.wavfile.read tells you what that rate is. If you want to change it, then you have to do a sample rate conversion.

Tim Roberts
  • 48,973
  • 4
  • 21
  • 30
  • then why librosa by default convert to 22.05 kHz? – Yash Mistry Feb 24 '21 at 09:04
  • FYI: https://stackoverflow.com/questions/50062358/difference-between-load-of-librosa-and-read-of-scipy-io-wavfile/50063416#50063416. As for why librosa resamples the data: you'd probably have to ask the original authors of the librosa code. – Warren Weckesser Feb 24 '21 at 15:26
  • There is no "why". That's just what librosa does -- it converts the data after it reads it. scipy.io doesn't do that. It gives you what's really in the file. That, at least, doesn't fool you into thinking you have more than you really have. If you read file with 8000 samples per second, you won't have any frequencies above 4kHz even if you convert it to 22,050. – Tim Roberts Feb 24 '21 at 19:43