Sound Design for Flash Games

If you want your Flash games to shine above all others, you really should focus on the sound as much as you focus on game play and graphics. Great games have great sound. There are a couple of ways you can go about achieving awesome audio. I will show you a quick way to achieve dynamic audio and create a virtual world of sound.

Challenged with creating a football game from scratch for a RIM project I was working on, I found myself needing to create realistic audio that would be triggered dynamically. Here are some common place practices I use to do my own audio at home.


First you’ll need a USB or Firewire audio recording device. Personally I use an old Motu 828 Firewire, but any of them will do. The major difference in price point is the amount of simultaneous tracks the device can record and whether or not each channel has its own power source. For the purposes of this tutorial, a $29 usb recording device will suffice.

Secondly you’ll need some software to record the audio into. You can probably pick up a bunch of free stuff online but It may be limited. I use a professional recording system. This may be overkill for you, but I prefer at least prosumer recording software for a number of reasons. If you have Adobe Master Collection, Soundbooth CS/CS4 is perfect!

Sound Libraries
There are so many sound libraries available for free online, in the discount bin at your local music store and in the back of old Electronic Musician magazines that it really pays to spend some time building your own source library. If you’ve ever had a sampler back in the day then you probably already have some files around on floppy disk…el o el.

To the Internets!
If you plan to download sounds off the internet and use them in your game unaltered you will not be creating as an original experience and in fact, if the sounds are recognizable, you will only diminish the uniqueness of your game. However, sometimes you cannot grab a mic and record 70,000 cheering fans at a football game (as was my case) and that is where the internet becomes invaluable.

I like to to see what I can get out there for free – that is already done that I wouldn’t be able to record myself. I have a couple of pay sound source sites I like…keep in mind, you get what you pay for, so free is usually bottom of the barrel. Often, like images you need to pay to get quality sounds.

How to record sound off the internet
While it is easy to download an FLV from You Tube and extract the audio, it is not so easy to extract audio from other websites that have sounds you may want to “sample”. By no means do i recommend going to a pay site and extracting sound using these methods, because that would be like stealing from your peers. However, some people are kind enough to share their cd libraries on You Tube and other sites and it may just be faster to record the parts you want digitally using the methods listed below. In my particular case I was able to find plenty of college bowl games that had fantastic crowd sounds because they were recorded by fans.

    1. Go to the website and ready the sound you would like to “sample” in a previewing state. If the site has sound in Flash, you’ll be able to preview the entire sound or completely download it in mp3 or wav format. If it is a pay site it may have a watermark during preview and you will not be able to download the FLV, SWF, MP3 or WAV until it is purchased.

    2. Go to your OS control panel and set your sound on Internal Sound Out. Use your internal sound card and not your Audio Recording Input Device to listen to the sounds. Run a splitter or converter from your internal sound card so that you end up with sound coming out of the card and into your USB/Firewire recording device.

    3. Go to your recording software and set up a Bus Line In from your USB/Firewire recording into a clean track.

    4. Adjust the level of the incoming audio so there is no digital clipping.

    5. Start Recording.

Tip: If you are using good software that allows for multiple tracks, buses and other amenities, then create a project and create individual audio tracks for each separate source with its own ins and outs and of course processing and effects. Later on you can process each track in its place to create a virtual environment by adjusting volume, using panning and effects.

How to record your own sounds in your home or on the road

    1. Hook up a mic to your USB/Firewire device.
    2. Plug your USB device into your laptop if it isn’t already.
    3. Go to your recording software and set up a Line in Bus if there isn’t one already set up for you.
    4. Pull down the USB device from the list of available microphones for your Line In Bus.
    5. Make and audio track.
    6. Name the track and activate record.
    7. Record.

Sound processing:

Processing the sounds can take an entire day, and in fact they should. I would have to write an entire tutorial on this process alone so I would suggest you do some separate reading on the topic.

That said, I will give some simple tips for pro audio.

    1. Use compression and gate on anything you recorded yourself using an external microphone.

    2. Next try to find some reverb settings that fit the environment and apply it to the necessary tracks. Remember, distant sounds should have a larger plate opposed to closer sounds that should have a smaller plate. This will create distance in your audio.

    3. Finally use panning and volume along with the effects to create a realistic environment.

Once I had several crowd reactions recorded across several tracks it was time to start making them seem like they belong together. I set up a composition that was about 12-15 seconds long. Usually with Flash Games I create a loop track for ambiance and then trigger applicable sound fx when something happens in the game.

