Capture audio samples from an input audio device and send to an algorithm
SoC Blockset / Peripherals
The Audio Capture block simulates behavior of the driver code that captures samples of an audio stream on an hardware board. The input of this block must be connected to an Audio Capture Interface block that simulates the physical audio device on a hardware board. Place this block inside a task and connect to an algorithm to process a frame of audio samples each time the task executes. For more information on tasks, see Timer-Driven Task and Event-Driven Tasks.
msg — Data message from audio capture interface
data — Data frame from captured audio
M-element vector | M-by-C matrix
When block receives a single audio channel, data is an M-element audio data frame received from a simulated hardware audio source. The Samples per frame parameter defines the number of samples, M, of audio data. When the block receives multiple audio channels, the audio data is an M-by-C matrix, where C is specified by the Number of channels parameter.
Data type — Data type of audio device
int16 (default) |
Specify the data type for the audio capture device.
Number of channels — Number of data channels
2 (default) | positive integer
Specify the number of audio channels, C, received from the audio device. This number should match the Number of channels parameter in the Audio Capture Interface block.
Samples per frame — Size of data vector read from audio device
4410 (default) | positive scalar integer
Specify the number samples per frame, M, of audio data received.
Sample time — Sample time in seconds
-1 (default) | positive scalar
If used in a timer-driven task, enter the sample time of the task defined in the
block. If used in the event-driven task, enter
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 capture audio from an audio input device. To specify the audio input 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