L4D2 Custom Sound and Music Tutorial
Introduction
Adding custom sound and music in a Left 4 Dead 2 map appears to be more flexible than Left 4 Dead (no random sounds, screeching, sound length requirements, strict sound file requirements). The following tutorial will first get in-game sounds to work followed by customizing existing in-game events/sounds (such as music and sound effects).
It is recommended to start with at least the following:
- A map that can be loaded in-game named however you like - maps/<map name>.bsp
- A blank per-map soundscript (a .txt file) named maps/<map name>_level_sounds.txt
Sound File Requirements
The following file types and specifications have been known to work:
- .WAV - 22 Khz and 44 Khz - Mono and Stereo
- .MP3 - 128 Kbps - 22 Khz and 44 Khz - Mono and Stereo

There are a lot of great free and trial third-party programs for audio conversion.
Preparing the Files
First convert the audio file to a file type and specification that you may consider to work (or use the recommended specs). In most cases, it's just copying over audio files or embedding them.
MP3 Method
.MP3 sound files will play in-game if they are added in the sound/music/<folder or no folder> folder and do not need to be embedded to work in-game or when shipping a VPK.

Embedded BSP Method
Custom .WAV files must be embedded in a BSP to work and when shipped as a VPK, but they can be placed anywhere, preferably under the sound folder for the internal path. Third-party tools like Pakrat currently do not work with L4D2 BSP files.

Create a list of files you would like to embed C:\Program Files\Steam\steamapps\common\left 4 dead 2\bin\<listfile>.txt:
internal_path\file1 external_path\file1 internal_path\file2 external_path\file2 ...
- Internal paths ('relative paths') are the location the file will take within the BSP, e.g.
materials/metal/new_steel.vmt
. - External paths ('full paths') are the location of the file to be packed, e.g.
C:\Users\Public\our_maps\materials\metal\new_steel.vmt
.

- It is recommended to copy the <map name>.bsp to C:\Program Files\Steam\steamapps\common\left 4 dead 2\bin (Windows 32-Bit, default)
- Open the Windows Command Prompt, preferable with administrator privileges.
- Go to bin directory containing bspzip.exe:
cd C:\Program Files\Steam\steamapps\common\left 4 dead 2\bin
- Embed the files with the following commands:
bspzip -addlist <bspfile> <listfile> <newbspfile>
Tip:You can quickly select your file in command prompt by typing in the first letters of <map name> and hit
TAB
to cycle through file names - If BSPZIP is looking for gameinfo.txt try:
bspzip -addlist <bspfile> <listfile> <newbspfile> -game "C:\Program Files\Steam\steamapps\common\left 4 dead 2\left4dead2"
Creating the Soundscript
Open <map name>_level_sounds.txt with a text editor.
Soundscript Entries
An entry can be played in-game via console or entity, such as ambient_generic or ambient_music. An example entry:
entry.name { channel CHAN_AUTO volume VOL_NORM pitch PITCH_NORM soundlevel SNDLVL_NORM wave common/null.wav }
If a value has a space or tab character within it, wrap it in "quote marks".
Examples
Ambience.Siren { channel CHAN_WEAPON volume VOL_NORM pitch PITCH_NORM soundlevel SNDLVL_NORM wave siren1.wav }
Arbitrary.Song { channel CHAN_AUTO volume VOL_NORM pitch PITCH_NORM soundlevel SNDLVL_NORM wave music/singalongsong.wav }
Foo.Song_mp3 { channel CHAN_STATIC volume VOL_NORM pitch 100 soundlevel SNDLVL_NORM wave music/songalongdong.mp3 }
Testing In-Game
By Console
- Open <map name>.bsp via console
map <map name>.bsp coop
- Test out the sound via console
playgamesound entry.name
By Entities
- Create an ambient_generic, ambient_music, or any other entity that has a property that requires a sound name
Tip:For ambient_generic, test out the sound before changing the default flags
- Change the targetname and change sound name to the soundscript entry of your choice
- Optional: create an entity that will trigger the sound, if necessary
- Open <map name>.bsp via console
map <map name>.bsp coop
- Test out the sound via console command:
ent_fire <ambient_generic targetname> PlaySound
Customizing Existing Sound and Music
Official Sound and Music Uses Soundscripts
All official in-game sound effects and music rely on soundscripts to tweak the sound to the correct channels, volume, pitch, etc. With <map name>_level_sounds.txt, you can customize those entries without causing conflicts with other addons and the official campaigns. Simply copy the entries you would like to change to the per-map soundscript.
Soundscript entries can be found in the scripts/game_sounds_*.txt folder by opening pak01_dir.vpk with GCFScape.
A lot of music entries rely on Map Properties, Post-Fix String and nav mesh attributes. For example, the Post-Fix String of the map c5m1_waterfront.bsp is "BigEasy" and it plays its style of intro music in-game, where the nav mesh is marked PLAYER_START
and CHECKPOINT
.
Interesting Soundscripts
They're all interesting, but here are a couple of them:
- game_sounds_music.txt provides great sample soundscript entries for music. Some entries string together different notes of the same instrument and are played randomly in succession.
- game_sounds_physics.txt has entries for sounds that play during in-game interactions, such as a walking on snow or shooting a concrete wall.