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

2014/4/22

making sound

nona nona

2014/4/22

#
i want my bug to make sound when it eats leaf i used
if (canSee(leaf.class))
        {
            eat(leaf.class);
              Greenfoot.playSound("slurp.wav");
        }
       
but it doesn't work instead my program start to stop every time bug eats leaf what is the problem ?
lordhershey lordhershey

2014/4/22

#
Is there a window popping up with a bunch of error messages in it? If so can you post it here?
nona nona

2014/4/22

#
lordhershey wrote...
Is there a window popping up with a bunch of error messages in it? If so can you post it here?
unfortunately i can't upload the image but yes there is a window titled with "greenfoot terminal window saying this :
java.lang.IllegalArgumentException: Could not open sound file: slurp.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at bug.act(bug.java:30)
	at greenfoot.core.Simulation.actActor(Simulation.java:568)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:526)
	at greenfoot.core.Simulation.runContent(Simulation.java:215)
	at greenfoot.core.Simulation.run(Simulation.java:205)
Caused by: java.io.FileNotFoundException: Could not find file: slurp.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:537)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 6 more
java.lang.IllegalArgumentException: Could not open sound file: slurp.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at bug.act(bug.java:30)
	at greenfoot.core.Simulation.actActor(Simulation.java:568)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:526)
	at greenfoot.core.Simulation.runContent(Simulation.java:215)
	at greenfoot.core.Simulation.run(Simulation.java:205)
Caused by: java.io.FileNotFoundException: Could not find file: slurp.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:537)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 6 more
java.lang.IllegalArgumentException: Could not open sound file: slurp.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at bug.act(bug.java:30)
	at greenfoot.core.Simulation.actActor(Simulation.java:568)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:526)
	at greenfoot.core.Simulation.runContent(Simulation.java:215)
	at greenfoot.core.Simulation.run(Simulation.java:205)
Caused by: java.io.FileNotFoundException: Could not find file: slurp.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:537)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 6 more
java.lang.IllegalArgumentException: Could not open sound file: slurp.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at bug.act(bug.java:30)
	at greenfoot.core.Simulation.actActor(Simulation.java:568)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:526)
	at greenfoot.core.Simulation.runContent(Simulation.java:215)
	at greenfoot.core.Simulation.run(Simulation.java:205)
Caused by: java.io.FileNotFoundException: Could not find file: slurp.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:537)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 6 more
java.lang.IllegalArgumentException: Could not open sound file: slurp.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at bug.act(bug.java:30)
	at greenfoot.core.Simulation.actActor(Simulation.java:568)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:526)
	at greenfoot.core.Simulation.runContent(Simulation.java:215)
	at greenfoot.core.Simulation.run(Simulation.java:205)
Caused by: java.io.FileNotFoundException: Could not find file: slurp.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:537)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 6 more
java.lang.IllegalArgumentException: Could not open sound file: slurp.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at bug.act(bug.java:30)
	at greenfoot.core.Simulation.actActor(Simulation.java:568)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:526)
	at greenfoot.core.Simulation.runContent(Simulation.java:215)
	at greenfoot.core.Simulation.run(Simulation.java:205)
Caused by: java.io.FileNotFoundException: Could not find file: slurp.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:537)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 6 more
java.lang.IllegalArgumentException: Could not open sound file: slurp.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at bug.act(bug.java:30)
	at greenfoot.core.Simulation.actActor(Simulation.java:568)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:526)
	at greenfoot.core.Simulation.runContent(Simulation.java:215)
	at greenfoot.core.Simulation.run(Simulation.java:205)
Caused by: java.io.FileNotFoundException: Could not find file: slurp.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:537)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 6 more
java.lang.IllegalArgumentException: Could not open sound file: slurp.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at bug.act(bug.java:30)
	at greenfoot.core.Simulation.actActor(Simulation.java:568)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:526)
	at greenfoot.core.Simulation.runContent(Simulation.java:215)
	at greenfoot.core.Simulation.run(Simulation.java:205)
Caused by: java.io.FileNotFoundException: Could not find file: slurp.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:537)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 6 more
java.lang.IllegalArgumentException: Could not open sound file: slurp.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at bug.act(bug.java:30)
	at greenfoot.core.Simulation.actActor(Simulation.java:568)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:526)
	at greenfoot.core.Simulation.runContent(Simulation.java:215)
	at greenfoot.core.Simulation.run(Simulation.java:205)
Caused by: java.io.FileNotFoundException: Could not find file: slurp.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:537)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 6 more
java.lang.IllegalArgumentException: Could not open sound file: slurp.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at bug.act(bug.java:30)
	at greenfoot.core.Simulation.actActor(Simulation.java:568)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:526)
	at greenfoot.core.Simulation.runContent(Simulation.java:215)
	at greenfoot.core.Simulation.run(Simulation.java:205)
Caused by: java.io.FileNotFoundException: Could not find file: slurp.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:537)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 6 more
java.lang.IllegalArgumentException: Could not open sound file: slurp.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at bug.act(bug.java:30)
	at greenfoot.core.Simulation.actActor(Simulation.java:568)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:526)
	at greenfoot.core.Simulation.runContent(Simulation.java:215)
	at greenfoot.core.Simulation.run(Simulation.java:205)
Caused by: java.io.FileNotFoundException: Could not find file: slurp.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:537)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 6 more
java.lang.IllegalArgumentException: Could not open sound file: slurp.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at bug.act(bug.java:30)
	at greenfoot.core.Simulation.actActor(Simulation.java:568)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:526)
	at greenfoot.core.Simulation.runContent(Simulation.java:215)
	at greenfoot.core.Simulation.run(Simulation.java:205)
Caused by: java.io.FileNotFoundException: Could not find file: slurp.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:537)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 6 more
java.lang.IllegalArgumentException: Could not open sound file: slurp.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at bug.act(bug.java:30)
	at greenfoot.core.Simulation.actActor(Simulation.java:568)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:526)
	at greenfoot.core.Simulation.runContent(Simulation.java:215)
	at greenfoot.core.Simulation.run(Simulation.java:205)
Caused by: java.io.FileNotFoundException: Could not find file: slurp.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:537)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 6 more
lordhershey lordhershey

2014/4/22

#
Where is slurp.wav on your system? See if it is in the sounds folder, if it is there, check the spelling and the case since file names tend to be case sensitive.
nona nona

2014/4/22

#
lordhershey wrote...
Where is slurp.wav on your system? See if it is in the sounds folder, if it is there, check the spelling and the case since file names tend to be case sensitive.
isn't it supposed to be in greenfoot class ?
nona nona

2014/4/22

#
lordhershey wrote...
Where is slurp.wav on your system? See if it is in the sounds folder, if it is there, check the spelling and the case since file names tend to be case sensitive.
and where can i found sound files ?
Super_Hippo Super_Hippo

2014/4/22

#
There is an extra folder called Sounds similar to Images folder. By the way, next time you post such an error message, clear it first and cause the error once. It is many times the same.
nona nona

2014/4/22

#
Super_Hippo wrote...
There is an extra folder called Sounds similar to Images folder. By the way, next time you post such an error message, clear it first and cause the error once. It is many times the same.
and where can i find this sound files ?
danpost danpost

2014/4/22

#
You can go to The Greenfoot Book page and at the bottom in the middle section 'For students', the second item 'The Book Scenarios' will download those scenarios the are used in the book. The 'chapter02-04/Little-Crab' scenarios have the 'slurp.wav' sound in them.
You need to login to post a reply.