Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds

Members Online

»
0 Active | 99 Guests
Online:

LATEST FORUM THREADS

»
CoD: Battle Royale
CoD+UO Map + Mod Releases
Damaged .pk3's
CoD Mapping
heli to attack ai
CoD4 SP Mapping

Tutorials

»
Left 4 Dead
ratings:
Awful Rating
Poor Rating
Average Rating
Good Rating
Excellent Rating
Adding Custom Sound and Music
Versions: You must be logged in to view history.

How to add custom sound and music in a Left 4 Dead 2 map.

It is recommended to start with at least the following:

  1. A map that can be loaded in-game named however you like - maps/ .bsp
  2. A blank per-map soundscript (a .txt file) named maps/ _level_sounds.txt

Sound File Requirements

The following file types and specifications have been known to work:

  • .WAV - 16-Bit - 22 Khz and 44 Khz - Mono and Stereo
  • .MP3 - 128 Kbps - 22 Khz and 44 Khz - Mono and Stereo
Note:You can test out other specifications. These are just confirmed to work.
Note:Sound loops might be dependent on .WAV file type

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 and do not need to be embedded to work in-game or when shipping a VPK.

Note: .MP3 files are a lot smaller than .WAV files, but they require more processing power and therefore lowers either client or server performance

Embedded BSP Method

During development, a custom .WAV file can be played on a test computer without the need to embed it within .bsp . This is done by updating the sound cache via console:

snd_updateaudiocache

The in-game menu will freeze up temporarily and will eventually output results regarding the sound cache update.

Custom .WAV files should be embedded in a BSP when shipped as a VPK. The files can be placed anywhere within the BSP, preferably under the sound folder for the internal path. Third-party tools like Pakrat currently do not work with L4D2 BSP files.

Note:Successfully playing a custom .WAV file in-game will update the client /maps/soundcache/_master.cache. As a result, the sound file embedded in the BSP can be played by any other BSP after such a change. This can potentially save space if multiple BSP files use the same sound files. Although, getting the user to play the sound once and then restarting the client can be inconvenient.

Create a list of files you would like to embed C:Program FilesSteamsteamappscommonleft 4 dead 2bin.txt:

internal_pathfile1
external_pathfile1
internal_pathfile2
external_pathfile2
...
  • 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:UsersPublicour_mapsmaterialsmetalnew_steel.vmt.
Note:The internal path should be typed exactly as shown in the example. Use of forward slash ("/") instead of backslash ("").
  1. Copy .bsp to C:Program FilesSteamsteamappscommonleft 4 dead 2bin (Windows 32-Bit, default)
  2. Open the Windows Command Prompt, preferable with administrator privileges.
  3. Go to bin directory containing bspzip.exe:
    cd C:Program FilesSteamsteamappscommonleft 4 dead 2bin
  4. Embed the files with the following commands:
    bspzip -addlist   
    Tip:You can quickly select your file in command prompt by typing in the first letters of and hit TAB to cycle through file names
  5. If BSPZIP is looking for gameinfo.txt try:
    bspzip -addlist    -game "C:Program FilesSteamsteamappscommonleft 4 dead 2left4dead2"
  6. Optional: You can see if the files have been embedded in the proper internal path by extracting the BSP or viewing the BSP with GCFScape. Note that this is not a way to check if the internal paths are in correct format (the use of slashes).

Creating the Soundscript

Open _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

  1. Open .bsp
    map  coop
  2. Test out the sound
    playgamesound entry.name
  3. In most cases, if a sound refuses to stop playing, stop the sound
    stopsound

By Entities

  1. Create an ambient_generic, ambient_music, or any other entity that has a property that requires a sound name
    Tip:For ambient_generic, if the sound file is programmed to loop (the actual sound file itself), then un-check the flag "is NOT looped" in order to be able to stop the sound from continuously looping with input StopSound. Ambient_music does not have this flag, but it is not necessary.
  2. Change the targetname and change sound name to the soundscript entry of your choice
  3. Optional: create an entity that will trigger the sound, if necessary or desired
  4. Open .bsp via console
    map  coop
  5. Test out the sound via "trigger entity" or console command:
    ent_fire  PlaySound
  6. In most cases, if a sound refuses to stop playing, stop the sound via console
    stopsound

Customizing Existing Sound and Music

Official Sound and Music Uses Soundscripts

All official in-game sound effects, vocalizations, and music rely on soundscripts to tweak the sound to the correct channels, volume, pitch, etc. With maps/ _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.

Updating Your Custom Sounds

When Valve ever adds or updates any of their sound files, may it be a change in the contents, length, loop position, etc, all they would have to do is include a new soundcache. This is not the case for custom add-ons.

The first time a custom sound is played in-game, /maps/soundcache/_master.cache is updated to include information about the sound file, such as the file location and a small portion of the sound file. Any changes to the sound file requires an update to the sound cache.

During Development

During development, the sound cache can be updated using a console command:

snd_updateaudiocache

The in-game menu will freeze up temporarily and will eventually output results regarding the sound cache update.

For Users

It would be really inconvenient for users to update their sound cache by console command whenever an add-on shipped with updated sound files. One workaround would be changing the filenames and soundscript entries of updated sound files. You can devise a naming scheme that denotes an updated sound file.

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»