1

It's a known problem to loop mp3's because of the gap they have in the beginning. But since Flash has programatic control, I tried to use the offset to play it. Still, so far, I couldn't get it to loop nicely this way.

Sound.play(23, 9999);

I set start time to 23ms, which according to documentation should loop this sound from 50ms till the end, end then again. No matter what value I tried, I couldn't get it to work correctly. I observed the wave form in audio editing software and the sound starts exactly at 23ms, I tried setting this as start and many other values and couldn't stick it together.

UPDATE <- let's hope this works

From Starling forum: http://forum.starling-framework.org/topic/how-to-use-sounds

I'm assuming that you're not starting from the beginning because the MP3 format often adds a little bit of silence at the beginning of the file. I was able to work around this by making the file a WAV instead. Then, I added the WAV to the library of a Flash Pro document and exported it as a class for ActionScript. I believe Flash Pro ultimately makes an MP3 from it, but it adds some magic sauce to make the MP3 work without extra silence at the beginning. Then, if you're using Flash Builder, you can embed the symbol from the SWF with [Embed] metadata. It's kind of complicated, but it's been working great for me.

3 Answers 3

1

Cant you recompress the audio with another Codec? That might help!

1
  • Yep but only going through Flash Pro, check the update. I'd still like to know if it's possible to achieve the same thing with start offset.
    – Ska
    Mar 2, 2014 at 16:19
1

This is exactly why MP3 is never used in this way. MP3 really is a very bad choice of format for what you are trying to do.

When I have produced audio for use in projects like this (I have provided audio for video and computer games in the past) the codec of choice has always been OGG format files.

I would basically discourage you from using MP3.

1
  • Other formats can't easily be embedded into Flash, the only solution is what I posted in the update, for that you need Flash Pro software.
    – Ska
    Mar 4, 2014 at 14:52
1

http://www.compuphase.com/mp3/mp3loops.htm

I've used this method with some success. Not sure if it works with Flash. Works well with Quicktime based playback and causes very weird looping glitches with iOS builtin mp3 player.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.