# \[F8\] Sounds play too fast?! (not a boring streaming question)

**URL:** <https://forum.kirupa.com/t/f8-sounds-play-too-fast-not-a-boring-streaming-question/212687>\
**Category:** flash\
**Created:** [January 13, 2007, 2:18am UTC](https://forum.kirupa.com/t/f8-sounds-play-too-fast-not-a-boring-streaming-question/212687 "2007-01-13T02:18:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![BorisTheBrave](https://avatars.discourse-cdn.com/v4/letter/b/f0a364/32.png) [@BorisTheBrave](https://forum.kirupa.com/u/BorisTheBrave)\
**Post date:** [January 13, 2007, 2:18am UTC](https://forum.kirupa.com/t/f8-sounds-play-too-fast-not-a-boring-streaming-question/212687/1 "2007-01-13T02:18:42Z")

</div>

Hi, I’m sorry my first post has to be a query, but you can consider it a bug a report if you prefer. I cannot guarantee that this is not a mistake on my behalf, but I think after two days I’ve ruled out the possibility of a stupid mistake 🙂

I’ve run into the bizarre problem that _onSoundComplete triggers before the sound is meant to have finished_. Lemme explain the sample file, and why this behaviour is strange.

In a blank flash file (Flash 8), I add a single sound, and the following code:

```auto

var s=new Sound();
s.attachSound("one.wav");
s.onSoundComplete=function(){
    trace(getTimer());
}
g=getTimer();
s.start();
trace(g);
trace(s.duration);
trace(g+s.duration);

```

My traced output is:

> 

124  
895  
1019  
878

I.e. _onSoundComplete is running about 100ms earlier than you would think, given by the start time and sound duration_. I could understand that onSoundComplete might finish early in order to help timing issues, but as far as I can tell from playing other sounds simultaneously, the sound \*\*is \*\*actually finishing at 1383ms, not 1478.

I have checked s.duration in Audacity, and it matches correctly to the ms. The import settings for the sound are the default, I’m importing it from a mono 22kHz WAV.

Worse, I get different results, but still strange ones, when using s.start(0) instead of s.start().

I cannot get the upload button to work (in ie or firefox), so if you want the fla, kindly download it from my website at [http://adam.newgas.net/temp/bizzarre2.fla](http://adam.newgas.net/temp/bizzarre2.fla)

Do other people get the same issue, and any thoughts on why it’s occuring?

PS:  
[SIZE=1]In case you are wondering, I am attempting to make a component which, similar to [[U][COLOR=#0000ff]http://sonify.org/tutorials/flash\_audio/advanced/midisynth/[/COLOR][/U]](http://sonify.org/tutorials/flash_audio/advanced/midisynth/) , attempts to use a certain amount of silence at the beginning of the track and seeking in order to get accurate placement of sounds, in my case seamless looping. My component works great, but for some reason you can still here a seam between the first and second sounds played (but not the others, for some reason). I eventually tracked the problem down to this, as I was using setInterval(myFunc,sound.duration) instead of relying on onSoundComplete.[/SIZE]

[SIZE=1]PPS: Yes, that is my dopey voice saying “one”.[/SIZE]
