# Sound Delay Problem

**URL:** https://forum.kirupa.com/t/sound-delay-problem/283431
**Category:** flash
**Created:** [March 6, 2009, 2:45am UTC](https://forum.kirupa.com/t/sound-delay-problem/283431 "2009-03-06T02:45:59Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![pgstudio](https://avatars.discourse-cdn.com/v4/letter/p/ea5d25/32.png) [@pgstudio](https://forum.kirupa.com/u/pgstudio)
#### Post date: [March 6, 2009, 2:45am UTC](https://forum.kirupa.com/t/sound-delay-problem/283431/1 "2009-03-06T02:45:59Z")

</div>

Hi Guys,

i´m having a “small” problem:  
I´ve loaded a Mp3 Song with this code:

```auto

            var song:SoundChannel;
            snd = new Sound();
            snd.load(new URLRequest("myMusic.mp3"));
            song = snd.play();

```

and also created a “FX” Sound (very short sound) with almost the same code:

```auto
 
            clickSound = new Sound();
            clickSound.load(new URLRequest("click.mp3"));

```

And added a KeyListener to my stage:  
with  
stage.addEventListener(KeyboardEvent.KEY\_DOWN, key\_down);

and that´s my key\_down method:

```auto
        
private function key_down(e:KeyboardEvent):void {
clickSound.play();
 }

```

What it should do is fire this clickSound whenever i press any key.  
The problem is:  
If i have the song playing in background there is a HUGE delay (around 1s or more) when i press anykey to hear the sound.  
The method key\_down is called with no delay (i´ve traced it to test), just the sound that come delayed.

If there is no music in Background, there is no delay, so i´m assuming it´s something wrong when i play 2 sounds.

Am i doing something wrong to play these 2 files ?

Thanks all 🙂

Cheers…  
PG
