Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Audio Device Writer

Play to sound card

  • Library:
  • DSP System Toolbox / Sinks

Description

The Audio Device Writer block writes audio samples to an audio output device.

Parameters of the Audio Device Writer block specify the driver, the device, and device attributes such as sample rate and bit depth.

Data Flow of Audio Device Writer Block

  • An audio signal frame is input to the Audio Device Writer block.

  • The Audio Device Writer block uses the specified driver to pass the frame (device input) to your specified audio device buffer.

  • The audio device performs digital-to-analog conversion at the specified sample rate and bit depth.

  • The audio device outputs an analog chunk to your speaker.

Ports

Input

expand all

If input to the Audio Device Writer block is of data type double or single, the block clips values outside the range [–1, 1]. For other data types, the allowed input range is [min, max] of the specified data type.

Data Types: single | double | int16 | int32 | uint8

Output

expand all

This port outputs the number of samples underrrun while writing a frame of data (one input matrix).

Dependencies

To enable this port, select the Output number of samples underrun parameter.

Data Types: uint32

Parameters

expand all

Main Tab

  • ASIO drivers do not come pre-installed on Windows machines. To use the ASIO driver option, install an ASIO driver outside of MATLAB®.

    Note

    If Driver is set to ASIO, open the ASIO UI outside of MATLAB to set the sound card buffer size to the frame size (number of rows) input to the Audio Device Writer block. See the documentation of your ASIO driver for more information.

  • WASAPI drivers are supported for exclusive-mode only.

ASIO and WASAPI drivers do not provide sample rate conversion. For ASIO and WASAPI drivers, supply an audio stream with a sample rate supported by your audio device.

This parameter applies only on Windows machines. Linux machines always use the ALSA driver. Mac machines always use the CoreAudio driver.

To specify nondefault Driver values, you must install Audio System Toolbox™. If the toolbox is not installed, specifying nondefault Driver values returns an error.

The device list is populated with devices available on your computer.

This button opens a dialog box that lists your selected audio driver, the full name of your audio device, and the maximum output channels for your configuration. For example:

When you select this parameter, the block inherits its sample rate from the input signal. When you clear this parameter, you specify the sample rate in Sample rate (Hz).

The possible range of Sample rate (Hz) depends on your audio hardware.

Dependencies

To enable this parameter, clear the Inherit sample rate from input parameter.

Advanced Tab

Before performing digital-to-analog conversion, the input data is cast to a data type specified by this parameter.

Note

To specify a nondefault Device bit depth, you must install Audio System Toolbox. If the toolbox is not installed, specifying a nondefault Device bit depth returns an error.

When you select this parameter, the block uses the default mapping between columns of the matrix input to this block and the channels of your device. When you clear this parameter, you specify the mapping in Device output channels.

Nondefault mapping between columns of matrix input to the Audio Device Writer block and channels of output device, specified as a scalar or vector. For example:

If Device output channels is specified as 1:3, then:

  • The first column of the input matrix maps to channel 1.

  • The second column of the input matrix maps to channel 2.

  • The third column of the input matrix maps to channel 3.

If Device output channels is specified as [3,1,2], then:

  • The first column of the input matrix maps to channel 3.

  • The second column of the input matrix maps to channel 1.

  • The third column of the input matrix maps to channel 2.

Note

To selectively map between columns of the input matrix and your sound card's output channels, you must install Audio System Toolbox. If the toolbox is not installed, specifying nondefault values for Device output channels returns an error.

Dependencies

To enable this parameter, clear the Use default mapping between columns of input of this block and sound card’s output channels parameter.

When you select this parameter, an output port is added to the block. The port outputs the number of samples underrrun while writing a frame of data (one input matrix).

Extended Capabilities

Introduced in R2016a

Was this topic helpful?