2

I'm using jLayer 1.0 to play a simple mp3 file. It works fine apart from the first 3 seconds or so (adding 5 seconds of silence to the start of the track fixes the issue). This is the code I'm using:

try 
{

    final Player player = new Player(getClass().getResourceAsStream("1.mp3"));
    new Thread() 
    {
        public void run() 
        {
            try 
            { 
                player.play(); 
            }
            catch (Exception e) { System.out.println(e); }
         }
     }.start();
}
catch (Exception e) 
{
    System.out.println("Something went wrong!");
    System.out.println(e);
}

I'm probably doing something stupid (I'm pretty sure I don't need to put the thread in the try block anyway) but it does play apart from the distortion.

Audio sample of distortion: http://www.filedropper.com/broken Original track: http://www.filedropper.com/dennyschneidemessermodernwarstory

Music by: denny schneidemesser (by-nc-nd)

Any idea of what is is going on?

user1735972
  • 103
  • 1
  • 7
  • Is using another Player an option? Because the only player I used so far which causes no trouble at all,especially when different file typse such as .ogg, etc. have to be supported, is [VLCJ](http://www.capricasoftware.co.uk/vlcj/). The [VLC](http://www.videolan.org/vlc/index.html) player has to be installed and in Windows you have to add something to the PATH system variable but apart from this constraints it always worked perfectly. – rob Oct 10 '12 at 22:34
  • @rob Unfortunately due to where this code is expected to run, I can't guarantee VLC will be installed. I will try another library though – user1735972 Oct 11 '12 at 16:21

1 Answers1

1

Issue completely fixed after updating to v1.0.1.

The version hosted on this page: http://introcs.cs.princeton.edu/java/faq/mp3/mp3.html

Is outdated.

user1735972
  • 103
  • 1
  • 7