Interface microphones using matlab
12 views (last 30 days)
Show older comments
RAJKUMAR Palaniappan
on 18 Apr 2012
Commented: Walter Roberson
on 26 Feb 2020
I have three microphones and i want to record the signals from the microphones simultaneously, is it possible in matlab?
i used the below mentioned program and i can acquire data from one microphone but im not able to get from all the three at the same time
clear all
close all
clc
AI = analoginput('winsound');
addchannel(AI, 1);
Fs = 8000;
set (AI, 'SampleRate', Fs)
duration = 20;
set(AI, 'SamplesPerTrigger', duration*Fs);
start(AI);
data = getdata(AI);
delete(AI)
10 Comments
Accepted Answer
Geoff
on 20 Apr 2012
Sorry mate, it looks like you are expecting the two-channel mic jack on your sound card to have three inputs.
Go and buy yourself a USB sound interface with 4 mic preamps.
The Alesis iO4 or Tascam US-600 are among the cheapest devices out there. Bonus is they will take a 5mm jack on all channels, since I assume you are not using professional microphones.
As for using only two microphones on one sound card, yes you should be able to do this. But you need to make a stereo splitter cable (or there may be something at your local electronics shop) which turns a single male stereo 3.5mm male jack into two mono 3.5mm female sockets (corresponding to left and right).
Plug that into your computer, and a mic into each of the sockets on the splitter. Then you should be able to at least record two mono channels (assuming that the mic input is stereo). You will, however, not have individual gain control on the two mics.
If you really do have more than one device, then you should be able to choose that device with your initial call to analoginput:
doc analoginput
It might not be 'winsound', and if it is, try the second parameter which selects the hardware ID.
Also, if you are using 64-bit MatLab, you need to read the documentation, which states that you can't use the analoginput interface.
5 Comments
Walter Roberson
on 29 Apr 2012
If you have a multi-channel NI DAQ, then Yes, the inputs could be synchronized.
Walter Roberson
on 26 Feb 2020
Over the years I came across the fact that the standard Windows drivers for audio are two channels at most, so even if you could get a third channel in physically, that the drivers would not deal with it. The workaround involved using ASIO drivers (I am sure of this), and I cannot quite recall for sure whether using PortAudio drivers would work but I think so. Or use the data acquisition toolbox to talk to a multichannel A/D card.
More Answers (1)
Goz Qht
on 26 Feb 2020
clear all close all clc AI = analoginput('winsound'); addchannel(AI, 1); Fs = 8000; set (AI, 'SampleRate', Fs) duration = 20; set(AI, 'SamplesPerTrigger', duration*Fs); start(AI); data = getdata(AI); delete(AI)
0 Comments
See Also
Categories
Find more on Audio I/O and Waveform Generation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!