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

2016/10/13

The sound files "music02", "get", and "gameover" refuse to play.

ginger--ale ginger--ale

2016/10/13

#
Here's the code: private void startUp() { addObject(lily, 317, 28); addObject(life, 543, 15); addObject(new Monster1(), 48, 450); addObject(new Bear(), 337, 221); addObject(new Bear(), 481, 68); addObject(new Bear(), 125, 102); addObject(new Exit(), 557, 428); Greenfoot.playSound("music02.wav"); //<----refuses to play } public void detectBear() { if(isTouching(Bear.class)) { removeTouching(Bear.class); bearsFound++; score = score + 200; Greenfoot.playSound("get.wav"); //<--- also refuses to play } } public void dead() { getWorld().showText("Congratulations, you killed a child.", 317, 28); Greenfoot.playSound("gameover.wav"); } All 3 of the sounds are located in the "sounds" folder of my Greenfoot project, and play when double-clicked inside the folder. Here is the error code(s): Exception in thread "Thread-386" java.lang.IllegalArgumentException: Format of sound file not supported: file:/F:/TECH/CSA/Greenfoot/MY%20GAME/sounds/music02.wav at greenfoot.sound.SoundExceptionHandler.handleUnsupportedAudioFileException(SoundExceptionHandler.java:57) at greenfoot.sound.SoundClip.open(SoundClip.java:125) at greenfoot.sound.SoundClip.processState(SoundClip.java:273) at greenfoot.sound.ClipProcessThread.run(ClipProcessThread.java:74) at java.lang.Thread.run(Thread.java:745) Caused by: javax.sound.sampled.UnsupportedAudioFileException: could not get audio input stream from input URL at javax.sound.sampled.AudioSystem.getAudioInputStream(AudioSystem.java:1155) at greenfoot.sound.ClipCache.getCachedClip(ClipCache.java:67) at greenfoot.sound.SoundClip.load(SoundClip.java:137) at greenfoot.sound.SoundClip.open(SoundClip.java:108) ... 3 more Exception in thread "Thread-387" java.lang.IllegalArgumentException: Format of sound file not supported: file:/F:/TECH/CSA/Greenfoot/MY%20GAME/sounds/get.wav at greenfoot.sound.SoundExceptionHandler.handleUnsupportedAudioFileException(SoundExceptionHandler.java:57) at greenfoot.sound.SoundClip.open(SoundClip.java:125) at greenfoot.sound.SoundClip.processState(SoundClip.java:273) at greenfoot.sound.ClipProcessThread.run(ClipProcessThread.java:74) at java.lang.Thread.run(Thread.java:745) Caused by: javax.sound.sampled.UnsupportedAudioFileException: could not get audio input stream from input URL at javax.sound.sampled.AudioSystem.getAudioInputStream(AudioSystem.java:1155) at greenfoot.sound.ClipCache.getCachedClip(ClipCache.java:67) at greenfoot.sound.SoundClip.load(SoundClip.java:137) at greenfoot.sound.SoundClip.open(SoundClip.java:108) ... 3 more Exception in thread "Thread-388" java.lang.IllegalArgumentException: Format of sound file not supported: file:/F:/TECH/CSA/Greenfoot/MY%20GAME/sounds/gameover.wav at greenfoot.sound.SoundExceptionHandler.handleUnsupportedAudioFileException(SoundExceptionHandler.java:57) at greenfoot.sound.SoundClip.open(SoundClip.java:125) at greenfoot.sound.SoundClip.processState(SoundClip.java:273) at greenfoot.sound.ClipProcessThread.run(ClipProcessThread.java:74) at java.lang.Thread.run(Thread.java:745) Caused by: javax.sound.sampled.UnsupportedAudioFileException: could not get audio input stream from input URL at javax.sound.sampled.AudioSystem.getAudioInputStream(AudioSystem.java:1155) at greenfoot.sound.ClipCache.getCachedClip(ClipCache.java:67) at greenfoot.sound.SoundClip.load(SoundClip.java:137) at greenfoot.sound.SoundClip.open(SoundClip.java:108) ... 3 more The "get" sound is supposed to play whenever the character touches one of the 3 bears laid out randomly on the screen. The sound "gameover" is supposed to play when the player's five lives are gone, and the "music02" sound is supposed to play upon startup. Please help?
danpost danpost

2016/10/13

#
First, try using a sound file editor to re-save the files. Maybe try 'mp3' format without identification tags included. If the problem persists, indicate so and give more information as to what system type, java version and greenfoot version you are using
NAMYA1403 NAMYA1403

2016/10/14

#
well according to me java only accepts .wav files as audios but i aint a expert so pls follow danposts codes and advices
danpost danpost

2016/10/14

#
NAMYA1403 wrote...
well according to me java only accepts .wav files as audios but i aint a expert so pls follow danposts codes and advices
The GreenfootSound API states the following:
Most files of the following formats are supported: AIFF, AU, WAV, MP3 and MIDI.
You need to login to post a reply.