Snarkpit Articles

HL Sound Files

A perfect mixdown for your ingame sounds.
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 :p) 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.)

Article image


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".

Article image


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

Article image


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.

Article image


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".

Article image

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 :p

Article image

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 :-)

Discussion

Posted by Forceflow on Wed Nov 29th 2006 at 11:33pm
[Author]

The amount of 'hz' is the sample rate for audio. It's how many times you got input bytes on your sound channel. Digital sound never is continuous, you know.
Posted by Le Chief on Mon Oct 9th 2006 at 11:31am

Whats all this stuff about 9919323 hz or whatever. I just open up sound recorder and record with my mic and Play the sounds in game. They Work. But I read it and it was intersting. Good job. Oh wait when I said in game uhhh forget it
Posted by fishy on Thu Nov 18th 2004 at 4:17am

Posted by 7dk2h4md720ih on Fri Jul 16th 2004 at 1:25am

Great to have this tutorial here. I had massive trouble finding one a while ago.
Posted by Forceflow on Tue Jul 13th 2004 at 12:28pm
[Author]

This way, you're not losing much quality either ... but I would like to hear your way too ...

If it's OK for you: send it to me in a PM (a text which is already formatted ... titles, colors, bla bla) and I'll add it to my tut as a note ... ok ? I think it's bettter to have just one tutorial about making HL sounds, instead of 2 or 3 methods ... could be confusing.
Posted by G.Ballblue on Tue Jul 13th 2004 at 1:37am

Excellent ForeFlow! Glad to see a tutorial that gives us mappers the ability to make legit HL sound files!

Extra note: Force, I do however, know of a way to make HL sound files, without losing quality (a,la, music clip) like making a 24 bit sound 8 bit, but losing very very little quality -- almost sounds exactly the same. Should I write a tut, or do you want to add it to your tutorial? (Not trying to steal your thunder :) )
Posted by Orpheus on Tue Jul 13th 2004 at 12:47am

Ok, i don't have gollum here to authenticate this but, the song i put into my map double_trouble was not cued.. and gollums prefab looped it just fine..

course it is entirely possible that the song had cue points already before i changed it to a wav file.. it was a midi file format prior to my getting it though, so you guys decide.

BTW my stupid ass figured out how to make music play so maybe i lucked into it :)
Posted by matt on Mon Jul 12th 2004 at 4:20pm

Just what the docter ordered.
Posted by ReNo on Mon Jul 12th 2004 at 3:21pm

Definately the sort of tutorial worth having, its long overdue I'd say :) Good job mate.
Posted by G.Ballblue on Mon Jul 12th 2004 at 5:54am

You need start cues to have a looped sound, yes.

-Busy working on my map -- I'll try this trick out tomorrow on 1:43 minute DOOM song, and see if works ;)