Select 'DeviceName' for dsp.AudioRecorder and dsp.AudioPlayer

3 visualizaciones (últimos 30 días)
I was wondering if the DSP blocks have a way of listing the available audio devices in my computer similar to what the audiodevinfo function does? The problem I'm having is that when I use audiodevinfo it only returns a partial name of the available devices and not the full name of the device so I can't assign this name to the DeviceName parameter in dsp.AudioRecorder or dsp.AudioPlayer from the Command Window in MATLAB...
so, this is what I'm doing:
h = dsp.AudioPlayer;
h.DeviceName = audiodevinfo(0,1);
and, this is the error I get:
??? Error using ==> CompEnum.findMatch at 60 Communications Headphones (IDT is not a valid setting for the DeviceName property.
Error in ==> C:\Program Files\MATLAB\R2010b\toolbox\shared\system\+matlab\+system\@APIProp\APIProp.p>APIProp.checkForEnumProp at 433
I appreciate any help I can get!

Respuesta aceptada

Wayne King
Wayne King el 3 de Feb. de 2014
Enter
devinfo = audiodevinfo;
then look at
devinfo.output
the name there should be a valid DeviceName property.
The easiest way is to use tab completion on the System object property
h = dsp.AudioPlayer;
then type the following
h.DeviceName = '
after you type the first single quote, hit the TAB key, you should see a list of valid device names.
  2 comentarios
Daniel Jimenez
Daniel Jimenez el 4 de Feb. de 2014
Thanks for your reply Wayne, that's what I've found so far but it's not quite what I'm looking for. You see, when I type:
devinfo = audiodevinfo;
devinfo.output.Name
I get:
ans =
HDMI PDP (Intel(R) Display Audi
ans =
Communications Headphones (IDT
ans =
Speakers and Headphones (IDT Hi
I can't use neither of these strings to specify the DeviceName property for dsp.AudioPlayer since none of them has the complete name of the device, therefore returning the aforementioned error.
What I would like is to be able to get the complete names of the devices in order to use them in a popup list object in a GUI so I can assign them to the DeviceName property of dsp.AudioPlayer without using the tab completion for it.
Is there a way of doing this?
Daniel Jimenez
Daniel Jimenez el 13 de Mzo. de 2014
I found that dspAudioDeviceInfo retrieves the information I need to display in regards to the name of the default interface that MATLAB is using for dsp.AudioRecorder and dsp.AudioPlayer. Thanks for your reply Wayne!

Iniciar sesión para comentar.

Más respuestas (1)

Wayne King
Wayne King el 4 de Feb. de 2014
Hi Daniel, can you try this:
To select or change the Audio Hardware API, select Preferences from the MATLAB Toolstrip. Then select DSP System Toolbox from the tree menu. You should see which audio hardware API you can choose from.
  1 comentario
Daniel Jimenez
Daniel Jimenez el 4 de Feb. de 2014
Yes, of course. In the Preferences from the MATLAB Toolstrip, under the Signal Processing Blockset leaf from the tree menu (there is no DSP System Toolbox leaf) I found:
Audio Hardware API
Select the API that is used to communicate with the audio hardware (soundcard) for the To and From Audio Device blocks, and the dsp.AudioPlayer and dsp.AudioRecorder System objects.
(*) Windows DirectSound
( ) Windows WMD-KS
Selecting the Windows WMD-KS radio button causes that when creating a new dsp.AudioPlayer Object it doesn't find any output devices.

Iniciar sesión para comentar.

Community Treasure Hunt

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

Start Hunting!

Translated by