Convert from PCM to WAV. Is it Possible?

2020-05-27 18:25发布

问题:

I have an application for iPAD. This application records the voice of the microphone. The audio formats of the item must be PCM, MP3 and WAV files. The MP3 file I get it starting from the original raw file and then convert using LAME. Unfortunately I have not found any example that allows me to convert a PCM file to a WAV file. I just noticed that if I put the file extension to WAV format, starting from the raw application saves without problems, so I think that there is no type conversion from PCM WAV files. Correct?

PS: Sorry for my english ... I use Google Translate

回答1:

WAV is some kind of a box. PCM is in the box. There are many container formats like MP4. MP4 can contain audio, video or both. It can also contain multiple video or audio streams. Or zip files. Zip files can contain text files. But zip files can also contain images, pdfs,... But you can't say "how can I convert a zip file to the text file inside the zip".

If you want to convert PCM data to a WAVE file you should not many problems because WAV files are quite simple files. Take a look at this:

(See also WAVE PCM soundfile format.)

You first need that header and after you can just append all your pcm data (see the data field).



回答2:

Converting PCM to WAV isn't too hard. PCM and WAV both format contains raw PCM data, the only difference is their header(wav contains a header where pcm doesn't). So if you just add wav header then it will do the tricks. Just get the PCM data and add the wav header on top of the PCM data. To add wav header with PCM data, check this link.