I'm trying to develop a java application for the raspberry pi that will play mp3
s.
I wrote a simple program to see if it would work using JLayer
Code for the app is like this:
public static void main(String[] args) {
Player player = null;
try {
FileInputStream fis = new FileInputStream("song.mp3");
BufferedInputStream bis = new BufferedInputStream(fis);
player = new Player(bis);
} catch (Exception e) {
System.out.println(e.getMessage());
}
try {
player.play();
} catch (JavaLayerException e) {
System.out.println(e.getMessage());
}
}
The program runs on windows but on the pi when creating the new player object I am getting the exception:
Cannot create AudioDevice
Has anyone been able to get JLayer working on the pi?
I'm using the latest Soft-float Debian “wheezy” image with the Orcale JVM.
printStackTrace()
as it gives a lot more information thangetMessage()
when it comes to debugging. I've just tried the above and I get the same error (openjdk6). I changed it to printStackTrace() and I get:java.lang.IllegalArgumentException: No line matching interface SourceDataLine supporting format PCM_SIGNED 22050.0 Hz, 16 bit, mono, 2 bytes/frame, little-endian is supported.
Not sure how to fix this though. – Munkeh Oct 28 '12 at 23:00