This article relates to the game "Left 4 Dead". Click here for more information.
This article's documentation is for anything that uses the Source engine. Click here for more information.

L4D Custom Music Tutorial

From Valve Developer Community
Jump to: navigation, search
English (en)Translate (Translate)

This tutorial will go over how to customize the Music Director for your campaign using themapname_level_sounds.txtfile. If you are planning on creating custom soundscripts as well, you should still follow this tutorial and append those scripts to the level_sounds.txt.


There are 9 steps to this method of adding custom music to your campaign:

  1. Create a text file called mapname_level_sounds.txt in your add-on's maps directory.
  2. Copy ALL the contents from the example soundscript into that file.
  3. In the missions file of your add-on, find the NAME parameter and pick a short name that has no spaces.
  4. In notepad, press Ctrl+H to find and replace XXXXX with the same name you used in missions.txt NAME field.
  5. Begin replacing any WAV files you choose in the script to reference your own files. (Do not include sounds/ in the paths, it's assumed.)
  6. Load up Left 4 Dead and turn off all add-ons except the one you are working on. (Other campaigns' custom sounds may cause trouble if you don't.)
  7. In the console, enter snd_rebuildaudiocache and wait about 5 mins for it to finish.
  8. Copy the _master.cache file from yourmaps/soundcache, place it in your add-on's maps/soundcache directory.
  9. Package your campaign into a VPK and test it out in-game. Your custom music should work!
Note.pngNote:You will need to repeat the snd_rebuild steps whenever you add new sound files.
Todo: This method seems to have a 50/50 chance of allowing users to hear your custom sounds without rebuilding their audio cache. It may be more beneficial to PAKRAT/BSPZIP the _master.cache file within the.bspitself, thereby hiding the file from other people's add-ons, which would avoid sound conflicts and possibly force your custom soundcache to load instead of the default. This is untested, but it's worth a try.

Custom Music Script File

This is the example soundscript you need to copy.

It is a stripped version of the game_sounds_music.txt to only include the Events you need to edit for your campaign. It is highly recommended allowing a greater insight into what each section is for when deciding on what to change.

You may also opt not to change anything in the file, which will give your campaign the default music cues associated with the Airport campaign.

http://www.evolvedant.com/soundscript/example_script.zip

Note.pngNote:There was a slight typo in the previous file. If intro music wasn't working for you, redownload this file.

Example Tips

If your campaign is called "Awesome" and contains maps such as l4d_awesome_forest, l4d_awesome_campsite, etc…

Your add-on's maps directory should contain l4d_awesome_forest_level_sounds.txt:

L4dMapDir.jpg

The NAME parameter in your missions.txt would be "awesome" and look like this:

L4dmissions2.jpg

Here's how your sound script would look properly edited to make use of thriller.wav:

L4dsoundscript.jpg

See also