Drumming to a steady beat in Flash MX 2004

pwpcoverPractical Web Projects, September 2004

Using the built in sound timing in Flash MX 2004 to create a rock solid interactive drum machine.

Macromedia Flash MX 2004 is a powerful tool, and it allows us to do some amazing stuff. One of its catches, however, derives from the fact that all timing is frame based, and that actual, achieved frame rate is determined by something akin to luck, rather than the actual document frame rate setting.

In truth, Flash attempts to attain the frame rate you have requested, but often will fail, as external processes, or even animation within your movie take over and cause the playback to skip and sputter.

This does not engender much hope for a drum machine, which relies on rock solid timing. In fact, if you look at drummachFrames.swf, and try inputting a drum beat, you’ll see this effect in full swing. It sounds OK, but you occasionally hear the “drummer” lose time, and play a beat late.

Note that in years since, the audio timing has become better and better, and now things like drum machines, dynamically generated audio and effects are easy with AS3.0