saving recorded file in while loop
6 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
AMULYA PONNURU 17BIS0031
il 9 Nov 2018
Commentato: AMULYA PONNURU 17BIS0031
il 9 Nov 2018
I'm doing a signal processing project in which i need to record user's command and save it in a file as .wav form. After that it should compare the audio file with the saved ones using correlation, and move a robot according to the input command( Using Arduino). The words spoken by the user will be left, right, front, back or stop. These words are already saved in the computer with the user's voice. My code to record the data is as follows:
a=audiorecorder(8000,16,1);
p=1;
while p==1
disp('Enter 1 to record command (speak as soon as you press enter): ');
disp('Enter nothing to stop giving commands');
k=input('');
if k==1
record(a,1);
end
b=getaudiodata(a);
audiowrite('test.wav',b,8000);
if isempty(k)
p=0;
end
end
Error is:
Error using audiorecorder/getaudiodata (line 745)
Recorder is empty.
Error in signalsproject (line 10)
b=getaudiodata(a);
Plse help me My submission is 2mrw
0 Commenti
Risposta accettata
Geoff Hayes
il 9 Nov 2018
Amulya - the error message is telling you that you haven't recorded anything. You may want to put a breakpoint in the code and then re-run to see what value is being assigned to k. If it isn't 1, then the
record(a,1);
won't be evaluated.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Audio and Video Data in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!