The silent death of onSoundComplete event – a petition

History
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.

Going dynamic
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 :)

Here some URLs to test:
8bitboy.popforge.de
lab.andre-michelle.com/tag/audio

Note that ALL hacks based on the onSoundComplete fail at the time on various machines!

Related Blog Posts:
New project and my new TB-303
Popforge Opensouce Project
Flash sound issues on vista
Umz tzz Buzz tzz Umz tzz Buzz

133 thoughts on “The silent death of onSoundComplete event – a petition”

  1. I agree whole heartedly. I really hope Adobe starts listening. Music is my job and Flash is my hobby. If they started taking sound seriously I would be so happy.

  2. Hi Andre

    I’ve also experienced a problem with actionscript sound, which has been since the release of the Flash Player version 9.0.115. It’s not the same issue as yours but think they might be related.

    Basically, I have 3 sounds instantiated in my actionscript. Once everything has loaded I call an init function that starts the sounds:
    sound1.play(0, 1000);
    sound2.play(0, 1000);
    sound3.play(0, 1000);
    I also tried the following:
    var startTime = getTimer();
    sound1.play((getTimer() – startTime), 1000);
    sound2.play((getTimer() – startTime), 1000);
    sound3.play(0(getTimer() – startTime), 1000);

    Theoretically, they should all be pretty much in sync, but they aren’t. I did some digging on the web & found a bug documented about how this has been an issue since FP 9.0.115. So I installed FP 9.0.45 and found that all the sounds played perfectly in sync. I was hoping that there would be a fix in the latest release of the FP. But the sounds still play out of sync for FP 9.0.124.0

    Here are the links to the related bugs I had found on the forums:
    http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=44&catid=184&threadid=1338772&enterthread=y
    http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=44&catid=184&threadid=1330260&enterthread=y

    Cheers
    Tracy

  3. Adobe should certainly fix this, since so many people have come to depend on it, but they should really write a sound API providing a clean way to write generated PCM audio to the soundcard.

    Oh, and I’d also like them to expose a function to decode part of an MP3 file to PCM audio, so that I can ship samples as MP3s, but still process them as PCM (adding delay, reverb etc algorithmically).

  4. I’ve just come across this bug while porting an app to actionscript 3. It’s ridiculous that this doesn’t work properly. Maybe it’s time to give silverlight a go.

  5. function = onAdobeNextMinorComplete() {
    Release_MinorFix.onSoundComplete=true;
    }

    We agree too! ADOBE get your hands out of the purse and start fixing things for us programmers!!!!

  6. Adobe, now you just have to step up and do something serious about the sound handling in AS3. We want more control and better control, not less functions. Get the onSoundComplete back on- along with a host of other functions making it easier to do cool stuff without having to find workarounds all the time!

  7. So, I have been rebuilding my classes in AS3 and decided to improve my background music player.

    Pretty simple, you can add in looped MP3s and assign a weight to each one. Then they get picked at random, well somewhat random the higher weighted ones get picked more.

    Anyway. I come to find that onSoundComplete leaves a small gap between firing. Odd since a single sound can loop seamlessly using the play method. So obviously the player can detect the end of a MP3 and restart the stream from the top, but fails to send the onSoundComplete event in time?

    Is there any AS3 workaround for this at all?

  8. I totally agree.
    My invention the Tony-b Machine only depends on the onSoundComplete function.
    When the Flash Player 9 arrived, I thought it was the end…

  9. I agree with you.

    Yes, please fix this and add a sane way to access the audio buffer. It would good to be able to access incoming microphone data too.

    ADOBE get your hands out of the purse and start fixing things for us programmers.

    Matix.

  10. Adobe should certainly fix this, since so many people have come to depend on it, but they should really write a sound API providing a clean way to write generated PCM audio to the soundcard.

  11. I have been going insane trying to sort this out. A day and a half of wasted time. Time I can’t afford to lose with deadlines fast approaching.
    I have now got it working thanks to Scoch.
    Respect and many thanks for your solution.

  12. This has been driving me crazy. Such an obvious and necessary requirement. Adobe FIX THIS, or it will force people to start looking into Silverlight and HTML5.

Comments are closed.