Audiorecorder in matlab
I'm new to matl开发者_运维知识库ab. Essentially i want to get audio signal of fixed length (10 seconds) from microphone, perform some operations and play output sound. I was trying to use audiorecorder something like this:
y = audiorecorder(44100, 16, 1)
record(y, 10);
% signal processing;
play(output);
The problem is it's asking for a user prompt to stop recording first and then go to next stage. I just want it to record (on user prompt) whatever it gets for 10 sec and stop automatically. Then proceed to next stages and play final output, all without further user prompt. Is there any way to get around this?
You can use audiorecorders recordblocking method to record for a specfied amount of time, and wait until that time has elapsed.
So, your new code would look like:
a = audiorecorder(44100, 16, 1)
% record for 10 seconds before moving on
recordblocking(a, 10);
% signal processing;
play(a);
精彩评论