USB Sound Device Possible?

10 views (last 30 days)
Brittany
Brittany on 5 Oct 2011
I have the data acquisition toolbox.
I need to be able to have 8 USB speakers (connected by a USB hub) that I can activate to play a sound from only one speaker at a time.
Can MATLAB support USB sound devices? If so, can it support multiple USB sound devices individually?
How would I go about getting the name of the device so that I can call it from an M-file?

Accepted Answer

Daniel Shub
Daniel Shub on 5 Oct 2011
MATLAB can support multiple USB sound devices. The audioplayer function allows you to specify the device ID number. In Linux, you can control the ID number a device gets at boot time. I am not sure you can do that in Windows.
Running multiple devices on a single USB hub may not work. The hub may not have the bandwidth to do that.
I would suggest looking at port audio (e.g., pawavplay, paplayrec, or the psychtoolbox) instead of the built in sound commands.
Finally if you only want a single sound at a give time, you should look at a programmable switch (either powered or not) that would let you route a single channel of output from a soundcard to different speakers. This might be much more reliable and easier to calibrate.
  2 Comments
RAJKUMAR Palaniappan
RAJKUMAR Palaniappan on 19 Apr 2012
i want to interface 3 microphones using USB sound card and collect data using matlab, is it possible to do that? im using windows 7
i want to collect data simultaneously
Daniel Shub
Daniel Shub on 19 Apr 2012
If something about this answer does not answer your question, then ask a new question linking to this question/answer and explain why it is different. Linking and explaining why it is different is crucical, because otherwise I am just going to point you back here.

Sign in to comment.

More Answers (2)

Walter Roberson
Walter Roberson on 5 Oct 2011
It is my understanding that USB device names are variable, and can change if you unplug and replug a device, or upon reboot. If you have a series of USB devices that are functionally all the same, then unless the USB device is able to store some kind of identifier on it, you pretty much end up selecting on the basis of device serial number.
A USB speaker would have to be treated as a digital i/o device, and could not be treated via analoginput(); digitalio() would have to be used. If daqhwinfo does not report the device, it would not be usable (unless drivers can be found for it.) The "adapter" in this situation would probably be 'winsound'.

Alejandro Bidondo
Alejandro Bidondo on 11 Jan 2012
Hi Brittany.
All you need is PsychPortAudio Driver, from the PsychToolBox 3 package ( http://docs.psychtoolbox.org/Psychtoolbox).
Its easy to install in Matlab. It has the control functions you need. You will also have to use ASIO sound cards, with their own ASIO driver or the ASIO4ALL universal driver.
It works. I've used it for reproducing different audio files thru 4 speakers, all at the same time. Hope this helps.
Alejandro.
  5 Comments
Daniel Shub
Daniel Shub on 19 Apr 2012
@Walter USB soundcards tend to have limited memory buffers which allow them to get around single data transfer, but introduce input/output latency. I beleive some high end soundcards provide a way of linking multiple cards together to synchronize them.
Walter Roberson
Walter Roberson on 19 Apr 2012
Buffers do not in themselves solve synchronization; you would need a common trigger. But if the devices have a common sync... that could work (though with latency as you point out.)

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!