record
将音频录制到 audiorecorder 对象中
语法
record(recorderObj)
record(recorderObj, length)
说明
record( 从输入设备中录制音频,例如连接到您系统的麦克风。recorderObj)recorderObj 是一个 audiorecorder 对象,用于定义录制的采样率、位深及其他属性。
record( 录制时长是 recorderObj, length)length 指定的秒数。
示例
用麦克风录制 5 秒您的语音:
myVoice = audiorecorder;
% Define callbacks to show when
% recording starts and completes.
myVoice.StartFcn = 'disp(''Start speaking.'')';
myVoice.StopFcn = 'disp(''End of recording.'')';
record(myVoice, 5);要收听录制内容,请调用 play 方法:
play(myVoice);
提示
注意
使用 MATLAB® Online™ 或 MATLAB Web App Server™ 时的安全注意事项:在 MATLAB Online 或 MATLAB Web App Server 中使用
record时,切换浏览器标签页不会停止录制,录制仍会继续。