listAudioDevices - Get a list of available audio devices on the NVIDIA hardware - MATLAB (original) (raw)
Main Content
Get a list of available audio devices on the NVIDIA hardware
Since R2021a
Syntax
Description
[audiolist](#mw%5Fc924aaeb-cdfd-4038-bf54-e22fa9b247dc) = listAudioDevices([hwObj](#mw%5F3fcb6937-0cea-4fd8-841a-4865f7569ff1%5Fsep%5Fmw%5Fbcc65819-faa5-4997-9bca-35a8da7d894a),[audioType](#mw%5Fcd1f933f-fa90-43dd-8037-a3bbed8b5f87))
returns a list of Advanced Linux Sound Architecture (ALSA) audio devices connected to your NVIDIA® hardware. The type of listed audio devices (capture or playback) depends on the audioType
specified in the function.
Examples
To list ALSA audio input devices connected to the hardware:
Create a connection to the NVIDIA hardware.
hwobj = jetson('jetson-board-name','ubuntu','ubuntu');
Use the listAudioDevices
function. In the function, specifyaudioType
as 'capture'
. The function returns a structured array with field names that correspond to the properties of ALSA audio input devices connected to the jetson
object.
devices = listAudioDevices(hwobj,'capture')
devices =
1×2 struct array with fields:
Name
Device
Channels
BitDepth
SamplingRate
In this example, the function returns a 1-by-2 array, indicating that two audio input devices are connected to the jetson
object.
View the properties of the first ALSA audio input device. For example,
ans =
struct with fields: Name: 'USB-Audio-PlantronicsBlackwire325.1↵ PlantronicsPlantronicsBlackwire325.1atusb -3530000.xhci-2.3,fullspeed' Device: '2,0' Channels: {'2'} BitDepth: {'16-bit integer'} SamplingRate: {'8000' '48000'}
To list all connected ALSA audio output devices:
Create a connection to the NVIDIA hardware.
hwobj = jetson('jetson-board-name','ubuntu','ubuntu');
Use the listAudioDevices
function. In the function, specifyaudioType
as 'playback'
. The function returns a structured array with field names that correspond to the properties of ALSA audio output devices connected to the jetson
object.
devices = listAudioDevices(hwobj, 'playback')
devices =
struct with fields: Name: 'USB-Audio-PlantronicsBlackwire325.1↵ PlantronicsPlantronicsBlackwire325.1atusb -3530000.xhci-2.3,fullspeed' Device: '2,0' Channels: {'2'} BitDepth: {'16-bit integer'} SamplingRate: {'8000' '48000'}
In this example, the function returns a 1-by-1 array, indicating that one audio output devices is connected to the jetson
object.
Input Arguments
Connection to a specific NVIDIA hardware board, specified as a jetson or drive object.
Specify the type of audio to be listed:
'capture'
— ALSA audio input devices connected to the NVIDIA hardware.'playback'
— ALSA audio output devices connected to the NVIDIA hardware.
Example: audiolist = listAudioDevices(hwObj,'playback')
Output Arguments
The type of listed audio devices depends on the audioType specified in the function. The resulting structured array contains these details:
Name
: The name of the audio device.Device
: The device identifier for the audio device: the card number and the device number, separated by a comma.Channels
: The number of channels supported by the audio device. For example, in List Available ALSA Audio Output Devices, the audio device supports audio from two channels only.BitDepth
: The data type in which the audio device reads or sends data.SamplingRate
: The sample rates supported by the audio device.
Version History
Introduced in R2021a