MATLAB Answers

Does matlab support USB audio devices that have 4 microphones?

37 views (last 30 days)
JD Ritchey
JD Ritchey on 3 Nov 2017
Commented: Gene Goff on 10 Oct 2018
I'm having trouble finding a mechanism to record audio from a usb 4 channel audio device. I have found examples scripts that record stereo (2 channel) audio from a usb device, but not 4. Any help would be greatly appreciated.

  0 Comments

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 3 Nov 2017
You need either the DSP toolbox or the Audio Systems Toolbox or (interfacing a different way) the Data Acquisition Toolbox for this to work.

  2 Comments

JD Ritchey
JD Ritchey on 3 Nov 2017
Thanks for the reply! The device I'm trying to capture my data through is a Cirrus Logic 6271-EV2-REV2 development board (not national instruments hardware), along with a codec and a collection of microphones. Might you know if those toolbox's support data acquisition through 3rd party hardware? It shows up as a usb 2.0 device and acts like a recording device in Audacity and a playback/recording device on windows control panel.

Sign in to comment.

More Answers (1)

Gabriele Bunkheila
Gabriele Bunkheila on 6 Nov 2017
Hi JD,
I work with the Audio System Toolbox team at MathWorks and after seeing this I thought I'd drop a more precise note on the topic.
It looks like your board is recognized by Windows as a standard audio device, leveraging generic DirectSound drivers.
To record more than 2 channels from anything seen by your OS as an audio device (e.g. working with DirectSound, WASAPI, ASIO, ALSA or CoreAudio drivers), you should look at audioDeviceReader in Audio System Toolbox.
I hope this helps.
Regards,
Gabriele.

  4 Comments

Show 1 older comment
Gene Goff
Gene Goff on 9 Oct 2018
I too am trying to record from a multichannel USB audio box and I get about 2 frames of silence. Everything works fine with my other 2-channel USB audio box. Below is my audioReader init code. I verified the ASIO4ALL driver settings match the Matlab settings. I also tried different data types. The multichannel USB device is correctly selected in the Windows Control Panel Sound settings. I don't see any multichannel examples in Wathworks' help. Please lt me know what might be missing.
deviceReader = audioDeviceReader(...
'Device','ASIO4ALL v2',...
'Driver','ASIO',...
'SampleRate',48000,...
'NumChannels',4,...
'OutputDataType','double',...
'SamplesPerFrame',2048);
Gabriele Bunkheila
Gabriele Bunkheila on 10 Oct 2018
Hi Gene,
I am not sure what you meant by "I get about two frames of silence" - I'll take a stab at your question assuming it's related to the main topic of this MATLAB Answer, i.e. you are struggling to read more than 2 channels from your multichannel USB sound card.
Many (if not most) multichannel sound cards support full multichannel mode in Windows only via an ASIO driver provided by the card vendor. On the other hand, they only support two channels using standard plug-and-play Windows drivers.
Try pointing audioDeviceReader to the ASIO driver coming with the card instead of ASIO4ALL. If I remember well, ASIO4ALL simply leverages the default Windows drivers on the hardware side, yet exposing an ASIO interface to applications (including MATLAB) so you can use your card with applications working in ASIO mode.
I hope this helps,
Gabriele.
Gene Goff
Gene Goff on 10 Oct 2018
Never mind - this does work now. I had the wrong driver settings in Adobe Audition to monitor the audio that Matlab recorded.

Sign in to comment.

Sign in to answer this question.