Composing Music for Macromedia Flash

Because of the ubiquitous presence of Macromedia Flash on the Web, many desktop musicians are interested in composing soundtracks for Flash movies. However,

Because of the ubiquitous presence of Macromedia Flash on the Web,many desktop musicians are interested in composing soundtracks forFlash movies. However, composers often become frustrated with thelimited nature of short repetitive loops and the poor quality ofMacromedia Flash's streaming audio, which breaks up because of networkcongestion. Fortunately, there is a lesser-known type of backing trackcalled a loop mix. Flash loop mixes are bandwidth-friendly (40to 100 KB downloads) long-form compositions (typically 30 seconds to 2minutes in length) that don't suffer from streaming dropouts.

Image placeholder title

Macromedia Flash loop mixes take advantage of the software'smultitrack mixing capabilities to present an evolving soundtrack.Rather than compose a standard linear composition, you create severalloop tracks and simulate a sequence by muting, unmuting, andcrossfading the loops over time. The combined volume changes for eachtrack determine the “linear” nature of the composition.Listen to audio examples 1 and 2 (drumjam.swf and 70slounge.swf,respectively) on the EM Web site to hear two styles of Flashloop-mix compositions.

In this column, you will learn how to convert a MIDI loop mix into aMacromedia Flash-based loop mix. I will assume that you have the Flashauthoring software (see Fig. 1) and are familiar with how to usethe Sound panel and the Edit Envelope and Sound Properties dialogboxes. If you're new to Flash, you can download a 30-day trial versionfrom Macromedia (


There are two Macromedia Flash authoring limitations to considerwhile preparing your composition. The first is that Flash Player canplay a maximum of eight sounds simultaneously. That means you can haveas many as eight tracks in your loop mix. Flash movies, however, oftenhave other sounds in addition to the soundtrack. Therefore it isadvisable to limit your composition to three to five tracks, allowingfor playback of other audio resources, such as streaming voice-overnarration and interactive button sounds. The second limitation is thatthe Macromedia Flash authoring software supports only eight changes involume per sound, which means that you can mute and unmute a track justtwice using square-wave-shaped volume envelopes.

To maintain a reasonable file size, each looping track should beshort in duration. The music should rely on the mix to reuse materialand create musical variety from a small number of looping ideas. Aslong as you work within the necessary constraints, you can createcompelling, bandwidth-friendly soundtracks for any Flash movie.


To create a loop-mix composition, use a MIDI sequencer to composemultiple looping parts and record volume changes in separate butcorresponding volume tracks. Loop tracks are commonly a few beats ormeasures long and are not long enough to hold all of the volume-changeinformation. Thus, your MIDI file must have two tracks for each musicalpart: one to contain the loop and a second to hold the correspondingVolume controller data (Control Change 7). Download audio example 3 (70slounge.mid) tosee and hear this concept in a MIDI file.

Layering musical parts one at a time is the most natural process forcomposing loop mixes. It's an easy way to create variety and growthwhile working within the given limitations. Polymetric loops areanother way to create rhythmic variety with minimal file size, becausethe combined pattern is longer than any one of its parts. I used thattechnique in Audio Example 1.

You can use other techniques, as well. In Audio Example 2, I createdthe intro by offsetting the bass loop by four beats in my MIDIsequence. The eight-bar bass loop emphasizes a Bb tonality inthe first four bars and an Ab tonality in the last four bars. Iwanted to solo the organ accompaniment for four bars and then introducethe bass on the Bb tonality. To solve that problem, I offset theBb bars to the end of the bass line, so that when I unmuted thebass part four bars into the song, the loop was in the Bbtonality. I also offset the melody so that its phrases would coincidewith the altered bass part. That is just another example of how tocompose your loop mix to maximize musical effect.


Once you finish the composition, you can begin the process ofconverting it into a Flash loop mix. First, record each loop track fromyour MIDI loop-mix composition into an audio-editing program. Be sureto disable looping for each track and mute the corresponding volumetracks before you record.

Next, edit your loop tracks for importing into Flash. The mostimportant audio-editing issue is precisely measuring and setting thelengths of each loop. Accurate loop lengths determine whether the Flashplayer can sync your loop mix.

Flash uses “trigger” sync to synchronize multipletracks; the program starts multiple sounds simultaneously and lets themplay without subsequent resynchronization. If you don't accurately editeach track length, eventually your tracks will drift out of sync,because the downbeats won't properly coincide. Therefore, you must beprecise in how you edit each loop length (see Fig. 2).

Use the following formula to determine the length of a loop insamples, the most accurate unit of measurement for digital sound:

(sampling rate × 60) ÷ tempo =number of samples per beat

Take the real-world example of a four-beat bass loop recorded at 120bpm that uses a 44.1 kHz sampling rate. First, calculate the number ofsamples in one beat:

(44,100 × 60) ÷ 120 = 22,050samples per beat

Next, multiply the samples per beat by the number of beats in theloop to determine the total number of samples in the loop:

4 × 22,050 = 88,200 samples in the bass-lineloop

In your audio editor, delete any extra samples at the beginning ofthe loop and set the selection range to start at 0 and end at 88,200.When you crop the selection, your loop will be the exact lengthnecessary to remain in sync with your other loops as long as you followthe same process with the other loops.

Mix each loop to mono and downsample the loops to 22 kHz or 11 kHzbefore importing them into Flash. Save each edited loop as anuncompressed WAV (Windows) or AIFF (Mac) file.

