0

I have a wav file with sample rate of 44100. I want to save it with different sample rate.

I tried with this code:

import soundfile as sf
SRC = "src.wav"
DST = "dst.wav"
data, samplerate = sf.read(SRC)
sf.write(DST, data, 16000)

But the DST file has strange voices (seem it not saved ok).

I have tried with librosa:

import librosa
import pickle

y, s = librosa.load(SRC, sr=16000) 

with open(DST, "wb") as mypicklefile:
    pickle.dump(y, mypicklefile)

And it seems now it wasn't save as correct wav file

How can I save wav file with different sample rate ?

user3668129
  • 4,318
  • 6
  • 45
  • 87

0 Answers0