I want to resample a recording in 32000 KHz to 16000 KHz. I have done this with the code below. But the output audio is somewhat messed up.
You can find the original audio as well output in the following folder https://drive.google.com/drive/folders/1vr-ib8zvZagH_QeE4JSUtAUpp3EG75va
Any ideas what I am doing wrong?
import os
import librosa
import soundfile as sf
folder_name = "trial_sess"
os.chdir(os.path.join("process",folder_name))
for file in os.listdir():
if file.endswith(".m4a") or file.endswith(".mp4") or file.endswith(".mp3"):
nm,ext = file.split(".")
sr = librosa.get_samplerate(file)
y, sr = librosa.load(file, sr = sr)
sf.write(os.path.join(zoom_loc,"sessions",folder_name,"output_resampled_audio" + "." + "wav"), data = y, samplerate=16000)