How can I process speech without stopping the recording in MATLAB?

2 views (last 30 days)
I am currently process speech signal with recording simultaneously.
More specifically,
(1) Record every 0.1s speech repeatedly.
(2) Process each speech chunk(0.1s) as FIFO sense. (let say processing function 'test') 'test' function takes about 1s for processing each chunk of speech.
I wrote the code as follows :
r = audiorecorder(fs,16,1);
record(r,0.1);
data{k} = getaudiodata(r);
test(data{k});
The problem is that I miss sample of 1s speech during 'test' function is executed. I want recording to be executed without stop, and call the function 'test' in every 0.1s speech recording.
So, I try to use function callback provided for 'audiorecorder'. I used StopFcn , which is the function to be executed just after stopping record, But this function callback used same thread with recording. So,I need to try other approaches.
I got a clue that 'multi-threading', 'parallel computing toolbox' would be helpful for me. But I don't know how to apply it for my problem.
Is there anyone who can give me some advice? I really appreciate all of your comments.

Accepted Answer

Walter Roberson
Walter Roberson on 14 May 2012
You will probably not be able to do this using audiorecorder. You will probably have to switch to a data-acquisition design. analoginput() from the device, set up a BytesAvailableFcn callback that queues the data into an internal buffer. Your regular routine would loop around looking in the queue for work and processing what it finds there.
  1 Comment
Gun-min Kim
Gun-min Kim on 14 May 2012
Thanks for your reply !
But unfortunately, my OS is 64bit (win64 platform) so I cannot use 'analoginput' according to the MATLAB error message. Can you show some simple example codes that I can refer? It can be very helpful for solving my problem.

Sign in to comment.

More Answers (0)

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!