简体   繁体   English

jLayer —播放mp3会在文件开始时导致失真

[英]jLayer — Playing mp3 causes distortion at start of file

I'm using jLayer 1.0 to play a simple mp3 file. 我正在使用jLayer 1.0播放简单的mp3文件。 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). 除了前3秒钟左右,它的工作情况还不错(在曲目开头增加5秒钟的静默可以解决此问题)。 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. 我可能正在做一些愚蠢的事情(我很确定我无论如何都不需要将线程放入try块中),但它确实可以消除失真。

Audio sample of distortion: http://www.filedropper.com/broken Original track: http://www.filedropper.com/dennyschneidemessermodernwarstory 失真的音频样本: http : //www.filedropper.com/broken原始音轨: http : //www.filedropper.com/dennyschneidemessermodernwarstory

Music by: denny schneidemesser (by-nc-nd) 音乐作者:Denny schneidemesser(BY-NC-ND)

Any idea of what is is going on? 知道发生了什么吗?

Issue completely fixed after updating to v1.0.1. 更新到v1.0.1后,此问题已完全修复。

The version hosted on this page: http://introcs.cs.princeton.edu/java/faq/mp3/mp3.html 此页面上托管的版本: http : //introcs.cs.princeton.edu/java/faq/mp3/mp3.html

Is outdated. 已经过时了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM