| Contents | Index |
recorder = audiorecorder
recorder = audiorecorder(Fs,nBits,nChannels)
recorder = audiorecorder(Fs,nBits,nChannels,ID)
recorder = audiorecorder creates an 8000 Hz, 8-bit, 1-channel audiorecorder object.
recorder = audiorecorder(Fs,nBits,nChannels) sets the sample rate Fs (in Hz), the sample size nBits, and the number of channels nChannels.
recorder = audiorecorder(Fs,nBits,nChannels,ID) sets the audio input device to the device specified by ID.
To use an audiorecorder object, your system must have a properly installed and configured sound card.
audiorecorder is not intended for long, high-sample-rate recording. audiorecorder uses system memory for storage and does not use disk buffering. When you attempt a large recording, your MATLAB performance sometimes degrades over time.
Fs | Sampling rate in Hz. Valid values depend on the specific audio hardware installed. Typical values supported by most sound cards are 8000, 11025, 22050, 44100, 48000, and 96000 Hz. Default: 8000 |
nBits |
Bits per sample. Valid values depend on the audio hardware installed: 8, 16, or 24. Default: 8 |
nChannels |
The number of channels: 1 (mono) or 2 (stereo). Default: 1 |
ID |
Device identifier. To obtain the ID of a device, use the audiodevinfo function. Default: -1 (default device) |
Note When calling any method, include the audiorecorder object name using function syntax, such as stop(recorder). |
Query properties of audiorecorder object. | |
Create an array that stores the recorded signal values. | |
Create an audioplayer object. | |
Query whether recording is in progress: returns true or false. | |
Pause recording. | |
Play recorded audio. This method returns an audioplayer object. | |
Start recording. | |
Record, and do not return control until recording completes.
This method requires a second input for the length of the recording
in seconds: | |
Restart recording from paused position. | |
Set properties of audiorecorder object. | |
Stop recording. |
See the reference pages for get, getaudiodata, play, record, recordblocking, and set for additional syntax options.
The following four properties apply to callback functions. The first two inputs to your callback function must be the audiorecorder object and an event structure. | |
| StartFcn | Function to execute one time when recording starts. |
| StopFcn | Function to execute one time when recording stops. |
| TimerFcn | Function to execute repeatedly during recording. To specify time intervals for the repetitions, use the TimerPeriod property. |
| TimerPeriod | Time in seconds between TimerFcn callbacks. Default: .05 |
audiorecorder ignores any specified values for these properties, which will be removed in a future release. | |
| BufferLength | Length of buffer in seconds. |
| NumberOfBuffers | Number of buffers. |
Create an audiorecorder object for CD-quality audio in stereo, and view its properties:
recObj = audiorecorder(44100, 16, 2); get(recObj)
Collect a sample of your speech with a microphone, and plot the signal data:
% Record your voice for 5 seconds.
recObj = audiorecorder;
disp('Start speaking.')
recordblocking(recObj, 5);
disp('End of Recording.');
% Play back the recording.
play(recObj);
% Store data in double-precision array.
myRecording = getaudiodata(recObj);
% Plot the waveform.
plot(myRecording);audiodevinfo | audioplayer | sound

Explore how to use MATLAB to make advancements in engineering and science.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |