2个回答
展开全部
clear all
close all
%录制语音并进行回放
fs=8000; % 设置采样频率
duration=10; % 设置录音时间
fprintf('Press any key to start %g seconds of recording...\n',duration);
pause;
fprintf('Recording...\n');
S=wavrecord(duration*fs,fs,1,16); % 录制语音,量化位长16bit
fprintf('Finished recording.\n');
fprintf('Press any key to play the recording...\n');
pause;
wavplay(S,fs); % 语音回放
wavwrite(S,fs,16,'a'); % 保存录音文件“a.wav”
close all
%录制语音并进行回放
fs=8000; % 设置采样频率
duration=10; % 设置录音时间
fprintf('Press any key to start %g seconds of recording...\n',duration);
pause;
fprintf('Recording...\n');
S=wavrecord(duration*fs,fs,1,16); % 录制语音,量化位长16bit
fprintf('Finished recording.\n');
fprintf('Press any key to play the recording...\n');
pause;
wavplay(S,fs); % 语音回放
wavwrite(S,fs,16,'a'); % 保存录音文件“a.wav”
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询