Looping audio without a pop

I have an audio clip that will loop fine when I play it in Audition, but when I try to loop it in Flash, it keeps doing a “pop” sound when it repeats.

Right now I’m using this to play it and loop:


public function playMe():void {
 channel = snd.play();
 channel.addEventListener(Event.SOUND_COMPLETE, loopMusic);
}

public function loopMusic(e:Event):void
{
    if (channel != null)
    {
        channel.removeEventListener(Event.SOUND_COMPLETE, loopMusic);
	playMe();
    }
}

It’s based on this guy’s example.
http://doogog.com/music-looping-in-as3.html

Is there something I can do to avoid that popping when it loops?

Are you sure the “pop” isn’t in the sound file? Sometimes audio clips have a short silence in the beginning or end, that need to be trimmed before looping them. Use a sound edition software to make sure it’s not in the sound. Besides that, I have never seem this problem in Flash. :slight_smile: I hope it helps…

That’s why I said it loops fine in Audition. If there was a gap in the file, then wouldn’t I hear a pop when I play it in Audition?

are you sure you cut the audio in the zero-crossing (the wave that intersects with the 0db line)?

not doing so will often make a pop sound when looped…

又兜了足足九九八十一个圈,终于在齐藏玄快要崩溃的时候,他们看到皇宫了——  那半埋在沙土中的新开传世私服城堡,外露着半圆形的穹顶,四方都有高塔耸立,石质的外墙黄褐的色调刚好与沙漠融合,要不是那四座高塔,恐怕是不容易发现这里竟然还有座皇宫。

If you convert the audio file to ‘wave’ format and crack it open on a wave editor you might see it.

I also had a similar incident in my game. The mp3 players I was using for test prior to inserting music into Flash were ‘smart’ enough to skip first couple seconds of the file, thus I never heard those crackles and pops.

It really annoyed me that I ended up asking my sound guy to check again and sure enough, he found some noise in the very beginning and at the very end, which are fine if you play the music once but becomes a nightmare when you loop them through.