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.

  • Audio Capture block

Libraries:
Simulink Support Package for Android Devices / Audio & Video

Description

Use the Audio Capture block to capture an audio sample from the device microphone. The block outputs the left and right audio channels as an N–by–2 int16 matrix. N is the number of audio samples per frame, and the columns of the matrix represent the left and right audio channels, respectively. The Frame size (N) parameter sets the value of N.

The sample time of the block is derived from Frame size (N) and Audio sampling frequency (Hz) parameter values. For example, if Audio sampling frequency (Hz) is 44100 Hz and the Frame size (N) is 4410, then the sample time is 4410/44100 = 0.1s.

Note

During simulation with no hardware connected, this block does nothing. For more information, see Block Produces Zeros or Does Nothing in Simulation.

Ports

Output

expand all

The block outputs the audio samples captured from the device microphone, returned as an N–by–2 numeric matrix. Here, N is the number of audio samples per frame. The columns of the matrix represent the left and right audio channels, respectively.

Data Types: int16

Parameters

expand all

Specify the sample rate of the device microphone.

Specify the number of audio samples per frame.

Version History

Introduced in R2014a