TF2’s audio is managed by two layers: the SoundEmitter system (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/sr2echa/TF2-Source-Code/llms.txt
Use this file to discover all available pages before exploring further.
soundemittersystem/) that maps logical sound names to wave files and parameters, and the engine sound interfaces (IEngineSound) that submit actual sound commands to the audio hardware. Game code almost always calls EmitSound() with a logical name rather than a raw wave path.
Sound script files
Sound scripts (e.g.,scripts/game_sounds_tf.txt) define named sound entries as KeyValues. The CSoundEmitterSystemBase class parses these files at startup and stores them in a hash table keyed by sound name.
scripts/game_sounds_tf.txt (example entry)
| Key | Description |
|---|---|
channel | Audio channel (CHAN_WEAPON, CHAN_VOICE, CHAN_BODY, etc.) |
volume | 0.0–1.0 or VOL_NORM |
soundlevel | Attenuation level (SNDLVL_NORM, SNDLVL_GUNFIRE, SNDLVL_NONE) |
pitch | Pitch shift (100 = normal, PITCH_NORM) |
wave / rndwave | Single wave file or random selection block |
delay_msec | Pre-play delay in milliseconds |
ISoundEmitterSystemBase
CSoundEmitterSystemBase (soundemittersystem/soundemittersystembase.h) is the server-and-client registry. It resolves a sound name to a CSoundParametersInternal struct, then game code submits those parameters to the engine.
EmitSound on server and client
Game code usesCBaseEntity::EmitSound() on the server (which sends a SVC_Sounds network message to clients) and C_BaseEntity::EmitSound() on the client for purely local sounds (UI clicks, local player footsteps).
Audio channels
Channels prevent sounds from stacking incoherently on the same entity. Each channel can only play one sound at a time per entity:| Channel | Usage |
|---|---|
CHAN_WEAPON | Weapon fire, reload |
CHAN_VOICE | Character speech, pain sounds |
CHAN_BODY | Footsteps, physical impacts |
CHAN_ITEM | Item pickup, flag sounds |
CHAN_STATIC | Ambient/looping background |
CHAN_AUTO | Engine-selected, allows stacking |
Soundscapes
Soundscapes (soundscape_*.txt and soundscapeSystem.cpp) layer multiple ambient loops and random sound triggers to create the environmental audio feel of each map area. env_soundscape entities in maps reference soundscape entries by name and activate when players enter trigger volumes.