Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Wonder Giant

Mp3Loader; Making a Perfect Loop

Recommended Posts

So we all know that making a seamless loop with an mp3 can be a pain. If I understand correctly it is nearly impossible to get a seamless loop using an mp3. You always end up with a gap at the end.

 

So that brings me to the LoaderMax MP3Loader. It has the option to do repeat:-1, but that still has the gap in the end.

 

Does anyone know if there is a way to get a seamless looping sound loaded into flash with the convenience of and stability of LoaderMax. For example is there another method for loading in a sound (maybe an AIF, or raw bytes) with LoaderMax that will allow a seamless loop with repeat:-1?

Link to comment
Share on other sites

Make sure your MP3 doesn't have a gap at the end with a little silence. And yeah, it's tough to get a PERFECT gapless loop in Flash, but as long as you're publishing to Flash Player 10 you could use a technique Andre describes here: http://blog.andre-michelle.com/2010/pla ... p-gapless/. You could use LoaderMax's DataLoader (format:"binary") to load the file and feed it as a ByteArray to wherever you want.

Link to comment
Share on other sites

  • 1 year later...
  • 7 months later...

Its easy, imagine your sound has four parts A,B,C,D. So you'll need the sound to perform twice measures like A,B,C,D-A,B,C,D. Let's imagine that each measure takes 10 seconds so the total time is 20 seconds.
 

Then in your code:

//add a playback method to follow playhead 
yourSound.addEventListener(MP3Loader.PLAY_PROGRESS, onProgress);

function onProgress (e:LoaderEvent) 
{
if (e.currentTarget.soundTime >= 11) //just after one second of the first measure, take playhead to one second after the beginning of your sound (in my case I have to use .95 to match perfectly)
{
DKK.gotoSoundTime(.95, true);
}
}
 

there you have a gapless sound using .mp3

Link to comment
Share on other sites

  • 9 months later...

Hey Fredy,

 

I tried your method and it works great but just wondering, whether checking progress over and again causes any overheads? or it it ok...?

 

Cheers,

ak

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×