y = getaudiodata(recorder)
y = getaudiodata(recorder, dataType)
| Parameter | Description |
|---|---|
| recorder | audiorecorder object: audio recorder object created by audiorecorder. |
| dataType | string or character vector: data type of output audio signal. Valid values: 'double' (default), 'single', 'int16', 'int8', 'uint8'. |
| Parameter | Description |
|---|---|
| y | numeric array: audio signal data. Number of columns depends on channel count. |
getaudiodata returns recorded audio data from an audiorecorder object as a numeric array.
y = getaudiodata(recorder) returns the audio data as a double array.
y = getaudiodata(recorder, dataType) returns the audio data converted to the specified data type.
The number of columns in y matches the number of channels in the recording (1 for mono, 2 for stereo).
The value range of y depends on dataType:
| Data Type | Sample Value Range |
|---|---|
| int8 | -128 to 127 |
| uint8 | 0 to 255 |
| int16 | -32,768 to 32,767 |
| single or double | -1 to 1 |
recObj = audiorecorder;
disp('Start speaking.')
recordblocking(recObj, 5);
disp('End of Recording.');
doubleArray = getaudiodata(recObj);
plot(doubleArray);
title('Audio Signal (double)');
recObj = audiorecorder;
recordblocking(recObj, 2);
int8Array = getaudiodata(recObj, 'int8');
plot(int8Array);
title('Audio Signal (int8)');
| Version | Description |
|---|---|
| 1.16.0 | initial version |