Music File Conversion
I'm trying to get some code going to convert a given m4a file to mp3 format using java.. I know that Java has some built-in music conversion abilities..but only for really bizarre formats like ogg and midi files..
Does anyone know of any libraries out there that supports music file conversion (specifically mp3)..
This is a small but vital part of a program I'm working on.. and it will take forever to do from scratch. Any help would be GREATLY appreciated. Thanks,
How you also ask Google about this?
Yes, I've done searches on google ... what feels like hundreds; I've spent hours and hours trying to find a way, which is why I'm here.
I'm not 100% sure, but there is two utilities for Linux called lame and faad. There is no a direct/one utility to do this conversion. Using those two it is possible.
Google it. May be the spellings of words can be wrong, if so really sorry about that.
Hi there, thanks for the reply.
I've checked it out, and while this is the type of thing I'm looking for, it's source files are all C, and I need to use this code in an applet, so it needs to be Java.
I think this might end up with me having to look through the byte patterns of audio files, argh. Does anyone reckon that's possible with Java... just to work out how the bytes and headers are formed in one type of file, and use plain Java to create a new file of the correct format?
I'm a novice in the area of conversion.. but that's the only way (albeit incredibly time-consuming and far from ideal) I can see around it!
Any tips or ideas are greatly appreciated, thanks.
You can use read() method of the InputStream to read a single byte. But I haven't done such a thing before and I don't know how difficult it is.
It's a tricky one..
I don't suppose there's any way to run C code from a java applet? So that I could use faad and lame? I can't BELIEVE there isn't a java library to do this out there somewhere.. I can't be the first one to want to use java for this reason.
I wouldn't mind creating it from scratch if I had to; it's just impossible to find information about the exact layout of mp3/m4a files.. i.e. right down to which byte shows what in terms of header info etc.
I've never had a situation where I couldn't find a solution to a programming problem, no matter how hard I tried... and I'm determined not to let that happen!
Yes, you are not the first person wants to do this. I heard about few people done this before and all of them are used faad and lame mechanism. It can tricky too, if so why are you worried about that. Even using a tricky way you can make your success. I have work out on large number of tricky events in my life.
I wasn't saying using faad and lame was tricky - that looks simple, only requires a couple of lines of code.. though its source is in C, so don't think there's a way to do this.
What's tricky is getting the very highest technical detail about these files, going laboriously through the byte sequences manually, working out all the crazy header information, etc.. for two sets of file types.. it's a lot of work, for something I would have hoped had already been worked out by an ardent music lover somewhere out there in the java community.
Will that person have to be me? I hope not.
Yes, as you said working in byte level is not a good choice, because you have to do lots of works.
Are you sure that faad-lame is in C, because my friend says that his application design to work for Linux. Better to check it again me too :)
Hey hey, I think I've hit the jackpot:
LAMEOnJ - The LAME symmetric Java MP3 encoder API
Looks like there's a java api for Lame (which is written in C)... this is just what I was looking for! I only managed to find it after I began researching the indepth mechanics of mp3 file structure.
I'll let you know if I get anywhere with this, Thanks.
That's good, you found the way at the end. Try and see :)