2
在閱讀website of MathWorks時,我瞭解到他們不鼓勵使用wavrecord
函數,因爲它很快就會被棄用,所以我決定改用audiorecorder
。一切都很好,連播放功能也被打了錄製的音頻,但是當我使用wavwrite
功能寫信給它不是聽起來很好wav文件,基本上我注意到,持續時間設置不正確。MATLAB audiorecorder和wavwrite
我表示通過上述程序,請建議我如何使它正確。謝謝。
fs = 44100
bits = 16
recObj = audiorecorder(fs, bits, 1);
%# 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);
%disp(size(myRecording));
%# Plot the waveform.
plot(myRecording);
wavwrite(myRecording, fs, bits,'sample01_6k');
%#wavplay(myRecording,fs);
對不起,我發現我的錯誤,它非常簡單:-P recObj = audiorecorder; 上面的行被創建的問題,這是多餘的。現在它工作正常。 :-) – user985415