Question

I want to fetch multiple USB microphones simultaneously in Matlab (2012a). However, two recording functions are both short-legged. 1, recordblocking() - It allows user to specify the duration of recording, but each microphone has to be recorded IN ORDER. So I don't know any way to make it recording simultaneously. 2, record() - It allows user to record multiple signals simultaneously, but it is only run for 1 second (roughly).

The code I used was the following:

recObj1 = audiorecorder(44100, 16, 1, 1);
recObj2 = audiorecorder(44100, 16, 1, 3);
disp('Start speaking.')
% recordblocking(recObj1, n);
% recordblocking(recObj2, n);
disp('Real recording.')
% by the way, the following function doesn't take 'on' as the second argument as opposed to what the internal/external documentation says
record(recObj1, 1);
record(recObj2, 1);

disp('End of Recording.');

So basically, I couldn't achieve simultaneously recording for multiple microphone inputs for n seconds long. Please help.

Was it helpful?

Solution

You obviously read this documentation, which is about recording data from ports: http://www.mathworks.de/de/help/matlab/ref/record.html

This is the record function of the audiorecorder: http://www.mathworks.de/de/help/matlab/ref/audiorecorder.record.html

Second input argument is the duration.

OTHER TIPS

try this:

%records from speaker IDs 0 (probably internal microphone) & 3,
%using audiorecorder function. 

recobj1 = audiorecorder(22500,16,2,0);
recobj2 = audiorecorder(22500,16,2,3);

disp('start speaking.')
record(recobj1,5);
record(recobj2,5);

recordblocking(recobj1,5);
%recordblocking(recobj3,2);

disp('end of recording');

y1 = getaudiodata(recobj1);
wavwrite(y1,22500,16,'recobj1');

y2 = getaudiodata(recobj2);
wavwrite(y2,22500,16,'recobj2');

plot(y1)
plot(y2)

It also plots your results. Zoom in to see differences between your two mic outputs.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top