audio - MATLAB audiorecorder and wavwrite -
while reading website of mathworks learned discouraging usage of wavrecord
function, because it's going deprecated soon, decided use audiorecorder
instead. fine, play function playing recorded audio, when use wavwrite
function write wav file it's not sounding well, noticed duration not set properly.
i showing program, please suggest me how make correct. thank you.
fs = 44100 bits = 16 recobj = audiorecorder(fs, bits, 1); %# get(recobj) %# collect sample of speech microphone, , plot signal data: %# record voice 5 seconds. recobj = audiorecorder; disp('start speaking.') recordblocking(recobj, 5); disp('end of recording.'); %# play recording. play(recobj); %# store data in double-precision array. myrecording = getaudiodata(recobj); %disp(size(myrecording)); %# plot waveform. plot(myrecording); wavwrite(myrecording, fs, bits,'sample01_6k'); %#wavplay(myrecording,fs);
you creating recobj
twice, , second time create it, create default settings instead of custom settings. remove second call audiorecorder
, should work expected.
Comments
Post a Comment