Left 4 Dead 2

Left 4 Dead 2

123 次評價
Bug-Free Custom Sounds
由 Zaeryn 發表
Tired of your speakers/headphones screaming at you, random chipmunk and demon voices? There is currently only one correct way to replace the sounds and this guide will show you how.

   
獎勵
加入最愛
已加入最愛
移除最愛
Stuff You'll Need
  • Audacity
    [audacity.sourceforge.net]
  • Default sound folder and cache

You need the default sounds and cache for this to work.


Navigate to
Steamapps/common/Left 4 Dead2/left4dead2/sound
If you've modified any sounds within this folder, or you've rebuilt/updated the sound cache, you need to re-download it.


In Steam, right-click Left 4 Dead 2, select properties, then the "Local Files" tab and select "Verify Integrity of Game Cache". Your sound folder should automatically re-download.
Video Tutorial

For those who prefer a visual aid, here's a fairly old video recorded with my crappy old mic.
The Basics
The general rule of L4D2 sound replacement is your sound should match the original in almost every way. Your replacement must:
  • have the same sample rate as the original (mostly 44100hz, occasionally 22500)
  • be the same length as the original
  • have the same # of channels (mono or stereo)
  • be exported in the format .WAV (Microsoft) signed 16 bit PCM


In Audacity, you should always start by importing the sound you want to replace. This makes sure Audacity uses the sample rate you need. You can use File > Import or simply drag and drop a sound into Audacity. Next, import a new sound or two; whatever you want to replace the original.


You'll also want to mute the original sound so you can hear the new one, and so they don't get blended together in export.
Long Replacements

What if your new sound is longer than the original? That's a problem, so select the extra length and delete it.


You might also notice that our sound is mono, whereas the old is stereo. If that's true in your case too, select all of your sound, then choose Edit > Duplicate from the menu.


Next, click the small black arrow at the left of your new track and select "Make Stereo Track".




What if your sound was way too long like this? You don't want your sound to cut off suddenly.


So select a portion of it and choose Effects > Studio Fade Out (plain "Fade Out" works fine too) and you'll see the waveform gradually shrink near the end. Experiment with the amount of sound you fade; whatever sounds best to you is what you should use.
Short Replacements
What if your replacement sound is shorter than the original?


That's also a problem. Select the silence gap between the new and original sounds, then select Generate > Silence from the menu. You're essentially filling in the "blank" so that your replacement sound matches the length of the original.
New Sounds
If you're making new sounds (not replacements), this is for you. Unfortunately, due to L4D2's sound system, you can only add new sounds to custom maps.

The rules here are a lot more lax, but a few basics still apply. Your sounds must be exported as either:
  • 44100 hz 16 bit PCM WAV files with mono or stereo channels
  • 44100 hz 128kbps (constant bitrate) MP3 files with stereo channels.

MP3's have a much lower file size, but cannot use certain sound script features like looping.
And technically, you can use 22500 hz, but why would you want a lower quality?
Anyway, the length should not matter.

Export your sounds and place them in an addons subfolder. For example: steamapps/common/Left 4 Dead 2/left4dead2/addons/my_sounds/sound/my_map/poopscoop.wav

Now, create a "maps" subdirectory in your custom addon folder, then create a new .TXT file and name it "YourMapNameHere_level_sounds". You should replace "YourMapNameHere" with the name of your map's VMF file/s (not the campaign name). For example, my survival map "Gunkanjima" uses the VMF "ttt_gunkanjima_v2", so I'd create "ttt_gunkanjima_v2_level_sounds.txt". If you have more than one VMF, create one for each. Anyway...

Within this text file, you add your sounds.

This is a single entry.
"Poop.Scoop" { "channel" "CHAN_WEAPON" "soundlevel" "SNDLVL_GUNFIRE" "volume" "1.00" "pitch" "100" "wave" ")weapons/poopscoop/fire_1.wav" }

Now, let's go into detail.

Poop.Scoop - Sound event. Name this whatever you want. This is how the engine calls for the sound, not the wav filename. You can trigger this sound only through map entities such as ambient_generic, and can test it ingame by loading up your custom map and entering in the console "playgamesound Poop.Scoop".

channel - What channel of the sound mixer this plays from

soundlevel - How long it takes for a sound to "fade away" and how far off it can be heard

