Snarkpit Articles


Sound is a very important factor in the development of your mod/level. A little sample of your favorite song (as a gimmick), background music for your level, or HUD-sounds for your mod ... could boost the game experience and the overall atmosphere.

HL sounds have to meet the following requirements in order to work (some mods have support for other formats, I'll explain that in the "exporting" section.):

Mono, 8-bit, 11025 Hrz, PCM Compression.

(additional requirements are: Unsigned, one start cue, but the method we'll be using will make those 2 problems impossible, so don't even bother.)

The program I (and you smiley) will be using is Audacity. It's a freeware sound editor, and it's perfect for this kind of stuff. (editing/mixing down small audio samples). Get it at http://audacity.sourceforge.net

Loading up your sound file



Start Audacity. I'm using the default english interface. (if you're using another language, better switch to english by using file->preferences->"interface" tab)

To load your sound file, choose Project->Import audio (or hit CTRL+I).(it can be an MP3 or a WAV or any other sound file, we'll export it to the right format anyway.) Browse to your sound file and open it. The waveform will appear on your screen.

Let's see how the sample is formed now, and what there's left to change. As an example, I used a sound file where everything still needs to be changed. (I'm using the song "Snake" by the Audio Bulleys.)



As you can see, there's still some work to do. The song is too long for a sample (I only want the first 15 secs), it's still in stereo, the sample rate (in Hz) is too high and it's still a 32-bit sound.

Cut your sound file first, if necessary. (just select the part you want to cut and hit DEL).

Convert to Mono



Ok, a stereo track has 2 channels. How do we mix them down to 1 channel without losing any important audio data ?

Step 1: Hit the arrow at the song title and choose split stereo track. The track will be split into 2 samples, called "left" and "right".



Step2: Now, hit the "left" track arrow, and choose mono.



Step3: If we mix these 2 tracks together to one mono track, we will have used both stereo channels and we will not have lost any data. Select both tracks (use your mouse to select the waveforms), and use Project->Quick Mix to mix them down to the mono track.



OK, our track is Mono now (and titled "mix", too). On to the next step.

8-bit, PCM Compression



This is just a simple change to the Audacity preferences.
Open up the Preferences window by using file->preferences (or hitting CTRL+P).
In the "file formats"-tab, select "WAV (Microsoft 8-bit PCM) in the list under the item "uncompressed export format".



11025 Hrz



This is a tricky part.
Again, use the arrow at the song title to change the rate to 11025 Hz. At the bottom right corner, there also is a slider called "project" rate, set it to 11025 too. Audacity sets the rate, but the sample gets screwed. (it plays more slowly.)

Luckily, this is easy to fix. Use effect->change speed, and set the speed so the lenght matches your original sample.

In my case the sample got a new length which is four times the length it originally had. (because 44100 divided by 4 is 11025, got it ?), so I'll have to speed op the sound by 300 % to get my original sound back. (most of the time, you will also have to set this slider to 300 %). Just use windows calculator, goddammit smiley



Exporting



Everything is set and ready to mix down, so we'll export our sound file now.

Use File->export as WAV. to save your file.

NOTE: Some mods, like the upcoming Nightwatch mod, will have support for other file types too, like OGG's. Audacity has a feature for this too: file->export as OGG vorbis. Just a tip smiley


Post ReplyView Topic
Discussion
0 starsPosted by Campaignjunkie on Mon Jul 12th 2004 at 3:44am

I was under the impression that you also needed to set up cue points for the .wav file so that it can loop properly. Almost every other custom sound tutorial I've seen states this quite implicitly. But maybe Audacity does it automagically, or it actually isn't neccesary? Still, something worth investigating. Nice presentation anyways.
0 starsPosted by fraggard on Mon Jul 12th 2004 at 3:22am

Excellent stuff.
0 starsPosted by Ferret on Mon Jul 12th 2004 at 3:01am

One of the better tutorials! WOnderful job forceflow!!!!!
0 starsPosted by Gwil on Sun Jul 11th 2004 at 9:08pm

Well presented, clear and straight to the point smiley Good stuff Forceflow, and extra kudos for covering an area that's usually neglected or little is known about.
Post ReplyView Topic