Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Seamless MP3 Playback

Guest
May 19, 2009 May 19, 2009

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?

TOPICS
ActionScript
1.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , May 19, 2009 May 19, 2009

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.

Translate
Community Expert ,
May 19, 2009 May 19, 2009

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 19, 2009 May 19, 2009

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 19, 2009 May 19, 2009

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
May 19, 2009 May 19, 2009

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 19, 2009 May 19, 2009

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 19, 2009 May 19, 2009
LATEST

you can't.  you must check it for each mp3.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines