MATLAB: How to record and analyze audio in real-time

audio recordingmultiple threads

Hi all,
I would like to have audio recorded continously, and at each time interval, grab the audio data and analyze the data without interrupting the recording.
I can imagine using two threads, one for recording, the other for analyzing. I know how to do recording and analyzing, but I don't know how to implement two threads. Does matlab support multiple threads for this kind of task? Could someone give me an example of how to do this? I would greatly appreciate that.
Thanks,

Best Answer

Yanping - when I've used the audio recorder object to record from my microphone, I just add a timer object to the recorder. Then (for example) every second, the timer fires, and I process the most recent one second of data (since the lsat time the timer fired). Something like
recorder = audiorecorder(8192,8,1);
set(recorder,'TimerPeriod',1,'TimerFcn',{@audioTimer});
Related Question