Main Content


Store recorded audio signal in numeric array



y = getaudiodata(recorder) returns recorded audio data associated with audiorecorder object recorder in a double array y.


y = getaudiodata(recorder,dataType) converts the signal data to the specified data type.


collapse all

Create a recording using the audiorecorder object and then get the audio signal as a numeric array of different data types.

Create an audiorecorder object and record a five second audio clip from your microphone.

recObj = audiorecorder;
disp('Start speaking.')
Start speaking.
disp('End of Recording.');
End of Recording.

Get the audio signal as a double array and plot the data.

doubleArray = getaudiodata(recObj);
title('Audio Signal (double)');

Get the audio signal as an int8 array and plot the data. Based on the data type specified, the same audio signal is returned with a different range of values . In this case, the values in the int8 array can span between -128 and 127.

int8Array = getaudiodata(recObj,'int8');
title('Audio Signal (int8)');

Input Arguments

collapse all

Audio recorder object, specified as an audiorecorder object. Use the audiorecorder function to create the object.

Data type of the output audio signal, specified as one of these values: 'double', 'single', 'int16', 'int8', or 'uint8'.

Data Types: char | string

Output Arguments

collapse all

Audio signal data, returned as a numeric array.

The number of columns in y depends on the number of channels in the recording: one for mono and two for stereo.

The value range of y depends on the specified dataType.

Data Type

Sample Value Range


-128 to 127


0 to 255


-32,768 to 32,767

single or double

-1 to 1

Version History

Introduced in R2006a