tags:

views:

197

answers:

3

Apparently Java only plays .au audio files and I want to play mp3 files. I want to convert them to au and do not want to use any third party library to play mp3 directly. Can you please let me know how I can prepare my mp3 files to be able to play them in Java. (specifically I'd like to convert mp3 files to au files with a freeware software but don't know any software that is capable of doing that)

+2  A: 

Is your target platform Windows only? If so you might want to investigate JMF.

Otherwise, there's a nice guide here on extending JavaSound to play MP3s using MP3 SPI.

Overall, I'm finding your question is confusing. The act of decoding a MP3 file is to convert it to raw audio. Once done there is little point in then converting it again to the AU and then using the native Java API to play it - you might as well just play it straight after it's decoded into raw audio. Furthermore, if as your question implies you don't want to use third-party libraries at all, then you'll need to write your own MP3 decoder.

Catchwa
Maybe he's trying to avoid licence costs from redistributing an mp3 decoder?
wds
+1  A: 

Audacity can convert MP3 files to AU

mhaller
Do I need to install any plug in on Audacity?
Mark
No. Go to Edit > Settings > File formats > Uncompressed Export Format > Choose "AU". Then go to File > Export As AU
mhaller
+1  A: 

With sox I believe it's as simple as:

sox input.mp3 output.au
wds
Thanks a lot sox seems to be very powerful
Mark