【发布时间】:2011-10-08 14:13:53
【问题描述】:
在阅读website of MathWorks 时,我了解到他们不鼓励使用wavrecord 函数,因为它很快就会被弃用,所以我决定改用audiorecorder。一切都很好,甚至播放功能也在播放录制的音频,但是当我使用wavwrite 函数写入 wav 文件时听起来不太好,基本上我注意到持续时间设置不正确。
我正在展示程序,请建议我如何使它正确。谢谢。
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;上面的行正在制造问题,它是多余的。现在它工作正常。 :-)
标签: matlab audio signal-processing