Response to a bunch of questions from Adobe
Published by André Michelle April 1st, 2008 in correspondenceAdobe: You had mentioned that the vista issue was fixed in a minor version and then broke again. Was there a version of player that had the complete event occur correctly on Vista? If so, what version?
This is really hard to comprehend, cause it was months ago. Let me give you a rough approximation when what happened. I simple don’t know exactly what version was up-to-date at the time. I encountered the issue myself on Windows Vista in spring 2007 (9.0.0.28?) and it was completely broken. Joa Ebert installed Vista in autumn and reported no problems (9.0.0.45?). The last minor update however (9.0.0.115) broke it again. I am sorry, that I cannot recall it more precisely.
Adobe: If you encounter the issue, can you describe what happens?
The onSoundComplete event isn’t running stable anymore. Read more in my explanation below.
Adobe: Does the event fire at the wrong time?
Yes.
Adobe: What is the range of the innaccuracy?
A few milliseconds (varying), enough to get audible gaps, shaky playback. It runs a few times stable, then a gap occurs and so on.
Adobe: Does the event always fire (even if at the wrong time)?
It doesn’t appear for me, that it is sometimes missing. So yes, it seems to be fired every time but of the time.
Now the most meaning part. The FlashPlayer is a blackbox to us, however I can imagine that the SoundComplete event perhaps isn’t the only problem at all. Describing the problem is very tricky. Anyway, let me try to explain. I hope this makes it more clear, what is going on.
The internal sound-buffer length that the FlashPlayer uses to communicate with the sound card seems to be on Windows OS 2048 samples and on MAC 1024 samples. When the sound card sends the event that the buffer is played once and the sound is played completely it will be pass to ActionScript in the next onEnterFrame event. Hence it never has been fired sample exact! I think your engineers use a workaround forcing the FlashPlayer to start only one Sound in the sound buffer duration. I can proof this by setting the FPS to 1000 in the standalone player and start a Sound object every onEnterFrame. It won’t be running at 1000 FPS (each millisecond), instead it is triggered exactly every 2048 samples (~46ms) on Windows OS for instance. The engineers had assumed that 2 onSoundComplete events won’t be fired in a single onEnterFrame, this way it doesn’t matter how precise the sound card event is passed to ActionScript. Nice idea by the way! This is not happen on Windows Vista, though.
So there are actually 2 locations to find the bug in Windows Vista. Either the Sound.start command isn’t triggered precisely by the sound card or as assumed before the onSoundComplete event is way of the timeframe, where it should be received by ActionScript.
personal view
Flash has always forced us to use tricky workarounds, cause naturally developers want more, than Flash provides in current version released. I think the onSoundComplete was not intended to be used to sync Sound objects playback sample-exact. However we found out that there is a certain internal buffer length years ago. Hence we used a silent Sound object which has exactly 2048 samples (to be sure for Windows and Mac) as a solid timer. Now we were able to start building sample-exact sequencers. A lot of developer built audio applications on that idea. Then, for some reason the onSoundComplete event went unstable as AS3 came out. By using a longer silent sound object (4 times for instance), we ensured stability again with the downsize of a longer latency. Windows Vista is the worst case - the onSoundComplete event fail badly - however all systems are suffering, hence all audio applications are running with a shaky playback.
What I mean is, that backwards compatibility must also be ensured for workarounds, that are heavily used by Flash developers for years to remain the functionality of already released projects.
I hope you can change that in FP10.
kind regards
André Michelle
38 Responses to “Response to a bunch of questions from Adobe”
- 1 Pingback on Sep 27th, 2009 at 4:13 am
- 2 Pingback on Nov 2nd, 2009 at 1:23 pm

Hi Andre,
thanks for taking the lead on this.
As you pointed out, it’s hard to tell where is the bug. You say, onSoundComplete, but I too experience the audio gap and I don’t rely on this event. For me the gap appears when 3 or more sample length concurrent audio sample are looping back. You can experience it for yourself here:
http://www.blobprod.com/mixers/beatbox/beatbox.asp
The issue might be somewhere else in the sound processing chain.
I have logged a bug with the Flash development team and I hope this will get fixed in a very near future.
I want to point out another broken functionality that might be connected and hasn’t been fixed in the recent update. Here is how it manifests. The channel.position variable always responds as if the loaded mp3 sample rate is 44100, regardless of the actual rate, meaning that a sound 10 seconds * 22050hz placed at 5000ms via channel.position will in fact be placed at 10000ms given that 10*22050 = 5*44100. I haven’t tested this at other sample rates, but it seems to follow.
Two things make this bug difficult to work around. The distance between the desired position and the actual position increases with time, but given that the channel object has no access to the sample rate of the source, the developer must first prime the programme with the source sample rate, in order to set the multiplier correctly. This requires either another file for every sound loaded, or a database of the same. Not too elegant.
The bug base page is here
I find it so bizarre that they even need to ask these questions.
All they need to do is ask one of their highly skilled software engineers to spend a couple of hours trying to build an audio sequencer with Action Script.
I just discovered another #@! bug,
In addition to the Sound class / play method / startTime parameter bug that I already reported (the one Laurence Taylor is talking about), I discovered that seeking a mp3 using same parameter is totally unreliable when a flash movie is loaded in another Tab of Internet explorer 7 even with a 44100Hz sound. The bug base page is here
Sound playback with AS3 is just a mess … this is the 5th bug I report regarding sound playback … I’m so disappointed and so fed-up trying to find workarounds …
I found this page looking for information on the problem that Laurence Taylor described. If he or anyone else here is still hunting for that information, I have come up with a workaround. I’ve written a couple of classes that will evaluate the sample rate and adjust the playhead position value accordingly. Feel free to use them. They are replacements for the Sound/SoundChannel objects — they are Sound2 and SoundChannel2. They work just like the originals except you should use Sound2.play2() instead of play() to hook up a SoundChannel2 object. The files are reasonably well commented.
http://www.birnamdesigns.com/misc/as3_sound2_classes.zip
Response to a bunch of questions from Adobe at Adobe, MAKE SOME NOISE great article thank you.
Response to a bunch of questions from Adobe at Adobe, MAKE SOME NOISEgreat article thanks.
very good
thank
Response to a bunch of questions from Adobe at Adobe, MAKE SOME NOISE very good. thank you
Response to a bunch of questions from Adobe at Adobe, MAKE SOME NOISE great article thank you.
tanx see you later
your sorry off men
great article thank you.
tahnx admin.
thanks admin.. goods
oo good admin
yes admin..thansss
Hmm good.
than you very caferin ki
thnaks
thank you
Dear is not perfeckt?
very good thanks a lot admins
thanks bro
nice nice lol
good web sites thanks bro
Seni bulacam oglum hadi git hadi git!
thank bro
thanks birader
Wrote a blog post a few weeks ago on the topic: http://www.isotop.se/2009/11/advanced-sound-programming-in-as2/
thank you very much. usefull article
thanks birader
Thank Administrator…
thanks all admin
thank you very much. succesfull article
Some time before, I did need to buy a building for my firm but I did not have enough cash and could not buy something. Thank goodness my colleague suggested to take the personal loans at creditors. Thus, I acted so and used to be happy with my car loan.