Back in the year 2002, where FlashMX was introduced, I was pleased to see the new event ‘onSoundComplete’. I had access to the beta version these days (cannot say where, cause I wasn’t in the beta group). I found out, that it simply did not work as expected. The event should be triggered, when a sound was completely played, but starting a new sound on the very same event caused a small gap in playback. What was the point? The ‘onSoundComplete’ event was only triggered at the beginning of a certain minimal timeframe (2048 samples on a PC ~ 46ms / 44.1KHz). Macromedia didn’t take my report seriously – more – they demanded that everything worked as expected. Well, no musicians worked at Macromedia those days.
The first hack on SoundComplete
Same year – Frank Baumgartner found a way to trigger waveforms sample-exact – the base for any kind of sequencing. He found out, that the ‘offset’ in Sound.play( offset, loop ) accepts a float (Number). He played waveforms with a little silence at the beginning to create a time-offset, where the actual waveform starts where it should – free from any timeraster. This was very cool and I started playing with it. Fortunately the event was triggered very precisely. Lucky times.
More enhancements on Sound
In 2005 Adobe introduced Flash8. We got 32 stereo sound channels – a huge number according to 8 in the past. I felt for the first time that the onSoundComplete event has become less stable, but still passable.
Then Flash9 was introduced with a tiny method, that changed my flash life (Loader.loadBytes). ‘Shouldn’t it be possible to create SWFs on the fly?’. After some tests I found a solution (as others too) to create a dynamic audio stream with your own amplitudes within the FlashPlayer. Awesome possibilities! Just one darkside: It all depends strongly on the now renamed ‘SOUND_COMPLETE’ event. The hack necessarily must have a solid timer for creating an endless audio stream. Unfortunately the onSoundComplete event lost priority. It become very unstable. Using a 4 times longer buffer (8192 samples) makes it more stable, but also increases the latency of the audio application. Furthermore it takes more time at once to compute all samples. Every animation stops.
The silent death
But if you think it cannot be worse, Windows Vista was introduced where the onSoundComplete event went totally out of control. A FlashPlayer minor-update fixed that back to normal (by accident? – no release notes…), but the latest (R115) has back the glitch. Any upcoming minor update of the FlashPlayer can be the death of the onSoundComplete event at all. At that point I hate to be such dependent on Adobe and their interest.
So why should it be important for Adobe to fix this?
Software is going online and Adobe wants us to use the Flash technology to create online application – so called “Rich Internet Application”. We are currently building a huge audio application (yes – a new one!), which completely matches that strategy. So please write a comment. Lets make that issue important for Adobe to fix it in the next “Minor’ release. I know, you will have fun with our new “Rich Internet Application” and a lot of more audio application should follow! Making music is cool! Much cooler than 3D :)
Note that ALL hacks based on the onSoundComplete fail at the time on various machines!