views:

525

answers:

2

I am looking for a java library to efficently/fast transcodig and manipulation mp3 files. I am working on a sophisticated streaming server that mixes music and has some other functions to allow to users to interact with each other. A recommendation functonallity for example should fade over the stream of the sending user to the reciever of the recommendation.

All the fuctionallity is implemented right now and works well using UPnP-AV devices. The next step would be not to simply switch the tracks like I do it now. It should be a smooth fade between songs.

Any suggestions on that? Mayby java is not the right solution to work with sound. If you know a better way to do transcoding and manipuation of audio let me know.

(Transcoding is needed because not all audio sources are available as mp3 but internally I do work only with MP3)

+1  A: 

One of the best MP3 encoders out there is LAME. There is an API wrapper for Java called LAMEOnJ, but it requires a JNIEasy license, the free version of which has to be redownloaded every 5 days. Frankly, I don't know why you'd want to work with MP3 internally as opposed to WAV files; it's probably going to be more work. Plus, there's the patent thing.

All around, you're probably better off working with the Java Sound API. There's a good open source package out there called Tritonus. Tritonus only supports the full API (specifically, sound output) on Linux, but they have some useful plugins that work on any platform (including an MP3 encoder, the quality of which I can't speak to).

Pesto
Using mp3 is only the first step. I would like to support a wide range of audio sources and all mayor formats for streaming. Maybe it would be better to use wav internally and convert all media into this format before I process data.
Timo
But then I have to transcode again when the data is streamed to a client. I would like to use MP3 for this because of its wide adoption. Is it possible to do this transcoding fast? And parallel to the processing so that the first read bytes are streamed before the whole file is converted?
Timo
I'm only advocating not doing your mixing in MP3 format. It's easier to do this in WAV and convert it on the fly for output. You can output in any format your heart desires; transcoding is significantly faster than playback speed, and you should be mixing far enough ahead to have a good buffer.
Pesto
+1  A: 

Or use Xuggler to decode or encode MP3 files. It uses LAME under the covers, is open-source (LGPL) and free, and runs on Mac, Windows and Linux.

Xuggle