maxl0rd / standingwave3

Flash ActionScript3 dynamic audio library
http://www.noteflight.com
162 stars 28 forks source link

Complete event not firing with audio player and Audio Clipping #16

Closed jamestyner closed 13 years ago

jamestyner commented 13 years ago

I cannot get the complete event to fire. I have a button that calls the following code.

private function playSinewave(e:Event):void{ e.target.enabled = false; sinewave = new SineSource(new AudioDescriptor(),5,440,1.0); player.addEventListener(Event.COMPLETE,onPlaybackComplete); player.play(sinewave); }

private function onPlaybackComplete(e:Event):void{ sinewave_play_btn.enabled = true; }

Also with this code the output Panel Repeatedly traces AUDIO CLIPPING. And at times it will Stutter real bad and sometimes even freeze up the player and issue a 15 second timeout warning.

maxl0rd commented 13 years ago

Clipping happens when you playback a signal at digital full scale, aka 1.0. You are playing a sine wave at full scale so it's going to clip on every peak. Reduce the amplitude to 0.5 or something and this problem will go away.

Also, trace output completely destroys performance. Your window is probably tracing "clipping" 100s of times per second which is going to make the playback blow up.

jamestyner commented 13 years ago

I changed it to 0.5 and it still happens. I even changed it to -1.0 and it happens even still.

Also the complete event is still not firing.