Search code examples
javamp3jlayer

jLayer -- Playing mp3 causes distortion at start of file


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?


Solution

  • 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.