Music stops after 7 seconds

Monkey Targets Forums/Flash/Music stops after 7 seconds

ondesic(Posted 2012) [#1]
I am loading a mp3. I have tried PlaySound() and PlayMusic().

It doesn't matter. After 7 seconds, the 48 second song stops. If I set it to loop, it reloops every 7 seconds. Anyone know what isgoing on?


mr_twister(Posted 2012) [#2]
Is it a VBR (variable bitrate) mp3? Because that happened to me once with a VBR song. I had to re-encode the MP3 with constant bitrate (CBR) and then it played just fine.

It looks like VBR makes difficult for programs to properly compute the length of the song. There are some utilities out there which "fix" VBR mp3s (like VBRFix) but I've not tested if that helps with the Flash problem. Perhaps it does.


ondesic(Posted 2012) [#3]
My file is 32kbps and 22011hz CBR :(

Any other suggestions?


NoOdle(Posted 2012) [#4]
Have you tried the audiotext example in the bananas/mak folder to see if that works for you using flash? Also try updating the latest version of Monkey as Mark to see if that helps. http://www.monkeycoder.co.nz/Community/posts.php?topic=3400


ondesic(Posted 2012) [#5]
The update did not fix it.

Here is my find. Using LAME mp3 codec I have a file 22050hz and 32 kbps

Using PlayMusic() the file will play 7 seconds then stops.

I then reencoded the file to 44100hz and 32 kbps. This file will now play for 14 seconds then stops.

(side note) I wish things just worked without all the headache. I first tried HTML5 only to find that different each web explorer uses different sound formats. Therefore I can never expect my program to run correctly because I can't control what browser the user is opening the html5 in :(

Next I tried flash, and now I am having this problem.


NoOdle(Posted 2012) [#6]
If you haven't already, take a look in your monkey directory, open the bananas folder and look in the mak folder. There should be an audiotest example. You can compare your mp3 with the one there, try matching the bitrate to see if that helps. In the code example it also shows you how to check what browser you are using and play the correct format.

Hopefully this should help.


Jesse(Posted 2012) [#7]
.
.
.



ondesic(Posted 2012) [#8]
Jesse,

My mp3 is 32 kbps, 22050 Hz and Mono. No go. Stops at 7 sec. Again, for some reason, at 44100 Hz, the file plays for 14 sec. Arrggg.


Gerry Quinn(Posted 2012) [#9]
"(side note) I wish things just worked without all the headache. I first tried HTML5 only to find that different each web explorer uses different sound formats. Therefore I can never expect my program to run correctly because I can't control what browser the user is opening the html5 in :("

You can test for various browsers. But indeed HTML5 is a bit of a pain. Hopefully as it matures the different browses will lose their quirks.


ondesic(Posted 2012) [#10]
So this is my find. EVERYTHING has to do with the way the mp3 is encoded. I spent an entire day downloading different versions of LAME mp3 encoder.

Just using 3.99.5 (latest version) didn't work. it still stops at 7 sec.
Using 3.87, same problem.
Using LAME 32bits version 3.98.2 WORKS. Same setting, but it just works. I used winLAME to do it.

I wish I could figure out why. Is there a good mp3 analyzing software to really look under the hood od an mp3?


ondesic(Posted 2012) [#11]
One thing has cut down on encoding errors. I have taking my original mp3 and changed it to a wav first. Then re-encoding it back. This time it seems to run correctly for flash.