I have a ndarray
(which I got from microphone) with samples (sample rate = 48000).
I want to create a new ndarray
with lower sample rate (16000).
One option is to save this ndarray
as wav
file and reload it with different sample rate (via librosa
).
Is there a simple way to do it without saving the ndarray
as wav file ?
there's a method resample in librosa
and you can use it without saving the file
import librosa
original_data, sr = librosa.load('0 .wav', sr=None)
print(original_data.shape)
resampled_data = librosa.resample(original_data, orig_sr=sr, target_sr=16000)
print(resampled_data.shape)