Requirements Converting WAV to MP3 Using Tritonus In Java

mp3While MP3 encoding support in Java Sound is nonexistent, you will need 3rd party libraries for doing so. This post will talk about the necessary requirements to convert, say, a WAV file to MP3 format under a Windows environment as the encoding files involved are DLL files. If you are in some other operating system, check the readme files included in the zip files.

A good library to use is Tritonus, which is an implementation of the Java Sound API. You need these two files: tritonus_mp3.jar and tritonus_share.jar which is a shared classes required by all other Tritonus plug-ins. You can add these two files in the JDK and/or JRE’s library extension folder or you can include them in the classpath of your project.

To make use of Tritonus’ libraries to encode to MP3 format, go to their site’s plugin page and download the file under mp3 Encoder. That zip file contains a sample java source code for encoding to MP3 format as well as instructions on where to place the included lametritonus.dll (since it is windows, it should be placed in c:\windows\system32).

The other requirement is equally important, called LAME. It is a high quality MPEG Audio Layer III (MP3) encoder licensed under the LGPL. The DLL for this is responsible for the encodings. Download the LAME package and transfer the DLL file lame_enc.dll to c:\windows\system32.

You can get it in

That is it. You can then check if your conversion from WAV to MP3 works by compiling and running the source file. Keep in mind that those two DLL files are very important so they must both be present.

Related Posts Plugin for WordPress, Blogger...


  1. it works. i just did it this morning. i had been trying to figure out what the problem was because i was sure that my java code is correct.

    then i realized later on after much reading that the DLLs were very important in that they were one of the main factors responsible for the encoding.

  2. yes, you can do that. or better, to avoid having to write it to a wav file, you can save it as a stream and use that same stream to use AudioSystem.write() to convert it to mp3.

    i have not had the chance yet to place the code to convert wav to mp3. may do so next week. check back again.

  3. as far as i know, the licensing involves when you convert and create physical mp3 files. at least that is what my friend told me. as to how licensing works i don’t know how.

    perhaps you’ll just have to be honest in letting them know that you did some conversion? not sure.

Leave a Reply

Your email address will not be published. Required fields are marked *