Porter's World

Audacity Soup For The Game Developers Soul

by Porter on Oct.22, 2009, under Audio, Flash Industry, Help, Programs

Audacity

Audacity

Anyone who works with audio needs a good program. When it comes to game design, audio is incredibly important, and there is always a bit of editing that must be done. Many people are under the impression that they need to pay for expensive audio software, or even hire someone to do their audio work, this isn’t true. Audacity is a free audio program that will cover all the basic needs of a game develop, and with ease. I won’t cover the entire program, but I will go over the basics that a game developer doing sound work will want to know.

Adjusting Volume Levels

An annoying issue that many games suffer, is the lack of unbalanced volumes for sounds. Having headphones on and suddenly hearing an ear piercing sound effect is the last thing your players want, and believe me it happens. To keep your players pleased with the audio of your game, and to allow them to hear all of your sound effects properly, it’s important to balance the volume of your sounds. Doing so in Audacity is incredibly easy; simply open your audio file, highlight the entire sound (or specific parts if you feel like getting fancy for whatever reason), go to Effect, then Amplify. Here you can drag the bar left and right to alter the volume change. Remember that going negative will decrease the volume of your sounds. Test your sound after each adjustment to see if you have the desired volume. I suggest having your music done first, this way you can run the swf and listen to your sound over the music as well. You should also keep your computer volume at a constant volume as go through all your sounds adjusting their volume, this will ensure that in the end, you’ll have a library of sounds that will work well together, and stand out over your music just the right amount.

Cleaning Up A Music Loop

First off, and most importantly, you need quality music to work with. If you’re looking for sources, check out my article on music for games. If you’re taking the free approach, and using music such as that which can be found in the Newgrounds Audio Portal, you’ll likely need to do some editing to the tracks before they’re ready to use. If you download a song from the net, even a loop, you’ll still generally have some work to do, depending on the source. Once you’ve selected a music loop, go ahead and open it up in Audacity. You’ll see no issues at first glance, in fact, testing the loop will sound as if it will loop perfectly; in reality, it will be alright, but nowhere near perfect. If you click on the magnifying glass tool, found on the top left in Audacity, you can zoom in on the sound waves to get a closer look. Take a look at the very beginning and end of your audio, you’ll find that there’s a straight line of absolute silence; even if this is 1/5 of a second, it’s going to show (You may have to zoom in multiple times to see this). Zoom in as much as needed and remove the silence as best as possible be selecting it with the mouse, and pressing delete. Do this to the end of the loop as well, removing any silence found at the end of the track. Now for the testing phase. Highlight the entire track, then press Ctrl + C to copy it. Now click on the two arrows pointing to the right in your playback toolbar, this will take your current selection tool to the end of your track. Paste the entire track by pressing Ctrl+V. You should now have a file with your loop copied twice, the copy starting immediately at the end of the original loop. If you successfully removed the silence at the beginning and end of your loop, you should be able to play the sound file and hear absolutely no hiccups in the middle where the repeat is taking place. If the loop still doesn’t sound right, and you’re certain you removed all the silence and copied the track correctly, it’s safe to say that the “loop” you downloaded wasn’t the greatest loop after all. If all went well, press Ctrl + Z until the copy of the loop is removed (this was only needed to test that it does indeed loop). You now have an excellent loop and are good to go, be sure to save the file as a .WAV as well as .mp3, having both is always a great idea. If you’re using flash, you’ll want to use the .WAV file, this will ensure a perfect loop after flash compresses your file to an mp3. If you’re using something else, such as FlashDevelop and Flex to compile, you’ll be forced to use a .mp3 file since .WAV’s aren’t supported. There is a work around for this, however that’s a bit complicated and will be a different post for a different day. All in all, if you’re using flash, use the .WAV file and you should be good to go.

Creating A Loop From A Non-Looping, Full Length Track

