Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / January 2006

Tip: Looking for answers? Try searching our database.

MP3 playback using Java Sound and Sun MP3 plugin

Thread view: 
Daniel Dyer - 21 Jan 2006 21:30 GMT
I downloaded Sun's plugin for MP3 support  
(http://java.sun.com/products/java-media/jmf/mp3/download.html).  The  
website seems to suggest that it will work with the Java Sound APIs  
without any need to install the Java Media Framework.  However, I can only  
get it to work with the Java Sound classes when the JMF is also installed  
(I've tried on Windows and Linux).

Has anybody managed to get it to work without installing the JMF?

I'm aware that I can use the MP3SPI/JLayer libs from JavaZoom, but I'd  
like to get it working with Sun's stuff if possible (performance and  
licensing being the main reasons).  Does anyone know of any other pure  
Java MP3 player libraries?

Thanks,

Dan.

Signature

Daniel Dyer
http://www.dandyer.co.uk

Daniel Dyer - 21 Jan 2006 21:59 GMT
> I downloaded Sun's plugin for MP3 support  
> (http://java.sun.com/products/java-media/jmf/mp3/download.html).  The  
[quoted text clipped - 4 lines]
>
> Has anybody managed to get it to work without installing the JMF?

I should probably specify the error I'm seeing.  I get the following  
exception when I call the getAudioInputStream method of the  
javax.sound.sampled.AudioSystem class and pass it an MP3 file:

javax.sound.sampled.UnsupportedAudioFileException: could not get audio  
input stream from input file
    at  
javax.sound.sampled.AudioSystem.getAudioInputStream(AudioSystem.java:1170)

Dan.

Signature

Daniel Dyer
http://www.dandyer.co.uk

Roedy Green - 21 Jan 2006 22:56 GMT
On Sat, 21 Jan 2006 21:30:57 -0000, "Daniel Dyer"
<dan@dannospamformepleasedyer.co.uk> wrote, quoted or indirectly
quoted someone who said :

>Has anybody managed to get it to work without installing the JMF?

It is part of JMF, just a Johnny come lately part as I understand it.

See http://mindprod.com/jgloss/jmf.html
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Daniel Dyer - 21 Jan 2006 23:15 GMT
> On Sat, 21 Jan 2006 21:30:57 -0000, "Daniel Dyer"
> <dan@dannospamformepleasedyer.co.uk> wrote, quoted or indirectly
[quoted text clipped - 5 lines]
>
> See http://mindprod.com/jgloss/jmf.html

The download page says:

"The included jar file (mp3plugin.jar) contains a Java Sound plugin as  
well as a Java Media Framework plugin for playing MPEG-2 Layer 3 Audio."

...and then goes on to describe two installation steps, one to get it to  
work with Java Sound and an additional step to get it to work with the  
JMF.  I'm not using any of the JMF classes directly, I'm just using  
javax.sound.sampled.* rather than javax.media.*, but it only seems to work  
if the JMF is installed.  I would expect a ClassDefNotFoundError or  
similar, rather than the UnsupportedAudioFileException that I am getting,  
if it was reliant on the JMF classes.

Dan.

Signature

Daniel Dyer
http://www.dandyer.co.uk

Knute Johnson - 22 Jan 2006 02:10 GMT
>> On Sat, 21 Jan 2006 21:30:57 -0000, "Daniel Dyer"
>> <dan@dannospamformepleasedyer.co.uk> wrote, quoted or indirectly
[quoted text clipped - 21 lines]
>
> Dan.

Daniel:

I ran into the same problems that you have seen.  The MP3 plugin will
work with JavaSound but it only works with certain format MP3 files.
Apparently (and I am not that knowledgable in this area) there are many
different types of MP3 files.  JMF will apparently play more different
file types.

There is a really good JavaSound email list

http://java.sun.com/products/java-media/sound/list.html

and you should look into Tritonus.  These fellows have written some
really handy things, MP3 too, for JavaSound.

www.tritonus.org

One of the guys on the list was the Sun guy for JavaSound for a couple
of years and is really knowledgable and very helpful.

Signature

Knute Johnson
email s/nospam/knute/

Daniel Dyer - 22 Jan 2006 11:55 GMT
> I ran into the same problems that you have seen.  The MP3 plugin will  
> work with JavaSound but it only works with certain format MP3 files.  
[quoted text clipped - 5 lines]
>
> http://java.sun.com/products/java-media/sound/list.html

Thanks, I will take a look.

> and you should look into Tritonus.  These fellows have written some  
> really handy things, MP3 too, for JavaSound.
>
> www.tritonus.org

I was looking at the Tritonus stuff, but I wasn't sure exactly what it  
was.  It seems to be a pure Java implementation of Java Sound that was  
written primarily for Linux.  Is that correct?

I know the MP3SPI library uses it.  I hacked around in the source code to  
try and remove the dependency and see if MP3SPI would work just using the  
base Java Sound classes, but I didn't get it to work properly.

There's no reason why I can't use Tritonus (or why I can't install JMF), I  
just thought it should be possible to play MP3s without either.

Thanks,

Dan.

Signature

Daniel Dyer
http://www.dandyer.co.uk

Knute Johnson - 22 Jan 2006 17:43 GMT
> I was looking at the Tritonus stuff, but I wasn't sure exactly what it  
> was.  It seems to be a pure Java implementation of Java Sound that was  
> written primarily for Linux.  Is that correct?

I think you are right, they are primarily Linux guys, but Tritonus will
run just fine on any Java system.

> I know the MP3SPI library uses it.  I hacked around in the source code
> to  try and remove the dependency and see if MP3SPI would work just
> using the  base Java Sound classes, but I didn't get it to work properly.
>
> There's no reason why I can't use Tritonus (or why I can't install JMF),
> I  just thought it should be possible to play MP3s without either.

The nice thing about the Tritonus is that it is just a couple of JAR
files any you are ready to go.  Ask around on the JAVASOUND mailling
list, I'm sure they can get you running with the plugin.  I just didn't
get where I was going with it and moved on to something else.  I'm sure
it will work.

Signature

Knute Johnson
email s/nospam/knute/



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.