Wednesday, August 20, 2008

here is a way which we can record audio in Matlab and use it for our statistical research:

micrecorder = audiorecorder(11025,8,1);
record(micrecorder,2);
% Now, speak into microphone
stop(micrecorder);
speechplayer = play(micrecorder);
% Now, listen to the recording
stop(speechplayer);
data = getaudiodata(micrecorder);

this program records a mono(1 channle) 8bit audio with 11025 samples then plays it back and saves it into "data" to be used in Matlab.I adjusted the program to record only 2 seconds, scince this function is not intended for long recording otherwise it will cause lack of memorgy and Matlab performance may degrade.

another way is using "wavrecord":

y= wavrecord(2*11025,11025,'int8');
wavplay(y,11025);

No comments: