MP3 (MPEG 1 Layer 3) and MPC (Musepack (SV8)) decoders

Hi all.

Here I present two AudioFormatReader classes for decoding purposes.

  1. The MADAudioFormatReader class uses the MAD (MPEG Audio Decoder) GPLed library to decode MP3 files. Why MAD? Because MAD is considered to be the most accurate decoder ever released under GPL license. There is no need to pay any patent fee in order to decode mp3 files because all patents related only to the encoding process. MAD does not use any patented technology to decode mp3 files, but only it’s own one. I see no obstacles to use MAD in JUCE because both JUCE and MAD are GPLed. To simplify MAD building process I’ve created the libmad.c file that must be solely included into your project in order to compile full functional MAD statically into your application.

  2. The MPCAudioFormatReader class uses the MPC (Musepack) library to decode MPC files. It has the BSD license now. It is based on the MPEG-1 Layer-2 / MP2 algorithms, but since 1997 it has rapidly developed and vastly improved and is now at an advanced stage in which it contains heavily optimized and patentless code. For more information on Musepack visit http://www.musepack.net. The library was modified by me to simplify incorporating the decoder into your application. Like I’d done to MAD, I’ve created the libmpcdec.c file to include it into your project. Despite the library has the encoder, I didn’t implement it yet in JUCE as MPCAudioFormatWriter. So, everyone is welcomed to implement it.

The archived file contains source code and MS Windows executable file of the Decodemo simple demo audio player application. Also, it contains the Code::Blocks project file for the demo application. The demo application was compiled under MinGW (GCC 4.2.1-dw2).

Decodemo.7z

1 Like

Nice one!

FWIW you can’t include any GPL code into Juce. As it’s double licensed not only GPL.
Or you would need to have a GPL release and a non GPL release
that do not use the same trunk.

Viva BSD :smiley:

[quote=“otristan”]FWIW you can’t include any GPL code into Juce. As it’s double licensed not only GPL.
Or you would need to have a GPL release and a non GPL release
that do not use the same trunk.

Viva BSD :D[/quote]

GPL is not that bad!

follow this link: http://www.underbit.com/products/mad/

You can find the following info there (in the middle of the page): “Commercial, non-GPL licensing is also available. Please contact us to discuss possible license terms.”

So, if you can find a certain amount of money to buy JUCE’s commercial license, so I’m sure you can find an extra amount of money to buy the MAD library.

I like GPL because it punishes unfair people. You cannot earn your money at the expense of others. So, money for money, honesty for honesty, source code for source code. GPL constrains you to behave fairly. Otristan, have you ever released some of your own valuable source code under BSD license? Will you? Will you let someone to earn his money for your expense? Who or what does prevent you from earning your money?

I will not enter the BSD versus GPL troll.
Sorry man.

Don’t know if you know the price of MAD, but it’s so high that I doubt anyone of us could afford it. That’s why I wrote my own MP3AudioReader with ACM decoding.

Don’t forget also the MP3 license fee that needs to be paid if you have a commercial application (just for using MP3 technology at all, don’t matter if you wrote it or not)…

Regarding MAD, I queried them for a quote half a year ago. No answer. Go figure…

Why don’t you use QuickTime SDK on Mac, WMSDK on Windows?

Those library have capability of decoding MP3 and AAC(QT SDK), WMA(WMSDK). And you can encode audio stream to AAC and WMA. (Note that you can’t encode audio stream to AAC format using QuickTime SDK on Windows because of the licensing issue…)

Of course they can play WAVE and AIFF files too.

You don’t have to specify the data format to decode (play) all those formats to use those API, just pass the file path. You can retrieve decoded PCM stream.

And, both Apple and Microsoft are licensees of MP3 licenser(s).

Best regards,
Masanao Hayashi
Korg Inc.

…and you might want to note the new QuickTimeAudioFormat class I’ve added recently. Doesn’t encode yet, but that can be added.

Yeah, that is nice! In fact, I’ve just found the class name but not used yet.
We made the similar one for our projects before it comes. :wink:

  • Masa

BTW, does anyone know if it is possible to retrieve the BPM ID3 tag of MP3’s via OS API’s like Quicktime? I know that Quicktime has a tagging framework, but I think one can only read and write the “usual” tags like artist, song name, …

Hi,

I had a go on implementing the wmsdk in a little juce app.
I did a test on playback of an wmv file, video only at the moment.
I found an example online here which i converted to a juce app:
http://www.codeproject.com/KB/audio-video/readingWMVASFWMA.aspx
I tested this with version 9.5 of the sdk.

The sdk comes with some sample programs that playback .asf and .wma files. And indeed you can open .mp3’s as well. But the support for this seems to be stated in the documentation though. And in the examples the file dialogs don’t show .mp3 files unless you set the wildcard to ..

The playback of the .mp3 is really quick and takes up almost no cpu, which is nice because the QuickTimeAudioFormat eats it.

Does anyone know if the wmsdk supports seeking, because it seems it doesn’t? I need full control over the stream.

Cheers
Edwin

Hi guys - I wanted to take a look at this MAD reader which would be great. I go to the server for Decodemo.7z and it asks for a password upon decompression in one decompression tool - and ubuntuś archive manager doesnt like it either.

Can you post this again in .zip or something? Or tell me Ive been smoking drugs too long?
Thanks in advance,
Bob

…the file is still there. You can retrieve it by simply clicking the bright red button or the link itself at the top of the web-page. That’s it.

…for 7zip you have to install 7-zip to make your default archive-manager understand .7z extension and unpack files. Go http://www.7-zip.org or check your repository for 7zip or 7z or lzma libraries.

It is a good thing to have an opportunity to post here.