This site requires JavaScript, please enable it in your browser!
Greenfoot back
XApple15
XApple15 wrote ...

2021/2/17

I get an weird error

XApple15 XApple15

2021/2/17

#
When i run the scenario, somethimes i get this weird error :
1
2
3
4
5
6
7
8
Exception in thread "SoundStream:file:/C:/Users/ursug/Documents/GitHub/PrisonBreak/PrisonBreak/sounds/jail.mp3" java.lang.IllegalArgumentException: Could not open sound file: file:/C:/Users/ursug/Documents/GitHub/PrisonBreak/PrisonBreak/sounds/jail.mp3
    at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
    at greenfoot.sound.SoundStream.run(SoundStream.java:374)
    at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.io.IOException: javazoom.jl.decoder.BitstreamException: Bitstream errorcode 102
    at greenfoot.sound.Mp3AudioInputStream.read(Mp3AudioInputStream.java:251)
    at greenfoot.sound.SoundStream.run(SoundStream.java:302)
    ... 1 more
This is the code in that scenario :
1
2
3
4
5
6
7
8
9
10
11
12
public static GreenfootSound soundtrack = new GreenfootSound("jail.mp3");
    private boolean musicStart = false;
    public MainMenu()
    {   
        super(1200, 700, 1);
        prepare();
    }
 
    public void act()
    {
        MusicStart();
    }
1
2
3
4
5
6
7
8
9
public void MusicStart()
    {
        if(musicStart == false)
        {
            soundtrack.playLoop();
            soundtrack.setVolume(100);
            musicStart = true;
        }
    }
danpost danpost

2021/2/17

#
It appears that you either have metadata included in the sound file or the file is corrupted. It may possibly something else, but the first is more likely. See if you can rewrite the file without the file information.
danpost danpost

2021/2/17

#
Another thing you might try is assigning the file in MusicStart:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
public static GreenfootSound soundtrack;
 
public MainMenu()
{
    super(1200, 700, 1);
    prepare();
}
 
public void act()
{
    musicStart();
}
 
public void musicStart()
{
    if (soundtrack == null)
    {
        soundtrack = new GreenfootSound("jail.mp3")
        soundtrack.setVolume(100);
    }
    soundtrack.playLoop();
}
XApple15 XApple15

2021/2/22

#
I get this one also
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Exception in thread "SoundStream:file:/C:/Users/ursug/Documents/GitHub/PrisonBreak/PrisonBreak/sounds/Soundtrack2.mp3" Exception in thread "SoundStream:file:/C:/Users/ursug/Documents/GitHub/PrisonBreak/PrisonBreak/sounds/Soundtrack2.mp3" java.lang.ArrayIndexOutOfBoundsException: Index 2304 out of bounds for length 2304
    at javazoom.jl.decoder.SampleBuffer.appendSamples(SampleBuffer.java:96)
    at javazoom.jl.decoder.SynthesisFilter.compute_pcm_samples(SynthesisFilter.java:1510)
    at javazoom.jl.decoder.SynthesisFilter.calculate_pcm_samples(SynthesisFilter.java:1550)
    at javazoom.jl.decoder.LayerIIIDecoder.decode(LayerIIIDecoder.java:313)
    at javazoom.jl.decoder.LayerIIIDecoder.decodeFrame(LayerIIIDecoder.java:219)
    at javazoom.jl.decoder.Decoder.decodeFrame(Decoder.java:147)
    at greenfoot.sound.Mp3AudioInputStream.read(Mp3AudioInputStream.java:230)
    at greenfoot.sound.SoundStream.run(SoundStream.java:255)
    at java.base/java.lang.Thread.run(Thread.java:834)
java.lang.ArrayIndexOutOfBoundsException: Index 2304 out of bounds for length 2304
    at javazoom.jl.decoder.SampleBuffer.appendSamples(SampleBuffer.java:96)
    at javazoom.jl.decoder.SynthesisFilter.compute_pcm_samples(SynthesisFilter.java:1510)
    at javazoom.jl.decoder.SynthesisFilter.calculate_pcm_samples(SynthesisFilter.java:1550)
    at javazoom.jl.decoder.LayerIIIDecoder.decode(LayerIIIDecoder.java:313)
    at javazoom.jl.decoder.LayerIIIDecoder.decodeFrame(LayerIIIDecoder.java:219)
    at javazoom.jl.decoder.Decoder.decodeFrame(Decoder.java:147)
    at greenfoot.sound.Mp3AudioInputStream.read(Mp3AudioInputStream.java:230)
    at greenfoot.sound.SoundStream.run(SoundStream.java:255)
    at java.base/java.lang.Thread.run(Thread.java:834)
