# Smoother sound looping

**URL:** <https://forum.kirupa.com/t/smoother-sound-looping/309159>\
**Category:** flash\
**Created:** [May 8, 2010, 9:41am UTC](https://forum.kirupa.com/t/smoother-sound-looping/309159 "2010-05-08T09:41:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![joobny](https://avatars.discourse-cdn.com/v4/letter/j/9dc877/32.png) [@joobny](https://forum.kirupa.com/u/joobny)\
**Post date:** [May 8, 2010, 9:41am UTC](https://forum.kirupa.com/t/smoother-sound-looping/309159/1 "2010-05-08T09:41:05Z")

</div>

Hey everyone,

I’ve been using the following code to make the soundtrack for my project loop over and over again until it is told to stop:

```auto

function playMusic():void
{
soundtrackChannel = soundtrack.play();
soundtrackChannel.addEventListener(Event.SOUND_COMPLETE, loopMusic);
}

function loopMusic():void
{
if (soundtrackChannel != null)
{
soundtrackChannel.removeEventListener(Event.SOUND_COMPLETE, loopMusic)
playMusic();
}
}

```

It’s working for me, but it’s not particularly smooth. There’s a bit of a delay between the previous iteration of the loop and the next one - it pauses for a second between loops.

Does anyone have any ideas as to how I can solve this issue?

My project’s almost done now and I’ve had loads of great help from this community, thank you so much for your help!
