recordblocking
Record audio to audiorecorder
object; hold control until recording
completes
Syntax
recordblocking(
recorderObj
, length
)
Description
recordblocking(
records
audio from an input device, such as a microphone connected to your
system, for the number of seconds specified by recorderObj
, length
)length
.
The recordblocking
method does not return control
until recording completes. recorderObj
is
an audiorecorder
object that
defines the sample rate, bit depth, and other properties of the recording.
Examples
Record 5 seconds of your speech with a microphone, and play it back:
myVoice = audiorecorder; disp('Start speaking.'); recordblocking(myVoice, 5); disp('End of recording. Playing back ...'); play(myVoice);
Tips
Note
Security Considerations When Using MATLAB® Online™ or MATLAB Web App Server™: When using
recordblocking
in MATLAB Online or MATLAB Web App Server, recording continues when you switch browser tabs.