Store recorded audio signal in numeric array
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 object.
dataType— Data type
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
-32768 to 32767
-1 to 1
-1 to 1