I have a wav of the following youtube video: https://www.youtube.com/watch?v=glOnDceqqJc
which has 44100Hrz and has the length of 2 minutes and I want to downsample it to 16000Hrz
my script works on shorter files but when I run my script with this file It's file grows from 21mb to 30mb and I get a format error when I try to run it.
here is my script:
from scipy.io import wavfile
from scipy.signal import resample
def resamplee(file):
try:
sampling_rate, wv = wavfile.read(file)
if sampling_rate == 16000:
pass
else:
sec = len(wv)/sampling_rate
nsmp = int(sec * 16000) + 1
resamp = resample(wv,nsmp)
wavfile.write(file,16000,resamp)
except ValueError as e:
print(e)
resamplee('audio.wav')
can someone explain to me what is going wrong or how can I fix this?
thanks!