Copy link to clipboard
Copied
How can I seamlessly play several MP3's in succession?
First I load all the mp3's I need to play using Sound.load(). As soon as the audio finishes playing, I play the next one. They are all voice clips that should play smoothly as if it was one audio, but there is a break between each one.
Does Sound.load() cache the files to the local hard drive? Is there a way to load the sound files to computer memory for so I can play them back without delay?
my guess is you do have whitespace. in fact, you almost can't avoid whitespace at the beginning of mp3s because their metadata is stored at the beginning.
to check, use getTimer() to see how much time there is between the end of one mp3 and the start of the next.
i think this will be on the order of 1 ms. with a little testing you should be able to detemine how much time lapses between the end of audible sound, the end of the mp3, the start of the next mp3 and the start of audible sound.
Copy link to clipboard
Copied
if you cannot edit the whitespace out of the mp3s, you can use the play() method to start the mp3 after initial whitespace. if you have trailing whitespace, you can use a loop to check the soundchannel's duration and compare it to the sound's length to determine when to play() the next mp3.
Copy link to clipboard
Copied
Thanks for the feedback. I didn't realize you could start after the whitspace or before the whitespace in an mp3. The problem I'm having is not this though. We don't have any white space between the clips, but there is still a slight delay before the next clip plays. It is enough of a time lapse to make the audio noticably choppy.
Copy link to clipboard
Copied
my guess is you do have whitespace. in fact, you almost can't avoid whitespace at the beginning of mp3s because their metadata is stored at the beginning.
to check, use getTimer() to see how much time there is between the end of one mp3 and the start of the next.
i think this will be on the order of 1 ms. with a little testing you should be able to detemine how much time lapses between the end of audible sound, the end of the mp3, the start of the next mp3 and the start of audible sound.
Copy link to clipboard
Copied
kglad is correct. When encoding to mp3, you'll always end up with a slightly different file than the original. That's a "flaw" (if you like) in the mp3 file format.
Google "flash loop mp3" as this has been written about/discussed to death..
http://www.8bitrocket.com/newsdisplay.aspx?newspage=3153
http://www.netalive.org/swsu/archives/2007/01/gapless_mp3_loops_in_flash_1.html
Copy link to clipboard
Copied
I checked and say that there is white space at the begining and end of each mp3. If I do use your suggestion, how can I be sure that the white space will always be the same length? What I mean is, is the white space at the beginning always going to be the same length?
Copy link to clipboard
Copied
you can't. you must check it for each mp3.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now