Flash Bit-Rate Guide

Track Sampling
Rate (kHz)


Flash MP3 Bit
Rate (kbps)


mono and stereo

160 to 80





mono and stereo

56 to 48








mono and stereo




16 to 8

Your last audio-editing task is to create a short, silent 11 kHzsync sound to aid in the synchronization of the loop tracks. By settingthis short track to Sync:Stream in the Flash Sound panel and having itplay before and during the start of the loop tracks (overlapping theother tracks by at least a couple of frames), you can force FlashPlayer to improve its timing consistency. This work-around engages theplayer in Stream mode before the loops start to play so that all thetracks are triggered simultaneously instead of with a ragged start.Save the sync sound with your loop tracks.


Now you are ready to start creating your Flash movie. Start up theFlash authoring software and import each loop and the sync sound astracks in a new Flash movie. The audio files should appear in yourmovie's Library window.

The following steps explain how to set up your movie's timeline. SeeFig. 1 for an example of how your timeline should look. DownloadAudio Example 4 (70slounge.fla) tosee how I set up the sync sound and volume envelopes for eachtrack.

  1. Import each track and the sync sound into Flash.
  2. Create and name a layer for each loop and the sync track.
  3. Add a key frame to the sync-track layer and insert four more framesfor a total of five.
  4. Attach the sync sound in frame 1 of the sync-track layer.
  5. Choose a number of loops in the Sound panel that will extend theduration of the sync sound across all five frames of this layer.
  6. Choose MP3, 8 kbps for stream-sound compression in the Flash tab ofthe Sound Properties dialog box.
  7. Return to the main window, add a sixth key frame to the sync-tracklayer, and attach a Stop action to prevent the entire movie fromlooping and prematurely replaying your mix.
  8. Add a key frame to frame 3 of the remaining layers.
  9. Attach each loop track to frame 3 of their respective layers.


The final part of the conversion process is re-creating the volumemix for each track in the Edit Envelope dialog box (see Fig. 3).At this point, you should have your MIDI sequence and Flash movie openat the same time. Set your sequencer to display time positions in SMPTEtime code.

At maximum zoom, the Edit Envelope display shows time values inhundredths of a second. (Click on the Watch icon to show elapsedseconds.) SMPTE time code shows durations in a similar timing systembased on hours, minutes, seconds, and frames. One frame at SMPTE 30 or29.97 fps is approximately 0.03 seconds. You can determine thecorresponding hundredth of a second position in the Edit Envelopedisplay by multiplying the number of frames in a given SMPTE positionby 0.03. Follow these steps to complete the conversion process:

  1. Set each track to Sync:Start in the Sound panel.
  2. Set each track's loop value in the Sound panel to the same number ofloops as the original MIDI track.
  3. Add handles to the sound envelope in the Edit Envelope dialog box tore-create each track's Volume controller data. Make sure that theenvelopes of both channels are identical.
  4. Choose an MP3 bit rate in the Sound Properties dialog box based onthe sampling rate for each track (see the table, “Flash Bit-RateGuide”).
  5. Listen to an uncompressed version of your loop mix by clicking onthe Play button in the Flash transport. Select Test Movie in theControl menu to hear the compressed version. You can stop sounds inboth modes by selecting Mute Sounds in the Control menu. (For more tipson optimizing your loop mixes, see the sidebar, “FlashyTricks.”)

Deliver your finished Flash loop mix to Flash developers in SWFformat or provide the original FLA file so that they can remix yourmusic in a way that fits the needs of their presentation. Flashdevelopers can load your sound into their existing presentation withoutalteration only when it's in SWF format.

The techniques that I've described are compatible with versions 3.0and greater of Flash Player; the current version is 5.0 (as of thiswriting, version 6.0 is in beta). Flash Player 4.0 (and greater)supports MP3 compression; Flash Player 3.0 supports ADPCM compressiononly. However, the majority of Web users have at least Flash 4.0capability, so most of the time, you can use MP3 compression withoutconcern.

Because of the widespread nature of Flash Player, a potentiallylarge audience exists for your Flash loop mixes, and there is alsocommercial potential for selling music libraries online. In addition,you may want to submit your loop mixes or Web site to Flashsound-collection sites such as Flash Kit ( or Were Here (

Finally, feel free to ask further questions about this topic in theFlash Audio forums that I moderate at (

Hayden Porteris a Web developer and musician whospecializes in sound for the Web. He also writes“Remixology,” a biweekly column published


To get the best results from your Flash soundtracks, follow thesetips.

Audio-Quality Tips

Compression noises are often covered up by other parts in themix.

Downsample before importing tracks into Flash to avoid itspoor-quality algorithm.

Reduce the volume of a track in the Edit Envelope dialog box tominimize compression noise.

Test your mix on typical computer multimedia speakers.

Compression Tips

Bass tracks can be longer and can be compressed more than melody andaccompaniment tracks.

Low-frequency timbres compress more than high-frequency timbres.

MP3 compresses stereo and mono sounds to approximately the same filesize and with similar quality.

Use 3-bit ADPCM 22 kHz compression to improve the quality of cymbalsounds.

File-Size Tips

Faster tempos can shorten audio track lengths and reduce filesize.

Having fewer tracks decreases the file size.

Keep the track lengths short.

Merge MIDI tracks with the same length and volume mix into a singleWAV or AIFF file.

Rely on the mix to create musical variety.

Create more variety with one track by crossfading stereo channels inthe Edit Envelope dialog box.