saving recorded file in while loop
10 views (last 30 days)
Show older comments
AMULYA PONNURU 17BIS0031
on 9 Nov 2018
Commented: AMULYA PONNURU 17BIS0031
on 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 Comments
Accepted Answer
Geoff Hayes
on 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.
More Answers (0)
See Also
Categories
Find more on Audio and Video Data in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!