Quantcast

Documentation Center

  • Trial Software
  • Product Updates

audiodevinfo

Information about audio device

Syntax

  • info = audiodevinfo example
  • nDevices = audiodevinfo(IO) example
  • name = audiodevinfo(IO,ID)
  • DriverVersion = audiodevinfo(IO,ID,'DriverVersion')
  • support = audiodevinfo(IO,ID,Fs,nBits,nChannels) example
  • ID = audiodevinfo(IO,name)
  • ID = audiodevinfo(IO,Fs,nBits,nChannels)

Description

example

info = audiodevinfo returns information about the input and output audio devices on the system.

example

nDevices = audiodevinfo(IO) returns the number of input devices on the system if IO is 1, and returns the number of output devices on the system if IO is 0.

name = audiodevinfo(IO,ID) returns the name of the audio device specified by the device identifier, ID.

DriverVersion = audiodevinfo(IO,ID,'DriverVersion') returns the name of the driver for the audio device specified by ID.

example

support = audiodevinfo(IO,ID,Fs,nBits,nChannels) returns 1 if the input or output audio device specified by ID supports the sample rate, number of bits, and number of channels specified by the values of Fs, nBits, and nChannels, respectively. Otherwise, support is 0.

ID = audiodevinfo(IO,name) returns the device identifier of the input or output audio device identified by the device name, name. If no device is found with the specified name, then ID is -1.

ID = audiodevinfo(IO,Fs,nBits,nChannels) returns the device identifier of the first input or output device that supports the sample rate, number of bits, and the number of channels specified by the values of Fs, nBits, and nChannels, respectively. If no supporting device is found, then ID is -1.

Examples

expand all

View Information About Audio Devices

Call audiodevinfo with no inputs to view information about the input and output audio devices on a system.

info = audiodevinfo
info = 

     input: [1x2 struct]
    output: [1x3 struct]

audiodevinfo returns a structure containing two fields, input and output.

View the contents of the input field in the Variables editor.

openvar info.input

The Variables editor displays the input audio device names, driver used, and device identifiers. The values on your system might differ from this example.

View Number of Output Devices

View the number of output audio devices on the system, using an IO value of 0 to indicate output.

nDevices = audiodevinfo(0)
nDevices =

     3

This example shows three output devices, but your system might vary.

Check Support for Input Device

Check if the input audio device identified by the ID value, 0, supports a sample rate of 44100 hertz, with 16 bits per sample, and two channels.

support = audiodevinfo(1,0,44100,16,2)
support =

     1

The input device supports the specified sample rate, number of bits and number of channels.

Input Arguments

expand all

IO — Input or output device1 | 0

Input or output device, specified as 1 to indicate input, or 0 to indicate output.

ID — Audio device identifierinteger

Audio device identifier, specified as an integer. The device can be an input or output audio device.

Fs — Sample ratescalar

Sample rate, in hertz, specified as a positive scalar.

Example: 44100

Data Types: single | double

nBits — Number of bits per samplescalar

Number of bits per sample, specified as a scalar.

Example: 16

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

nChannels — Number of audio channels1 | 2

Number of audio channels, specified as 1 (mono) or 2 (stereo).

name — Name of input or output devicestring

Name of the input or output audio device, specified as a string.

Data Types: char

Output Arguments

expand all

info — Information about audio devicesstructure array

Information about audio devices, returned as a structure array containing two fields, input and output. Each field is an array of structures, with each structure containing information about one of the audio input or output devices on the system. The individual device structure fields are:

  • Name — Name of the device, returned as a string.

  • DriverVersion — Name of the driver used to communicate with the device, returned as a string.

  • ID — Device identifier, returned as a scalar.

See Also

|

Was this topic helpful?