Audio File Read

Add audio file from computer into mobile application

Description

The Audio File Read block copies an audio source file into your model and outputs the audio data into the model. The block outputs audio data as an M-by-N matrix, where M is the number of channels and N is the frame size of audio data.

Audio data consists of one or more channels. A mono audio source file only has one channel and a stereo audio source file has two channels. The audio data is output from the block as frames consisting of M consecutive samples of audio data.

Algorithm

The sample time of the Audio File Read block is determined automatically by the data frame size and audio frequency of the selected audio file.

Sample time = frame size / audio frequency

For example, if the audio frequency is 44,100 Hz and the frame size is 4410 samples, then the block sample time is 4410 / 44,100 = 0.1 seconds.

To select an audio source file, use the File name parameter. The audio frequency of the selected file displays on the block.

Note

To maintain audio quality, in blocks connected to the Audio File Read block, set the sample time to inherited.

Ports

Output

expand all

The block emits data an M-by-N matrix, where M is the number of channels and N is the frame size. To specify N, use the Frame size parameter.

Data Types: int16

Parameters

expand all

If the location of the file does not appear on your MATLAB® path, click Browse to specify the full path. If the location of this file does appear on your MATLAB path, enter only the file name.

The frame size must be a positive integer value. Larger frame sizes can result in a delay in your audio output.

Introduced in R2017a