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. YOU ARE RIGHT!!

    i can only agree André, this really has been so unsatisfactory for so many years !!!!

    ADOBE PLEASE FIX THIS PROBLEM !!!

    It is a small step for you, but a big step for mankind :-) (well, at least the flashing part :) )

    kind regards,

    Frank

  2. The SOUND_COMPLETE is actually so important because it opens this huge space of possibilities and they just kill it by forgetting about that one event.

    Also funny: Vista and SOUND_COMPLETE is completly hosed. If I run Ubuntu using VMWare in Vista it runs totally fine with the the Linux player. What the hell..?!

    … and wouldn’t it be even cooler to synchronize some 3D animation with music? :)

  3. Aye!

    Indeed particularly interesting on this issue also is, the delay time of the actual flash sound buffer (System.capabilities…. ?). – So not only the syncing INSIDE flash is important, also the overall output delay – as you say – so we can ALSO do perfect syncing with the graphics engine.

  4. Alternative – Even one Step further:

    I remember proposing FMOD or Mini FMOD to Macromedia, years ago…

    The miniFMOD engine is highly portable and incredibly (!!) fast.

    I think sound formats like MOD, XM (or newer versions including MP3 encoded samples) sounds like “just perfect” for web AND (!!!) mobile usage.

    When mini-FMOD takes only something below 10 kilobytes of additional plugin size, this is _really_ worth it and you actually have a) sound player b) effect engine c) sampling/pitching engine natively inside flash! – The MP3 engine is already in the flash plugin which could be re-used …

    I think something like Mini FMOD (or whatever is similar) would be incredibly great for flash game developers !

    kind regards,
    frank

  5. +1

    no more glitches and relatively obscure hacks. adobe please just give us a clear access point to the samples of the audio buffer!

    – bram

  6. Agreed. I don’t want to miss out on those new cool sound apps! And to bring back to live my old .mod files again, in a hacked together Flash module player :)

  7. HeyHo. This is really a change to the worse. Generating sound on the fly in your browser is(now was) a great opportunity and opens a whole new domain in flash development. I never understood why they neglected the sound part of multimedia at all and was happy that someone found a way to circumvent this issue. and now.. back to the beginning? hm.. i don’t see the strategy.

  8. So this got fixed in an update in between?! I would have thought that the 115 finally fixes the sound glitch but instead it introduces it back again. Adobe is caring a lot about making video and 3D (Papervision) look good in Flash these days which is good but unfortunately it seems that audio gets the short side. As a game programmer I like to support dynamic audio in Flash so this is also important for me.

  9. Yeh it seems like audio is slipping on their focus list like sascha said. Hopefully they listen when a very big push for audio apps with Flash ride on this event. Some of the stuff you can do with the speed of AS3 are great but it is important to fix features before adding more.

  10. Thanks for this great post André.
    Adobe guys this is a SOS, we are working with the SOUND_COMPLETE event to provide a better experience with flash. Don’t let us down.
    I’ve worked on the 8bitboy engine for 2 weeks now to make it smooth with animations and games. And the latest release of the player ruins all this work on Vista.
    You can view (hear) a demo
    of bitboy for games
    .

  11. Well, I never faced thiat bug, but it sounds terrible (((
    As a musician and a flash developer I can’t agree with such mistreating the SOUND!

    Andre, if you haven’t done it already – here’s the Justin Everett Church’s blog
    http://justin.everett-church.com/index.php/wiwtw/
    – he is one of the FlashPlayer team – you can describe the problem I think better then anyone can )))
    We will join!!!

  12. Just want to add my support to this. Should be an easy fix one would think. Hope they get it done in the next minor-update.
    It´s bad when you even can´t trust the bugs anymore :)

  13. I completely agree that on SoundComplete event must go back to work and work well. About a half year ago I was working in company called Zone4play which produce a games for UK TV market and we developed Voice Over machine with bank about 150 pre-recorded sounds for some game which was played interactively upon decisions made by game engine and all of this stuff was depend on SOundComplete event. Now I can’t even imagine what will happens with all our games, which still work on several Cable Vision channels in UK with another update of Flash player. Really sad.

  14. I was, just like you Andre, building synths with AS3 some time ago using a similar hack … But stopped because of these instabilities…

    Rather than fix this SOUND_COMPLETE issue, I’d like Adobe to create a ‘normal’ way to access the sound buffer of Flash.

    Don’t get me wrong… I hope they fix this SOUND_COMPLETE issue, but this only makes a complex hack work again.

    Just compare the new features at the graphic-side of the latest releases of Flash, and then look at the audio side… not much happened right?!

    Cheers!
    PJ

  15. Not a huge deal for me as sound isn’t the main focus of our work, but we have come across this problem and workarounds in the past.

    SOUND_COMPLETE should work as expected, i.e. be dispatched as soon as a sound has completed.

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

  17. c’mon Adobe your holding Andre back from creating the definitive audio RIA.

    And while you’re at it, how about allowing computeSpectrum for rtmp streamed audio..

  18. It is frustrating that while Flash makes great strides in certain areas, it falters in others. And you’re right, Adobe has it’s own agenda about what to focus on, and it’s very slow and difficult to sway them elsewhere.

    The audio portion of Flash Player is still in bad need of attention. Why is there no built-in hook to dynamically generate sound? Why does computeSpectrum operate globally on every instance of Flash player, not just the Flash app calling it, often causing a stupid SecurityError? Why can’t we use computeSpectrum on a specfic SoundChannel? Not to mention sort-of bugs like Sound.play( startTime, loops ) looping back to startTime, and not the beginning of the sound.

  19. The guys at Adobe should wake up and redesign the whole audio stuff in fp! Why don’t they see the importance of a well designed audio api for things like game development???

  20. my last project was the flash front end for an interactive artwork for the biggest arts organisation in london and this b_st_rd bug raised its ugly head halfway thru and nearly caused me to look like a complete fool in front of my clients. when you say ‘look, it’s not me, its the player or adobe or something’ people tend not to believe you and loose a little faith. so, as someone who has felt the real sharp end of this issue i STRONGLY support this petition. PLEASE fix this adobe. :)

    ps to adobe: the rest of your stuff is great, keep up the good work. :)

  21. Adobe has been ignoring the audiophiles since the very beginning of Flash. Yes we got 32 channels in Flash8, but still in Flash9 the only modifiers we get is volume and panning. The pseudo audio analysis we got in return adds next to nothing. The audio synthesis you (and others) came up with totally breaks free from the boundaries that Adobe forced upon us, but then we at least need a stable onSoundComplete event!

    Please let us have at least that! “REBEL REBEL REBEL!”
    Cheers, Eric-Paul – Amsterdam.

  22. Are the comments the petition?

    What I saw demonstrated by you at Flash on the beach in Brighton. Was by far the most surprising thing ever on a Flash player. (yes, 3D is cool too, but we saw that coming, right?)

    Why would Adobe kill functionality that enabled people to do something so extraordinary???

    HEREBY I SIGN THE PETITON!

  23. agreeed andré! +1
    good to point it out and i REALLY hope adobe is listening ;)
    my suggestion to adobe: hire andré and make him audio minister for flash/flex *g*

    you rock!
    henrik

Comments are closed.