如何在MATLAB中将wavwrite及其参数更改为audioread?

时间:2017-08-11 15:39:54

标签: matlab

我正在研究说话人识别系统并尝试录制语音并保存在数据库中以便稍后识别。

disp('Recording stopped.');
y1 = getaudiodata(micrecorder);
y = getaudiodata(micrecorder, 'uint8');
if size(y,2)==2
    y=y(:,1);
end
y = double(y);
sound_number = sound_number+1;
data{sound_number,1} = y;
data{sound_number,2} = classe;
data{sound_number,3} = 'Microphone';
data{sound_number,4} = 'Microphone';
st=strcat('u',num2str(sound_number));         %error here
wavwrite(st,y1,samplingfrequency,samplingbits)%error here
save('sound_database.dat','data','sound_number','-append');
msgbox('Sound added to database','Database result','help');
disp('Sound added to database');

但是我收到了这个错误:

  

未定义的函数或变量“wavwrite”   voicerecognition中的错误(第66行)
  wavwrite(y1,samplingfrequency,samplingbits,st)

我尝试更改为audioread,但我不知道如何更改其值 注意:st用于表示文件名。

1 个答案:

答案 0 :(得分:1)

在MATLAB R2015b中删除了

wavwrite。您正在使用更高版本,因此错误。等同于wavwrite的是audiowrite,而不是audioread

audiowrite(st,y1,samplingfrequency,'BitsPerSample',samplingbits);