matlab - change audio file sampling rate -
i want ask how can change sampling rate audio file in matlab r2016a?? default 44100 want change 22050 shown in code trying convert sampling rate, doesn't work...
clear; fs1 = 44100; fs2 = 22050; src = dsp.samplerateconverter('inputsamplerate',fs1,'outputsamplerate',fs2); [sa,src] = audioread('w_sound_1.wav'); % sa : of sampling , fs :sampling rate sa_w = sa; audiowrite('w_sound_1_resampling.wav',sa_w,src)
the reason it's not working don't use samplerateconverter
object src
anywhere. in fact, using src
second output argument of audioread()
, overwrite number containing current sample rate.
if want use samplerateconverter
, check out examples here.
but, it's simpler use resample()
Comments
Post a Comment