volume - Relative volume. 0.00 is silent, 0.50 is half, 1.00 is full.
If you write it this way, the volume changes randomly between the two values:
"volume" "0.50,0.60"

pitch - Pitch of the sound in a range from 0-255. 100 is the original; anything lower... lowers the pitch, anything higher increases it. Write it like so to create random pitches (great for gunfire):
"pitch" "90,110"

wave - path to a WAV or MP3 file, relative to its root directory.
For example, if you use "weapon/poopscoop/fire_1.wav" as the path, make sure fire_1.wav is in your addon folder's sound/weapons/poopscoop directory. That little bracket ")" at the start of the filepath is a "Sound Character" which tells the engine that sound file has special attributes. Read more about these on the Valve Developer Wiki.

You can also make one sound event play randomly from a list of several sound files. Do it like so:
"rndwave" { "wave" ")weapons/poopscoop/fire_1.wav" "wave" ")weapons/poopscoop/fire_2.wav" "wave" ")weapons/poopscoop/fire_3.wav" }

Have a look here for more info on soundscripts.

When those new sounds are placed in your addon subdirectory, fire up L4D2, bring up the console with ~ and enter "snd_buildsoundcachefordirectory addons/YourAddonFolderHere". A sound cache will be generated for your addon, not for the root game. Now you can pack it into a VPK.
Finishing Up
Let's get down to business (to defeat... the Huns!)

Once everything checks out in Audacity, hit File > Export. Select as the format "WAV (Microsoft) signed 16 bit PCM", make sure you retain the original sound's filename and hit save.

Now, let's open your addons folder. Navigate to
steamapps/common/Left 4 Dead 2/left4dead2/addons
Let's create a new folder here. I'll name it MyAddon for the sake of simplicity. Open that folder and create a new one called "sound". Here's where you'll need to replicate the directory structure of whatever sound you're replacing. For example, since I'm replacing melee_tonfa_01.wav, I need to place the new melee_tonfa_01.wav inside MyAddon/sound/weapons/tonfa.

For non-replacement sounds, you can name your WAV/MP3 whatever you want, and choose or create any directory inside MyAddon/sound. Placing a sound file directly inside "sound" won't work.

After that, all you have to do is pack "MyAddon" into a VPK. Open a new window and navigate to steamapps/common/Left 4 Dead 2/bin, find vpk.exe, right-click it and choose "Make shortcut" or "send to desktop". Now copy-paste this shortcut into your addons folder. Now whenever you want to turn a folder into a VPK, you merely need to drop that folder onto the shortcut, so... do that.

But wait! What if your replacement still pops/cracks/bugs out? It's a rarity, but still happens. In the event, that your sound lengths/channels etc. match up perfectly with the originals but this still happens, try generating a tiny amount of silence (maybe a half second) at the end, to extend it slightly past the original's length.

Aaaand... we're done!


Final word: Don't rebuild/update the game's sound cache or replace anything within the root sound folder. Do that and you'll get bugs. You should only add sound replacements or new entries to VPKs.
20 則留言
Bioshiff 2023 年 1 月 6 日 上午 5:57 
how to make incap/hangging sound?? stereo i cant make it not working
Nate Ward 2022 年 4 月 18 日 下午 8:46 
Hey thanks mang, had you not mentioned I had to pack the add-on I would've never realized and wouldn't have gotten my custom music to work. This really helped
Lisan Al Gaib 2021 年 6 月 16 日 上午 9:39 
You can't
That glitches the game and causes the screeching noise
Trinity 2021 年 5 月 10 日 下午 11:03 
Still wondering how I can make sound mods that are longer than the original
Trinity 2021 年 2 月 20 日 上午 7:13 
how can i make sound mods that are longer and or shorter than the original
Joey Roach 2021 年 1 月 8 日 上午 9:14 
This guide was very helpful. Thanks!
Hatty 2018 年 9 月 26 日 下午 12:07 
Whenever I make a sound for the my mods, they sound quiet, I've been trying to crank up the volume with them, but they are still quiet
Dr. Gordon Freeman, Ph.D 2017 年 11 月 9 日 下午 8:52 
Thx :)
Manimerken 2017 年 11 月 5 日 下午 8:47 
how can i include a script in a weapon soundmod.vpk to randomly pick between 3 .wav files. Is it even possible?
Dr Dinosaur 2016 年 8 月 7 日 上午 5:33 
This helped. Thanks.