【问题标题】:MATLAB audiorecorder and wavwrite [closed]MATLAB 录音机和 wavwrite [关闭]
【发布时间】: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


【解决方案1】:

您创建了两次recObj,第二次创建它时,您使用默认设置而不是自定义设置创建它。删除对audiorecorder 的第二次调用,一切都应该按预期工作。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-02-05
    • 1970-01-01
    • 2016-08-29
    • 2012-08-11
    • 1970-01-01
    • 1970-01-01
    • 2010-10-10
    • 1970-01-01
    相关资源
    最近更新 更多