Main Content

Audio Capture

Capture audio stream from device microphone

Add-On Required: This feature requires the Simulink Support Package for Android Devices add-on.

Library

Simulink Support Package for Android Devices / Audio & Video

  • Audio Capture block

Description

Get the stereo audio stream from the audio input, such as the built-in or an external microphone, attached to the Android™ device.

The Audio Capture block outputs an N-by-2 array of int16 values. The left and right audio channels are assigned to the first and second columns of the output array, respectively.

The sample time of the block is the Frame size (N) divided by the Audio sampling frequency (Hz). For example, with sample rate of 44,100 Hz and Frame size of 4410, the sample time of the block is 0.1 s. You reduce sample time by either increasing the frame size or decreasing the sampling frequency.

Note

During simulations without hardware, this block outputs zeros. See Block Produces Zeros or Does Nothing in Simulation.

Parameters

Audio sampling frequency (Hz)

Specify the sample rate of the input device. The default value is 44100 Hz.

Frame size (N)

Specify the frame size, N, in samples.

Version History

Introduced in R2014a