tags:

views:

259

answers:

2

How to write mp3 frames (not full mp3 files with ID3 etc) from PCM data?

I have something like PCM data (for ex 100mb) I want to create an array of mp3 frames from that data. How to perform such operation? (for ex with lame or any other opensource encoder)

What do I need:

  • Open Source Libs for encoding.
  • Tutorials and blog articles on How to do it, about etc.
+1  A: 

You should be able to use LAME. It has a -t command line switch that turns off the INFO header in the output (otherwise present in frame 0). If that still leaves too much bookkeeping data, you should be able to write a separate tool to strip that away.

unwind
addition, look at http://www.codeproject.com/KB/audio-video/mpegaudioinfo.aspx for information about the mpeg (header) format. With that information it should be possible to process the resulting mp3 file.
Wimmel
+1  A: 

You are already on the right track: use LAME external executable, or any other shell-invoked encoder.

To build MP frames, were your layer of interest is 3, is not easy to do from scratch. There are compression steps, Fast-fourier transforms followed by quantization, which are of complex and tediously long explanation. The amount of work required for a developer to build it from scratch is very big. There are programmatic C and C++ MP encoding libs, but you will be either asked for fees, be left with very limited support, or have very limited interfacing options.

Go LAME, study their wiki.

jpinto3912