L4D2 Custom Sound and Music Tutorial: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Initial creation of tutorial.)
 
m (Current save)
Line 9: Line 9:


==MP3 Method==
==MP3 Method==
{{note| .MP3 files are a lot smaller than .WAV files, but they require more processing power and therefore lowers in-game performance}}
{{note| .MP3 files are a lot smaller than .WAV files, but they require more processing power and therefore lowers either client or server performance}}
.MP3 sound files will play in-game if they are added in the ''sound/music''' folder and '''do not need to be embedded'''.
==Embedded BSP Method==
==Embedded BSP Method==
Custom .WAV files must be [[BSPZIP|embedded in a BSP]], but they can be placed anywhere, preferably under the '''sound'' folder. 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''':<br><pre>internal_path\file1
external_path\file1
internal_path\file2
external_path\file2
...</pre>
* Internal paths ('relative paths') are the location the file will take within the BSP, e.g. <code>materials/metal/new_steel.vmt</code>.
* External paths ('full paths') are the location of the file to be packed, e.g. <code>C:\Users\Public\our_maps\materials\metal\new_steel.vmt</code>.
{{Note|It is recommended that the internal path be types exactly as shown in the example (use of forward slash ("/") instead of backslash ("\")}}
# 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:<br><pre>cd C:\Program Files\Steam\steamapps\common\left 4 dead 2\bin</pre>
# Embed the files with the following commands:<br><pre>bspzip -addlist <bspfile> <listfile> <newbspfile></pre>{{tip|You can quickly select your file in command prompt by typing in the first letters of <map name> and hit <code>TAB</code> to cycle through file names}}
# If BSPZIP is looking for gameinfo.txt try:<br><pre>bspzip -addlist <bspfile> <listfile> <newbspfile> -game "C:\Program Files\Steam\steamapps\common\left 4 dead 2\left4dead2"</pre>
==Creating the Soundscript==
Open '''<map name>_level_sounds.txt''' with a text editor.
An [[Soundscripts|entry]] can be played in-game via console or entity, such as ambient_generic or ambient_music. An example entry:
<pre>entry.name
{
channel CHAN_AUTO
volume VOL_NORM
pitch PITCH_NORM
soundlevel SNDLVL_NORM
wave common/null.wav
}</pre>
=== Examples ===
<pre>entry.name
{
channel CHAN_AUTO
volume VOL_NORM
pitch PITCH_NORM
soundlevel SNDLVL_NORM
wave common/null.wav
}</pre>
==Testing In-Game==
==Testing In-Game==
#Open <map name>.bsp via console
<pre>map <map name>.bsp coop</pre>
#Test out the sound via console
<pre>playgamesound entry.name</pre>
==Troubleshooting==

Revision as of 18:41, 13 February 2010

Introduction

Adding custom sound and music in a Left 4 Dead 2 map appears to be more flexible than Left 4 Dead. The following tutorial will first cover getting custom sounds to work in-game, then followed by customizing existing in-game event sounds (such as music and sound effects).

It is recommended to start with at least the following:

  1. A map that can be loaded in-game named however you like - maps/<map name>.bsp
  2. 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:

MP3 Method

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

.MP3 sound files will play in-game if they are added in the sound/music' folder and do not need to be embedded.

Embedded BSP Method

Custom .WAV files must be embedded in a BSP, but they can be placed anywhere, preferably under the 'sound folder. 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.
Note.pngNote:It is recommended that the internal path be types exactly as shown in the example (use of forward slash ("/") instead of backslash ("\")
  1. 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)
  2. Open the Windows Command Prompt, preferable with administrator privileges.
  3. Go to bin directory containing bspzip.exe:
    cd C:\Program Files\Steam\steamapps\common\left 4 dead 2\bin
  4. Embed the files with the following commands:
    bspzip -addlist <bspfile> <listfile> <newbspfile>
    Tip.pngTip: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
  5. 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.

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
}

Examples

entry.name
{
	channel		CHAN_AUTO
	volume		VOL_NORM
	pitch		PITCH_NORM
	soundlevel	SNDLVL_NORM
	wave		common/null.wav
}


Testing In-Game

  1. Open <map name>.bsp via console
map <map name>.bsp coop
  1. Test out the sound via console
playgamesound entry.name

Troubleshooting