Store recorded audio signal in numeric array
Get Data from Audio Recorder Object
Create a recording using the
audiorecorder object and then get the audio signal as a numeric array of different data types.
audiorecorder object and record a five second audio clip from your microphone.
recObj = audiorecorder; disp('Start speaking.')
recordblocking(recObj,5); disp('End of Recording.');
End of Recording.
Get the audio signal as a
double array and plot the data.
doubleArray = getaudiodata(recObj); plot(doubleArray); 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
int8Array = getaudiodata(recObj,'int8'); plot(int8Array); title('Audio Signal (int8)');
recorder — Audio recorder object
Audio recorder object, specified as an
audiorecorder object. Use the
audiorecorder function to create the
dataType — Data type
'double' (default) |
Data type of the output audio signal, specified as one of these values:
y — Audio signal data
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
Sample Value Range
-128 to 127
0 to 255
-32,768 to 32,767
-1 to 1
Introduced in R2006a