๐ How To Convert An Mp3 To Wav
Just wanted to post my example too using NAudio.Lame: NuGet: Install-Package NAudio.Lame Code Snip: Mine obviously returns a byte[] - I have a separate save to disk method b/c I think it makes unit testing easier.
ffmpeg -i file.mp3 newfile.wav. From this command, you have specified the .mp3 audio file you wish to convert and the new name of the .wav audio file resulting from this conversion process. As an example, I wanted to convert the .mp3 audio file โemotions.mp3โ to a .wav audio file with the following command. ffmpeg -i emotions.mp3 emotions.wav
Generally speaking, converting between audio formats is easy. Doing text to speech in the first place is very hard . So focus on the hard part first, get that solved, then deal with the specific requirements of the output format at the end.
As you can see, the WAV header is the only difference between WAV and PCM file formats. The assumption is that you are recording 16 bit PCM MONO audio (which according to your code, you are). The rawToWave function just neatly adds headers to the WAV file, so that music players know what to expect when your file is opened, and then after the
f5Mb.
how to convert an mp3 to wav