Because my sounds were recorded from different sources, they seemed to collide with one another when played back together. The also varied in quality. Some of them had digital clipping but were perfect for what I wanted.

The process of taking the different sounds and mixing them is important when you are getting your sounds from different sources. Unless you have recorded everything yourself with the same microphone in the same studio settings, you should take the time to do this. Again this is where the software with multiple tracks comes in. This allows you to blend your sounds together using panning, volume, processing and digital effects. See Fig 1 (below).

Fig 1

With a virtual mixing board you can blend your sounds from different sources together and make note of panning and volume settings. Listening to this is like monitoring what your game will sound like well before its even finished being coded.

Exporting sounds and triggering them from your Flash game
I like to keep something looping for ambiance so lets work on that first. In this particular case, instead of it being video game music the ambient sound is actually a crowd murmur.

    1. taking a cross section of your soundtrack and muting some of your triggered sound fx, export the tracks that you feel make a good ambiance loop. This may be something like a music track (adult swim is catching on to my idea) or in my case, static crowd noise.

    2. export each sound effect as a separate mp3. The sound should match the length of your timers or at least not work against your timers.

    3. Create a document class file in CS3/CS4 to handle all of your sound in Flash.

For my project I created a loop of crowd noise that was about 6 – 9 seconds long from various you tube crowd clips and exported it to an mp3 file. Then I exported each range of crowd emotions from Cheers-to-Boos and several stages in between. (Also captured were PA announcers with color commentary and Quarterbacks screaming offensive audibles.) All this was structured in a Cubase 4 composition which had labels set in the tracks to match on the timers in my game.

Once I was happy with the overall playback, I started exporting each sound separately as MP3 files to be brought into Flash.

I’ve covered streaming audio online from Flash in other tutorials. For games I usually import the audio directly into the Game.fla file and set it up as a Class. Once there I trigger the sound class from a document class file. This file sort of acts as a keyboard-sampler class of sorts that triggers whatever sound it is instructed to trigger from the game class.

Below is a simple class file that shows the basics of how this can be achieved. It should be kept in mind that this file shows no example of sound transforming, which is where you would do your panning and volume. I believe I’ve covered this in previous tuts so I’m just going to gloss over it here.

  1. package {
  3.  // imports
  4.  import flash.display.*;
  5.  import;
  6.  import;
  7.  import;
  10.  // class that creates a spatial stadium experience
  11.  public class SoundFX extends MovieClip {
  12.   // Variables
  13.   //import SOUNDS from library
  15.   ////////////CROWD///////////////
  16.   // crowd loop (bottom layer of crowd layers)
  17.   public var _crowdloop:crowdloop = new crowdloop();// var name:exportedclassname = new exportedclassname
  20.   //cheers
  21.   public var _crowdcheer:crowdcheer = new crowdcheer();
  22.   //roar
  23.   public var _crowdroar:crowdroar = new crowdroar();
  24.   //boo
  25.   public var _crowdboo:crowdboo = new crowdboo();
  26.   // gasp
  27.   public var _crowdgasp:crowdgasp = new crowdgasp();
  30.   /// Create SOUND CHANNELS
  31.   // create a channel for crowdnoise
  32.   public var CHAN_crowdnoise:SoundChannel = new SoundChannel();
  34.   // Constructor Function
  35.   public function SoundFX() {
  38.   }// end constructor
  40.   public function startCrowd():void {
  41.    // play crowd loop
  42.    CHAN_crowdnoise =,10);// start, loop
  43.   }
  45.   //////// Game Methods [or]////////////////
  46.   //////// Triggered Sounds//////////////
  48.   public function playSound(s:String):void {
  49.    var snd:String = s;
  50.    // FX
  51.    if (snd == "crowdcheer") {
  52.     CHAN_crowdnoise =,0);
  54.    } else if (snd == "crowdroar") {
  55.     CHAN_crowdreaction =,0);
  58.    } else if (snd == "crowdboo") {
  59.     CHAN_crowdreaction =,0);
  61.    } else if (snd == "crowdgasp") {
  62.     CHAN_crowdreaction =,0);
  63.   }
  64.  }
  67.   }
  69.  }// end class
  71. }// end package

From your game class you would call the class by using it’s playSound() method and using the parameter (String) as a means of triggering whatever sound you want.

Hopefully this gives you some insight into creating rich sound – on a budget – from scratch – for your Flash games and other RIM projects.

Posted on March 27, 2010 at 4:33 pm by Runtime · Permalink
In: ActionScript 3, Flash, Games, OOP, Tutorial · Tagged with: , ,

Leave a Reply

You must be logged in to post a comment.