views:

131

answers:

2

Wav files support different encodings, including mp3. Is there a C/C++ library that would produce mp3-encoded wav files from uncompressed wav? If not, what would be the best place to start to implement one?

A: 

Have you checked : http://lame.sourceforge.net/

Tuomas Pelkonen
Unfortunately LAME produces MP3s in a MPEG container, not a RIFF container.
Ignacio Vazquez-Abrams
This is the first place I checked, thanks. It does not seem to be able to create wav files, like Ignacio said.
Don Reba
A: 
  1. The best way indead to use Lame (if you do not afraid patent issues). You can use the both sources for lame and lame_enc.dll. Using the lame_enc.dll is more easier. As for RIFF-WAV container: it is simply to create RIFF-WAV files according to RIFF-WAV specification.

  2. There are another possibilities. For example using ACM codecs.

But in any case you should be capable to prepend sound stream with RIFF-WAV header. This can be done manaully (I think the simplest way) or by using some free library (it seems libsnd is capable to do this).

VitalyVal
Actually, libsnd is quite explicit about not supporting MP3.
Don Reba
You sould distinguish support of audio stream format and file types (containers). There is no need to use allinone tool for producing RIFF-WAV MP3 files. You need: 1) a MP3 encoding engine (lame, ACM codec, DirectShow filter); 2) ability to add RIFF-WAV header to MP3 stream. For item 2 you can start from converting pure MP3 files to RIFF-WAV MP3 files.See:MPEGLAYER3WAVEFORMAT (MSDN)RIFF-WAV specification (e.g. http://www.sonicspot.com/guide/wavefiles.html)http://a-gamyl.hp.infoseek.co.jp/Clang/dgwriff/driff.cpphttp://www.koders.com/cpp/fid1163D7D7C554A5DD192C098EE9918D8B8AD8C618.aspx
VitalyVal