Record multiple microphones simultaneously

I have read several topics on this issue, but the ones I have found differed from mine slightly.
I wish to record 2 sound recordings at once. I have both mic's plugged in. I set up two audiorecorder functions like this:
rec1=audiorecorder(44100,8,1,1);
rec2=audiorecorder(44100,8,1,2);
record(rec1,3);
record(rec2,3);
Only rec1 recorded. I can see this by plotting the audiodata for both recordings. Is this problem due to MatLab not recognizing the 2nd microphone? Or is there something inherently wrong with my code?
Also, would there be an easier way to do multiple recordings? I've read something about Data Acquisition Toolbox, but I don't have it and have never used it.
Thanks for your help.

9 comentarios

Walter Roberson
Walter Roberson el 19 de Nov. de 2012
Is audiodevinfo() showing the devices as being connected on those ID's?
If you exchange the mic's, does the problem stay with the mic or with the ID ?
I think they are at 0,1. Here is the data I am getting:
>> rec1
rec1 =
audiorecorder handle
Properties:
SampleRate: 44100
BitsPerSample: 8
NumberOfChannels: 1
DeviceID: 1
CurrentSample: 1
TotalSamples: 132300
Running: 'off'
StartFcn: []
StopFcn: []
TimerFcn: []
TimerPeriod: 0.050000000000000
Tag: ''
UserData: []
Type: 'audiorecorder'
Methods, Events, Superclasses
>> rec2
rec2 =
audiorecorder handle
Properties:
SampleRate: 44100
BitsPerSample: 8
NumberOfChannels: 1
DeviceID: 2
CurrentSample: 1
TotalSamples: 132300
Running: 'off'
StartFcn: []
StopFcn: []
TimerFcn: []
TimerPeriod: 0.050000000000000
Tag: ''
UserData: []
Type: 'audiorecorder'
Methods, Events, Superclasses
>> audiodevinfo(0)
ans =
2
>> audiodevinfo(1)
ans =
5
>>
Timothy
Timothy el 26 de Nov. de 2012
Editada: Walter Roberson el 26 de Nov. de 2012
When I do this code:
>> record(rec1,3)
>> record(rec2,3)
>> det1 = getaudiodata(rec1);
>> det2 = getaudiodata(rec2);
>> figure
>> plot(det1)
>> figure
>>plot(det2)
det 1 has the expected values and det 2 has nothing...it is all 0s
In a session, before using audiorecorder(), please see what
audiodevinfo(0,1)
audiodevinfo(0,2)
return
I am concerned about the possibility that audiorecorder() sets up control structures but does not test whether the device is present; knowing that audiodevinfo() believes the devices to be at 1 and 2 would be helpful.
Also, does the problem stay with the microphone or with the device number if you exchange the microphones ?
Timothy
Timothy el 26 de Nov. de 2012
audiodevinfo(0,1) audiodevinfo(0,2)
These both give me error messages saying
"device ID out of range"
However,
audiodevinfo(1,2)
says:
Rear Input (SoundMAX Integrated Digital High Definition Audio) (Windows DirectSound)
audiodevinfo(1,1)
says:
Microphone (USB Audio Device) (Windows DirectSound)
Timothy
Timothy el 26 de Nov. de 2012
When the device numbers were swapped, the microphone that recorded swapped as well.
Walter Roberson
Walter Roberson el 26 de Nov. de 2012
Ah, I misread about input vs output. 1 instead of 0 it is.
Your system has 5 logical audio input devices. The first of them is a USB microphone. The second of them is an stereo jack style on your laptop. I do not have enough information at present to know where the other 3 logical input devices are.
Which microphone inputs do you think you are using? For example if you are using two USB microphones, then you need to find the device ID that corresponds to that USB microphone.
Timothy
Timothy el 28 de Nov. de 2012
Editada: Timothy el 28 de Nov. de 2012
I found out why Matlab wasn't recording with one of them, and it was because there was a faulty USB port that it was plugged in to-I tried plugging a mouse into it and that didn't work either. When I plugged it into a different USB, I got this for the audiodevinfo, and it seems to work fine:
>> audiodevinfo(1,1)
ans =
Microphone (1- USB Audio Device) (Windows DirectSound)
>> audiodevinfo(1,2)
ans =
Microphone (2- USB Audio Device) (Windows DirectSound)
joe boby soegiarto
joe boby soegiarto el 24 de Jun. de 2015
Hi i want to ask guys, can you record using 2 differenti soundcard simultaneously?

Iniciar sesión para comentar.

Respuestas (0)

Preguntada:

el 19 de Nov. de 2012

Comentada:

el 24 de Jun. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by