MP3
Article Index
MP3
Processing, licencing and beyond

 


Banner

Processing

The exact details of MP3 coding are complicated but a rough outline of what happens is:

  • First the digitised signal is filtered into 32 different frequency ranges or bands (using a Fourier Transform).
  • The psychoacoustic model then determines the masking thresholds for each band. This sounds complicated but all that happens is that each band is rated according to how loud it is compared to the bands next door and whether or not it is more or less like a pure tone or noise.
  • Finally each band is coded using just the number of bits needed according to how sensitive the human ear is to the frequency range, how loud the band is and how masked it is by neighbouring bands.

As you might guess the processing needed to implement this is quite a lot but the good news is that while MP3 encoding takes a long time MP3 decoding is quite quick and doesn’t need a powerful processor.This is lucky because without this property there would be no portable MP3 players!

Good MP3 compression can achieve results that are 10 or 12 times smaller than the original file with no perceptible loss of quality, i.e. it converts the 1.4Mbits you need for one second of CD quality stereo music to around 100Kbits. Of course this reduction is achieved by throwing away some of the music but the argument is that you can’t hear it anyway.

Some would disagree however!

Of course it is important to realise that MP3 is designed to work best for music and how well it works depends a lot on the suitability of the acoustic masking principle to the sound source. For example there are much better compression algorithms than MP3 for speech, which doesn’t benefit much from the masking effect. Many are also of the opinion that there are better compression methods for music but MP3 has the advantage of being widely used.

Even so some audio enthusiasts insist on using lossless compression. Currently the most used lossless compression formats are FLAC which is open source and licence free and Apple;s Apple Lossless format. Of course there are some audio enthusiasts that reject digital sound, compressed or uncompressed, completely.

The licensing problem

You might well think that the only real legal problems with MP3 are the lawsuits aimed at stopping people swapping music for free but there is another side to the story.

As an end user MP3 appears to be free but there are some hidden costs. The MP3 standard was ratified by the ISO and some source code, “the reference source code”, was issued to let programmers see exactly how to implement MP3. The source code is free to download – but don’t compile it or you will trigger a patent and have to pay a royalty!

The point is that the Fraunhofer Institute did most of the development work on MP3 and it has patents on some of the key technologies, even though they are part of the ISO standard.

Under these patents the Fraunhofer Institute (in co-operation with Thompson) says that you can look at the ISO source code but you can’t compile it and you can’t distribute binaries that result from compiling it. You can use it to develop your own decoders and give these away but if you charge for the decoders, hardware or software, you have to pay $0.75 per sale In the case of encoders the charge is $2.5 to $5 per encoder distributed, irrespective of whether you give it away or charge for it. Finally, if listeners have to pay for music in MP3 format then the royalty is 2% per sale.

So as you can see MP3 isn’t free and this is the reason that Microsoft doesn’t include an MP3 decoder with every copy of the Media Player up to version 9 even though a decoder is available. Version 10 and higher include an official Fraunhofer decoder.

If you want to create an MP3 player and give it away then you could do it without a licence, subject to a few conditions, but you have always needed a licence to even give away an encoder. However this doesn’t stop many programmers giving away MP3 encoders/decoders as freeware – presumably they just go unnoticed.

There are lots of free MP3 encoders. Just do a web search and you will find ten or twenty. The best known is LAME, lame.sourceforge.net, which is an open source MP3 encoder. (See our project .NET MP3 for details of how to run the LAME encoder under the control of .NET.) If you want a plug-in for the Windows Media player 9, however, the cost is around $9.00.

The patent situation is so complicated that it is difficult to even predict when all of the significant patents will expire but it is estimated that MP3 could be patent free by 2012.

Beyond MP3

There are a number of alternatives to MP3, which is now considered an old technology. Microsoft offers its alternative WMA, Windows Media Audio, as part of the Media player and you can save files in this format. In response MP3 was upgraded to MP3Pro, which gives a 2x improvement on MP3 compression ratios – with the huge advantage of backward and forward compatibility. You can play an MP3Pro file on an MP3 player and vice versa. Of course, you don’t get the benefits of MP3Pro unless you use an MP3Pro player but at least it works.

There is also the strangely named Ogg Vorbis (www.vorbis.com). This is an open source audio compressor that has no royalty or licensing problems at all.  It is also supposed to be better than MP3, MP3Pro or WMA for the same sort of compression ratios. Given its licence conditions, or rather lack of them, you would think that the music industry would be falling over itself to make use of it. Not so because the Ogg Vorbis has no rights control which stops people from copying music Napster style. However, WMA does and this, or something like it, is more attractive to the music industry, which seems to worry more about pirating than licensing.

 

If you would like to be informed about new articles on I Programmer you can either follow us on Twitter, on Facebook , on Digg or you can subscribe to our weekly newsletter.

Banner


XOR - The Magic Swap

We all know that if you want to swap the contents of two variables you need a third temporary variable to do the job - but it can be done with just two with the magic XOR swap.



Inside Random Numbers

We often refer to things that are unpredictable as being "random" but this is not the same as truly random behavior - which is something we have to work hard to achieve. Put another way - how can a lo [ ... ]


Other Articles

<ASIN:3642116116>

<ASIN:1598633015>

<ASIN:026203378X>

<ASIN:0240810740>

<ASIN:1568811683>

<ASIN:1578200830>

<ASIN:0130226165>

<ASIN:0470525673>

<ASIN:0470170956>



 
 

   
RSS feed of all content
I Programmer - full contents
Copyright © 2014 i-programmer.info. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.