why audioDeviceWriter doesn't list my output device?

Hello MATLAB comunity,
I’m trying to send audio over a USB Audio Class 2.0 (UAC2) implementation that enables the EV‑SC594‑EZKIT from ADI. The USB UAC2 device supports 16 inputs / 16 outputs at 16‑bit. MATLAB's audioDeviceReader lists the device and I can capture the audio properly:
>> deviceReader = audioDeviceReader(Driver="DirectSound"); InDevices=getAudioDevices(deviceReader)
InDevices =
1×4 cell array
{'Default'} {'Primary Sound Capture Driver'} {'Microphone Array on Monitor (2- Intel® Smart Sound Techno…'} {'Microphone (EV-SC594 (16x16x16bit))'}
However the audioDeviceWritter does not show the device:
>> deviceWritter = audioDeviceWriter(Driver="DirectSound"); OutDevices=getAudioDevices(deviceWritter)
OutDevices =
1×4 cell array
{'Default'} {'Primary Sound Driver'} {'Altavoces Laptop (2- Realtek(R) Audio)'} {'Altavoces (office)'}
In Windows, the playback device is listed correctly, and I can run the Test on Sound Playback window confirming each of the 16 streams in the EV‑SC594‑EZKIT and also using audioDeviceReader in simulink.
The output device is listed as 'WASAPI'
>> deviceWritter = audioDeviceWriter(Driver="WASAPI"); OutDevices=getAudioDevices(deviceWritter)
OutDevices =
1×4 cell array
{'Default'} {'SC594 (EV-SC594 (16x16x16bit))'} {'Altavoces Laptop (2- Realtek(R) Audio)'} {'Altavoces (office)'}
But I am having next error:
Error:Error in 'AudioAnalyzerSL/Audio Device
Writer': PortAudio Error: Invalid sample rate
Is there any way I can use MATLAB or SIMULINK to send audio to that USB Audio Class 2.0 port?
Thanks,
Gilberto

2 Comments

Submit this to Mathworks as an official support request/bug at <Product Support Page>
Hello @dpb, I just created a bug with the link you shared.
Thanks for the suggestion
Gilberto

Sign in to comment.

Answers (2)

If you use audioDeviceWriter with WASAPI, it is always in exclusive mode, so the sample rate and bit depth you specify in audioDeviceWriter must match the setting in the Windows Sound Properties. If there is an option to allow exclusive mode in Windows, make sure it is checked.
There is also a newer audio I/O object called audiostreamer. Try listing your devices in a table like this.
>> struct2table(audiostreamer.getAudioDevices)
The audiostreamer allows you to turn off exclusive mode, which may allow you to use any sample rate or bit depth. You could also specify 16-bit explicitely (might be necessary in exclusive mode if your device is 16-bit). You can also set the Player property to your device name and specify SampleRate. Here this would just play through the default Windows device:
>> as = audiostreamer(Driver="WASAPI",ExclusiveMode=false,DeviceBitFormat="int16")
>> play(as,pinknoise(44100,2)) % try 1 second of pink noise

4 Comments

