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

2011/12/16

Problem with mp3 loop playing

1
2
dordor dordor

2011/12/16

#
In my project, I want to put an mp3 file as background music. I did this, and then, when the music ends and suppose to start again, there's a terminal error: Exception in thread "SoundStream:file:directory" java.lang.ArrayIndexOutOfBoundsException: 15 (directory is the file directory, not the word directory). I've done the same thing with other musics, and it worked, so maybe it's a problem in the file? can someone tell me what's the problem?
Builderboy2005 Builderboy2005

2011/12/16

#
I have had this problem before, and as far as I can tell there is some issue with the library Greenfoot is using to play mp3's. It can't handle certain types of mp3's, but I haven't been able to track down exactly what the incompatibility problem is. I believe it might have something to do with storing additional non-audio information with the file, but I am unsure. Did you download this mp3 directly or did you use some sort of audio program to produce it?
minecraft15 minecraft15

2011/12/17

#
Try This script: private GreenfootSound music = new GreenfootSound("Folder/mymusic.mp3"); public void started() { music.playLoop(); } This code works good for my background music i use with MP3 files. Then just implement a stop script for where/when you want the music to stop.
dordor dordor

2011/12/17

#
Builderboy2005 wrote...
I have had this problem before, and as far as I can tell there is some issue with the library Greenfoot is using to play mp3's. It can't handle certain types of mp3's, but I haven't been able to track down exactly what the incompatibility problem is. I believe it might have something to do with storing additional non-audio information with the file, but I am unsure. Did you download this mp3 directly or did you use some sort of audio program to produce it?
My friend used an audio program to produce the mp3. The music works perfectly on iTunes, even with repeat.
Builderboy2005 Builderboy2005

2011/12/17

#
Was the program Sony Vegas perchance?
dordor dordor

2011/12/17

#
The program is Acid (Sony program)
Builderboy2005 Builderboy2005

2011/12/17

#
Ah gotcha. I use Sony Vegas, and I ran into problems when exporting mp3's and including ID3 tags. My guess is that including these tags (or any other non-audio info) confuses the library. See if you can re-export it using no extra info, and we'll see if that really is the problem.
dordor dordor

2011/12/17

#
Oh, you right. In the iTunes the music's genre is blues... thanks.
dordor dordor

2011/12/17

#
There's a way I can remove the extra info without re-exporting it? (Because my friend gave me just the mp3).
Builderboy2005 Builderboy2005

2011/12/17

#
You would have to download an audio editing program for yourself in order to modify the audio file properly, probably through simply importing and then re-exporting out of the program with no extra tags.
dordor dordor

2011/12/17

#
Worked perfectly! thanks!
Builderboy2005 Builderboy2005

2011/12/17

#
Excellent! It took me a really long time to figure out what was causing those errors, I'm pleased we finally understand what is causing the problem.
davmac davmac

2011/12/17

#
If someone can send me a short mp3 file that exhibits the problem, I'll take a look at it sometime and see if I can fix the JLayer library. (Send it to davmac@greenfoot.org). Thanks.
Builderboy2005 Builderboy2005

2011/12/17

#
Is 1/10th of a second short enough? :D Sound has been sent, best of luck with the fix!
davmac davmac

2011/12/17

#
Thanks. No promises, and it will probably take me a while before I can look at it - but I will try when I get the chance.
There are more replies on the next page.
1
2