1
我試圖保存錄制的語音。當我按下'保存'按鈕時,錄製的音頻應保存爲.wav文件。但是這沒有發生。這是我的代碼至今...保存錄制的音頻
錄製按鈕...
function recordbutton_Callback(hObject, eventdata, handles)
% hObject handle to recordbutton (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
rec = audiorecorder
disp('Recording for 5 Seconds...')
recordblocking (rec,5); %5 Seconds
disp('Finished Recording.')
global myrecording
myrecording = getaudiodata(rec);
axes(handles.axes3);
plot(myrecording)
保存按鈕...
% --- Executes on button press in saverecording.
function saverecording_Callback(hObject, eventdata, handles)
global myrecording
audiowrite(myrecording, 'RecordedSound.wav');
你有什麼問題?你的代碼不工作?它不完整嗎? – zhqiat
當我按下'保存'按鈕時,錄製的音頻應保存爲.wav文件。但是這沒有發生。 –
*發生了什麼?你有空的.wav文件嗎?你確定回調被調用嗎?如果在調試過程中檢查它,'myrecording'是否包含您認爲在那個時間點的數據?您是否已經在調試控制檯上嘗試了'audiowrite'命令以查看它是否按預期工作? –