If you’re not finding an existing loop with the feel you’re looking for, worry not. Many non looping songs will have portions of the song that can be taken out and turned into a loop, doing this is actually a common task for me, and I find it rather effective. This is where the true power of an audio editing program comes in, you can get some quality loops in a short time, without spending a cent. Take a look at the song Cobalt Blue Sphere, notice how long the song is, and the fact that it isn’t a loop. Now take a look at one of our past games, Gravibounce, created by Andrew and myself of Epic Shadow Entertainment. Go back to Cobalt Blue Sphere on Newgrounds, and listen to the song from 3:58 – 4:25. As you’ll see, this is the portion of the song that you hear in Gravibounce; it was cut out using audacity. Another example of me doing this is in my first solely developed game, Dominus Void. The song “Lost”, by Ryan Stevens, or Reasoner as he’s often referred to as, was edited by myself to be a title screen loop, it came out rather well. With a good ear, some patience, and a free program like audacity, you too can create great loops such as this. This is far more complicated then simply removing the silence before an already created loop, but it gives you a track that nobody else has ever used, and one of great quality. The trick is to listen to the song closely, and use your ear to find a portion of the song that can loop into itself. When you’ve located the proper position, roughly cut out everything before and after the portion of the song you’ll be using. Be sure to give yourself some extra wave length, this is a good idea seeing as you can remove whatever you want, but you can’t add to the file once you’ve removed too much. Zooming in during the editing process will also give you much more accuracy over what you delete, and you can often see where the new measures starts due to the visual increases in wave length. Use your ear and closely narrow the intro down to the first beat of a measure, this is usually pretty easy to determine in a song, unless it’s something with a tremendous amount of percussion. Once you’ve got the intro down, edit the end of the file so that it ends at the end of a measure, this is usually after 4 major beats as most music is in 4/4 time. Be sure to slice only a little off at a time, then use the testing method as mentioned earlier. Count the beats as the loop plays, if it hiccups before the 4th beat plays, you’ve cut too much off, if it plays a little bit passed the 4th beat, you’ve still got a little more cutting to do. This is an advanced technique, and takes some practice, but it can produce some pretty awesome loops, ones that only your game will have at that. As a rule of thumb, always ask the artist if you can edit their work to create a loop, and always give them credit for their original piece.

Cutting Down A Sound Effect’s File Size

Audio is by far the biggest contributor to flash game file size. Although there are a number of compression options to reduce file sizes for audio, there are also a number of techniques that can be done before the files are even imported into your game’s library. One of the most simple, and effective, is to cut the length of your sound effects. If you open up many of your sound effects in audacity, you’ll notice that the sound waves die out, and trickle for some time, often times doubling the wave length of a sound. Although there is indeed sound going on here, you often times can’t hear it, especially over music. To greatly reduce the file size of effects, simply cut off these trickling endings bit by bit. Each time you cut, listen to the sound to ensure that quality isn’t lost, if it isn’t, cut some more. You’ll be surprised at how much of a sound wave can be cut off before any audible changes occur. Using this method on your entire library of sound effects will greatly reduce your file size, making for quicker load times, and in the end, happier players.

Correcting Audio Files

Ever had an mp3 file that flash just wouldn’t accept? The reason for this is most likely that your mp3 file has a bit rate that flash doesn’t support. You can check the bit rate by right clicking on your sound file, going to properties, then to summary. If the bit rate is not one that is shown on chart below, you’ll likely encounter problems. The good news is, you can simply import your audio file into Audacity, then export it as an mp3 again; this will change the bit rate to 112 kbps, the default bit rate for mp3’s in Audacity.

Accepted mp3 Bit Rates

Bit Rate Chart, Source: Articulate Blog

Conclusion

That’s a lot of power for a free audio program, respect to the authors for such an awesome program. Aside from the above, you can do plenty of other complex variations to your audio files. Some of these include pitch changes, tempo changes, adding echo, adding reverberation, bass amplification, and more. Audacity may not be a full fledged audio program, but it definitely has what’s needed to take care of your basic audio editing needs, and that should be enough for any flash game developer.

Find this useful? Share it with others:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • StumbleUpon
  • Technorati
  • Twitter
:, , , , , , , , ,

4 Comments for this entry

  • colin

    hey porter,
    just wanted to say thanks for your audio links (sfxr is amazing!!), and for your kind comments on my actionscript video at insideria.com. if you ever want to make your games multiuser, i’d love to see you using Union! see http://www.unionplatform.com.

    colin

  • Draknek

    If you’re using something else, such as FlashDevelop and Flex to compile, you’ll be forced to use a .WAV file since mp3’s aren’t supported.

    I believe this is the wrong way round: wav files aren’t supported so you have to use mp3. Bizarre and annoying, but for Linux developers there’s not much choice.

  • Porter

    Thanks for correcting me, you are correct. It’s the WAV’s you want to use, not the mp3, I finished this up pretty late last night hehe. Thanks for catching that, and for reading.

  • rosedragon

    Once again after 1000 times I have to say you can get perfect mp3 loop without having to use the bloaty wav. Here is the trick:
    - add 0.1/0.01 second silence in beginning and end of the music. Normal persons won’t hear this, just audionerds do.
    - don’t encode the music. (I use goldwave audio editor for this, I don’t know how audacity works after it refuse to save without lame mp3 encoder)
    - put into flash, let flash do the compression.

    These will make sure that there is no automatic 1s silence added to your musics.

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...