• Post Reply Bookmark Topic Watch Topic
  • New Topic

MP3SPI not working for me?  RSS feed

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

I'm finding it incredibly difficult to implement mp3 support/playback into the software i'm working on. I'm coding the software in IDEA IntelliJ and my software already supports audio playback (16bit). There is code which converts from byte code to shorts (or floats or whatever you want) for processing, then back to byte code for playback.

I was under the impression that if i use MP3SPI, i will simply be able to use the existing code, but if i add it to my classpath (along with jlayer and tritonus_share), it doesn't seem to work. I actually use IntelliJ to import the jars as dependancies for the audio module. That should take care of everything, right?

Currently, if i try to do: "audioInputStream = AudioSystem.getAudioInputStream(file);" on an MP3 file, i get an UnsupportedAudioFileException:

javax.sound.sampled.UnsupportedAudioFileException: could not get audio input stream from input file
at javax.sound.sampled.AudioSystem.getAudioInputStream(AudioSystem.java:1170)
at audio.input.LoadMP3.createAudioInputStream(LoadMP3.java:247)
at audio.input.LoadMP3Panel.init(LoadMP3Panel.java:88)

I was under the impression that if i simply add the 3 jar's to the 'dependencies' for that module in IntelliJ, it should utilize them and allow me to use 'normal' java sound code to read the mp3's... but i guess not? I was using this article as a guide, but documentation in general seems scarce: http://onjava.com/pub/a/onjava/2004/08/11/javasound-mp3.html?page=2

If anyone has any advice on getting mp3 support working, i'd appreciate that. I thought it would be simple - what am i doing wrong? The Javazoom forums are not working so i can't ask there. I have the following files in my lib directory:

- jl1.0.1.jar
- mp3spi1.9.5.jar
- tritonus_share
- tritonus_aos

Thanks,

Eddie
 
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I haven't used MP3SPI, but JMF has an MP3 plugin that works, and which does not require native code. See the OtherOpenSourceProjectsFaq for links to both JMF and the MP3 plugin.
 
Eddie Shakarchi
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:I haven't used MP3SPI, but JMF has an MP3 plugin that works, and which does not require native code. See the OtherOpenSourceProjectsFaq for links to both JMF and the MP3 plugin.


Hi, thanks for the reply!

Am i able to distribute this in a jar with my software, or does it need to be installed on the users machine?

I have tried to use it, but am not getting a lot of success, same as with the MP3SPI. I'm wondering if it's an issue with the dependancies, as i am using Maven. When i set the dependancies in IntelliJ, it doesn't seem to edit the POM.xml file and i need to do it manually.

Still, everything compiles and the jar's are listed as dependancies in the pom.xml, but i still get the javax.sound.sampled.UnsupportedAudioFileException error.

Going crazy here!
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd start by downloading the libraries and putting them into the classpath explicitly, just to make sure it all works. Once that's ascertained you can incorporate it into the Maven build.

I'm fairly certain that JMF does not use the javax.sound.sampled package (JMF predates the JavaSound API), so that exeption would be an indication that you're not using JMF (which has a completely different API than JavaSound).
 
Eddie Shakarchi
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ulf,

I got it working* by finding the files hosted in other repositories and manually modifying the pom.xml file. Then in IntelliJ, i can launch the app with the 'use classpath and JDK of module' for my module!

Longwinded but works for now

* = it's lead to other problems with my understand of JavaSound/MP3 stuff, but i will create another thread about that!

Cheers,

Eddie
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!