问题
I am currently processing speech signals while recording simultaneously. More specifically:
Record every 0.1s speech repeatedly.
Process each speech packet in a FIFO sense (e.g., call this function
process
). It takes about 1s for processing a packet of speech of length 0.1s.
The following is the the executed code:
r = audiorecorder(fs, 16,1);
data{k} = getaudiodata(r);
process(data{k});
The problem is that I miss sample of 1s speech during process
execution. I want the recording to be executed without stop, and call the function process
in every 0.1s speech recording. I try to use function callback provided for audiorecorder.
The problem is that TimerFcn
, which is the function to be executed repeatedly during recording, cannot retrieve the sample during recording.
Any advice?
回答1:
Try to find something in the matrix you get on using getaudiodata()
That must have some arrangement depending on time. (It should have some distribution of values according to time because plot()
plots the sound signal wrt time axis)
Iterate through the matrix according to that arrangement and call the process() function.
This way you can record the sound at once and then process for every 0.1 secs one by one by iterating.
来源:https://stackoverflow.com/questions/10554195/process-speech-without-stopping-the-recording-in-matlab