MATLAB Answers


Saving an audio file in .wav format

I'm writing a program to record audio and save it as a .wav file. I'm able to record and play the voice, however, while using the audiowrite function the audio is getting clipped. The range of my audio signal falls between -1 and 1. I will attach my code and the plot of the audio graph. Can someone help me as to how to save the audio clip. I also used the 'save' command, but the file is not playable by VLC, Windows media player, etc.
a= audiorecorder(8000,8,1);
disp('start speaking')
disp('End of recording')
myrec= getaudiodata(a);


Sign in to comment.

1 Answer

Answer by Walter Roberson
on 15 Sep 2019
 Accepted Answer


Can you please help me with the above code? I went through the links previously, but I was not able to figure out the solution.
audiowrite('NameOfFile.wav', myrec, 8000)
Thank you so much. Cheers!

Sign in to comment.