JLayer, Java MP3 decoder

For a hobby project, I wanted to play and analyze MP3 files from a Java program. It turns out that’s not as easy as you might think. Probably due to licensing issues MP3 playback is not included with the standard Java development kit. Luckily there are some great people at JZoom (formerly JavaZoom) have created an open source library to help out: JLayer (formerly JavaLayer).

The documentation is minimal, but who needs it when programming a Java MP3 player is as simple as:

1
new Player(new FileInputStream(args[0])).play();

The code itself is also very legible, which is nice if you plan to mess with it. And they have a few add-ons. The one you will want is the JavaSound standard library. Using MP3 SPI, JLayer integrates perfectly with JavaSound, so you don’t actually need to learn any new APIs if you already know JavaSound.

Image credit.

This entry was posted in Java and JavaScript. Bookmark the permalink. Both comments and trackbacks are currently closed.

One Comment

  1. Twaneu
    Posted January 25, 2011 at 12:11 am | Permalink

    Thank you guy, i’m looking for that information for like one hour…

  • Feedback or questions? Contact me right away.

    Comments have been disabled on my posts. Not because I don't want to hear from you, but because they were adding very little to the conversation (most of them were spam anyway). I do listen to you and try to keep as much posts as possible up-to-date and error free. So if you have a question, if something isn't working the way you hoped or you have general feedback, please use the contact form below. I guarantee an answer to every honest question or remark.
  • Get in touch
    1. (required)
    2. (valid email required)
     

    cforms contact form by delicious:days