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

2012/4/9

Sound error

SPower SPower

2012/4/9

#
Hi all, I created a GreenfootSound variable (called alarm), and I let it play using alarm.play(). But when I run Greenfoot, I get this error: Exception in thread "SoundStream:file:/E:/Gebruikers/Sven/Mijn%20Documenten/Greenfoot/Jump!/sounds/alarmSound.mp3" java.lang.ArrayIndexOutOfBoundsException: 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.lang.Thread.run(Thread.java:662) I don't know what I did wrong, can anyone please help me? Thanks.
K_O_P K_O_P

2012/4/9

#
Could you post the code? Without it, we can't see, where your mistake might be.
SPower SPower

2012/4/9

#
This is the code for the sound:
private GreenfootSound alarm = new GreenfootSound("alarmSound.mp3");

public void act()
{
alarm.play();
}
davmac davmac

2012/4/9

#
Does the sound file have id3 tags? - they can cause a problem with the library used by Greenfoot to play mp3s.
SPower SPower

2012/4/10

#
I used another sound file (also mp3) and that one does work, using the exact same code. I think the previous file was wrong (I don't know why, but probably there was something wrong).
Builderboy2005 Builderboy2005

2012/4/10

#
The id3 tags don't always cause an error, but perhaps there was a strange clicking noise at the very end of the sound? Also, does the error occur after the sound is finished or directly when it starts? What did you use to generate the mp3 files?
DSP512 DSP512

2014/1/24

#
I got the same error message and it occurs when the sound playback is already finished
Pointifix Pointifix

2014/2/23

#
i got the same error today, only at one sound, all other are working fine, thats shit ;D
You need to login to post a reply.