(Removed) Play audio data using computer's audio device
The dsp.AudioPlayer object has been removed. Existing instances of the
object error out. Replace with audioDeviceWriter object. For more information, see
Compatibility Considerations.
The AudioPlayer object plays audio data using the
computer's audio device.
To play audio data using the computer’s audio device:
Define and set up your audio player object. See Construction.
Call step to play audio data according to the
properties of dsp.AudioPlayer. The behavior of step is specific to each object in the toolbox.
This System object™ buffers the data from the audio device using the process illustrated by the following figure.

Note
Starting in R2016b, instead of using the step method
to perform the operation defined by the System object, you can call the object with arguments, as if it were a function. For
example, y = step(obj,x) and y = obj(x) perform
equivalent operations.
H = dsp.AudioPlayer returns an audio player object, H, that plays audio samples using an audio output device in
real-time.
H = dsp.AudioPlayer('
returns an audio player object, PropertyName',PropertyValue,
...)H, with each property set to
the specified value.
H = dsp.AudioPlayer(SAMPLERATE,'
returns an audio player object, PropertyName',PropertyValue,
...)H, with the SampleRate property set to SAMPLERATE and other
specified properties set to the specified values. This System object supports variable-size input. If you use variable-size signals with this
System object, you may experience sound dropouts when the size of the input frame increases.
To avoid this behavior, use a signal of maximum expected size when you first call
step to start running through this System object.
|
Device to which to send audio data Specify the device to which to send the audio data. The default is
|
|
Number of samples per second sent to audio device Specify the number of samples per second in the signal as an integer. The default is
|
|
Data type used by device Specify the data type used by the audio device to acquire audio data as
|
|
Source of Buffer Size Specify how to determine the buffer size as |
|
Buffer size Specify the size of the buffer that the audio player object uses to communicate with
the audio device as an integer. This property applies when you set the |
|
Size of queue in seconds Specify the length of the audio queue, in seconds. The default is
To minimize latency, lower the |
|
Enable output of underrun count Set to |
|
Source of device channel mapping Specify whether to determine the channel mapping as |
|
Data-to-device channel mapping Vector of valid channel indices to represent the mapping between data and device
output channels. The term Channel Mapping refer to a 1-to-1
mapping that associates channels on the selected audio device to channels of the data.
When you play audio, channel mapping allows you to specify which channel of the audio
data to output a specific channel of audio data. By default, the |
| step | Write audio to audio output device |
| Common to All System Objects | |
|---|---|
release | Allow System object property value changes |
To run your generated standalone executable application in Shell, you need to set your environment to the following:
| Platform | Command |
|---|---|
| Mac |
|
| Linux |
|
| Windows |
|
This object implements the algorithm, inputs, and outputs described on the To Audio Device block reference page. The object properties correspond to the block parameters.