Main Content

Audio Capture

Capture audio samples from an input audio device and send to an algorithm

  • Library:
  • SoC Blockset / Peripherals

  • Audio Capture block


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.



expand all

This message port receives data messages from a connected Audio Capture Interface block. The messages process when the Task Manager block triggers the task containing the Audio Capture block. For more information on messages, see Messages.

Data Types: SoCData


expand all

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 Types: int8 | int16 | int32


expand all

Specify the data type for the audio capture device.

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.

Specify the number samples per frame, M, of audio data received.

If used in a timer-driven task, enter the sample time of the task defined in the Task Manager block. If used in the event-driven task, enter -1.

Extended Capabilities

Introduced in R2021a