XApple15 XApple15

2021/2/22

#
I`ve tried your code, but sometimes , like once 5 compiles i get this error while the game is running. Is it possible to be the Greenfoot Decoder who`s faulty?
1
2
3
4
5
6
7
8
Exception in thread "SoundStream:file:/C:/Users/ursug/Documents/GitHub/PrisonBreak/PrisonBreak/sounds/Soundtrack2.mp3" java.lang.ArrayIndexOutOfBoundsException: Index 580 out of bounds for length 580
    at javazoom.jl.decoder.LayerIIIDecoder.huffman_decode(LayerIIIDecoder.java:795)
    at javazoom.jl.decoder.LayerIIIDecoder.decode(LayerIIIDecoder.java:278)
    at javazoom.jl.decoder.LayerIIIDecoder.decodeFrame(LayerIIIDecoder.java:219)
    at javazoom.jl.decoder.Decoder.decodeFrame(Decoder.java:147)
    at greenfoot.sound.Mp3AudioInputStream.read(Mp3AudioInputStream.java:230)
    at greenfoot.sound.SoundStream.run(SoundStream.java:302)
    at java.base/java.lang.Thread.run(Thread.java:834)
And this one
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Exception in thread "SoundStream:file:/C:/Users/ursug/Documents/GitHub/PrisonBreak/PrisonBreak/sounds/Soundtrack2.mp3" Exception in thread "SoundStream:file:/C:/Users/ursug/Documents/GitHub/PrisonBreak/PrisonBreak/sounds/Soundtrack2.mp3" java.lang.ArrayIndexOutOfBoundsException: Index 2304 out of bounds for length 2304
    at javazoom.jl.decoder.SampleBuffer.appendSamples(SampleBuffer.java:96)
    at javazoom.jl.decoder.SynthesisFilter.compute_pcm_samples(SynthesisFilter.java:1510)
    at javazoom.jl.decoder.SynthesisFilter.calculate_pcm_samples(SynthesisFilter.java:1550)
    at javazoom.jl.decoder.LayerIIIDecoder.decode(LayerIIIDecoder.java:313)
    at javazoom.jl.decoder.LayerIIIDecoder.decodeFrame(LayerIIIDecoder.java:219)
    at javazoom.jl.decoder.Decoder.decodeFrame(Decoder.java:147)
    at greenfoot.sound.Mp3AudioInputStream.read(Mp3AudioInputStream.java:230)
    at greenfoot.sound.SoundStream.run(SoundStream.java:255)
    at java.base/java.lang.Thread.run(Thread.java:834)
java.lang.ArrayIndexOutOfBoundsException: Index 2304 out of bounds for length 2304
    at javazoom.jl.decoder.SampleBuffer.appendSamples(SampleBuffer.java:96)
    at javazoom.jl.decoder.SynthesisFilter.compute_pcm_samples(SynthesisFilter.java:1510)
    at javazoom.jl.decoder.SynthesisFilter.calculate_pcm_samples(SynthesisFilter.java:1550)
    at javazoom.jl.decoder.LayerIIIDecoder.decode(LayerIIIDecoder.java:313)
    at javazoom.jl.decoder.LayerIIIDecoder.decodeFrame(LayerIIIDecoder.java:219)
    at javazoom.jl.decoder.Decoder.decodeFrame(Decoder.java:147)
    at greenfoot.sound.Mp3AudioInputStream.read(Mp3AudioInputStream.java:230)
    at greenfoot.sound.SoundStream.run(SoundStream.java:255)
    at java.base/java.lang.Thread.run(Thread.java:834)
danpost danpost

2021/2/22

#
Those kind of errors are usually caused by having information blocks embedded in the files. Try re-saving the files w/o the information.
You need to login to post a reply.