Hi Jimmy,
Thanks for your reply, audiostreamer object confirms that direct sound playback is recognized only with "WASAPI" driver:
>> struct2table(audiostreamer.getAudioDevices)
ans =
16×5 table
Name Driver MaxRecorderChannels MaxPlayerChannels SampleRate
________________________________________________________________________________________ _____________ ___________________ _________________ __________
"Primary Sound Capture Driver" "DirectSound" 2 0 44100
"Headset Microphone (2- JBL Quantum 800 Chat)" "DirectSound" 1 0 44100
"Microphone Array on Monitor (2- Intel® Smart Sound Technology for Digital Microphones)" "DirectSound" 4 0 44100
"Microphone (EV-SC594 (16x16x16bit))" "DirectSound" 16 0 44100
"Primary Sound Driver" "DirectSound" 0 1 44100
"Headset Earphone (2- JBL Quantum 800 Chat)" "DirectSound" 0 1 44100
"Altavoces Laptop (2- Realtek(R) Audio)" "DirectSound" 0 2 44100
"Altavoces (2- JBL Quantum 800 Game)" "DirectSound" 0 8 44100
"ASIO4ALL v2" "ASIO" 16 16 44100
"SC594 (EV-SC594 (16x16x16bit))" "WASAPI" 0 16 48000
"Headset Earphone (2- JBL Quantum 800 Chat)" "WASAPI" 0 1 48000
"Altavoces Laptop (2- Realtek(R) Audio)" "WASAPI" 0 2 48000
"Altavoces (2- JBL Quantum 800 Game)" "WASAPI" 0 2 48000
"Microphone Array on Monitor (2- Intel® Smart Sound Technology for Digital Microphones)" "WASAPI" 4 0 48000
"Headset Microphone (2- JBL Quantum 800 Chat)" "WASAPI" 1 0 48000
"Microphone (EV-SC594 (16x16x16bit))" "WASAPI" 16 0 48000
but now I see that "DirectSound" recognizes a sample Rate of 44100 while "WASAPI" does at 48000
I just changed the Playback device SC594 configuration to have Exclusive Mode for this device
Also from previous list, is seen that "Primary Sound Driver" is not listed with "WASAPI" driver
so the last command you mentioned results in error:
as = audiostreamer(Driver="WASAPI",ExclusiveMode=false,DeviceBitFormat="int16")
as =
audiostreamer handle with properties:
Mode: 'player'
Driver: 'WASAPI'
Player: 'Primary Sound Driver'
SampleRate: 44100
Show all properties
>> play(as,pinknoise(44100,2))
Error using audiostreamer/setup (line 336)
The selected "Player" (Primary Sound Driver) is not available with Driver="WASAPI".
Error in audiostreamer/playInternal (line 1437)
setup(obj,x);
^^^^^^^^^^^^
Error in audiostreamer/play (line 961)
playInternal(obj,x,opt);
^^^^^^^^^^^^^^^^^^^^^^^
I adjusted your commands to send 5 seconds of Pink Noise to the 16 channels and the vumeters in the ADI eval board shows audio is arriving, I need to confirm the integrity of the signal but at least now I can send audio:
>> as = audiostreamer(Driver="WASAPI",ExclusiveMode=false,DeviceBitFormat="int16", Player="SC594 (EV-SC594 (16x16x16bit))")
as =
audiostreamer handle with properties:
Mode: 'player'
Driver: 'WASAPI'
Player: 'SC594 (EV-SC594 (16x16x16bit))'
SampleRate: 44100
Show all properties
>> play(as,pinknoise(44100*5,16))
Thanks again Jimmy!
That error is because in your version of audiostreamer, you need to specify Player="SC594 (EV-SC594 (16x16x16bit))". Otherwise, it's trying to use the "Primary Sound Driver" which is DirectSound only. The upcoming release will do the right thing and pick a valid WASAPI device if you construct the object with Driver="WASAPI", but you should still specify which device you want to use.
Yes, I created the object with the right device:
as = audiostreamer(Driver="WASAPI",ExclusiveMode=false,DeviceBitFormat="int16", Player="SC594 (EV-SC594 (16x16x16bit))")
And could send Pink Noise to the 16 inputs in the ADI EZKIT using audiostreamer
play(as,pinknoise(44100*5,16))
I just wanted to explain the reason for the previous error. Let me know if you still have any issues.

Sign in to comment.

Hi Gilberto,
The issue might be due to the supported maximum sample rate. You can go through the below MATLAB answer to find out about this -

Categories

Products

Release

R2025b

Asked:

on 23 Jan 2026

Commented:

on 4 Feb 2026 at 19:58

Community Treasure Hunt

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

Start Hunting!