Record Audio
To record data from an audio input device (such as a microphone connected to your system) for processing in MATLAB®:
Create an audiorecorder object.
Call the record or recordblocking method, where:
record returns immediate control to the calling function or the command prompt even as recording proceeds. Specify the length of the recording in seconds, or end the recording with the stop method. Optionally, call the pause and resume methods. The recording is performed asynchronously.
recordblocking retains control until the recording is complete. Specify the length of the recording in seconds. The recording is performed synchronously.
Create a numeric array corresponding to the signal data using the getaudiodata method.
The following examples show how to use the recordblocking and record methods.
Record Microphone Input
This example shows how to record microphone input, play back the recording, and store the recorded audio signal in a numeric array. You must first connect a microphone to your system.
Create an audiorecorder object named recObj for recording audio input.