Playback audio samples from an algorithm to an output audio device
SoC Blockset / Peripherals
The Audio Playback block simulates behavior of the driver code that plays audio to an audio output, such as a speaker, on a hardware board. The output of this block must be connected to an Audio Playback Interface block that simulates a physical audio device on the hardware board. Place this block inside a task and connect to an algorithm to output a frame of audio samples each time the task executes. For more information on tasks, see Timer-Driven Task and Event-Driven Tasks.
data — Audio data frame
M-element vector | M-by-C matrix
Audio data frame to be sent to an audio playback device, specified as an M-element for single channel audio or as an M-by-C matrix for multi-channel audio. C is specified by the Number of channels parameter.
Number of channels — Number of channels
2 (default) | positive scalar
Specify the number of audio channels, C, in each audio data sample.
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
To automatically generate C code for your design, and execute on an SoC device, use the SoC Builder tool. To generate and execute C code for your SoC models, Embedded Coder® features are required. For more information on generating code for SoC designs, see Generate SoC Design.
When deployed to a supported hardware board, this block uses the advanced Linux sound architecture (ALSA) driver framework to send audio to an audio output device. To specify the audio output device and event triggers, use the Hardware Mapping tool. For more information on the ALSA driver framework, see the Advanced Linux Sound Architecture website.
Introduced in R2021a