Difference between revisions of "Soundscripts"

From Valve Developer Community
Jump to: navigation, search
m (References)
m (References: spelling error)
Line 100: Line 100:
 
* '''src/public/soundflags.h''' from create a mod, source sdk
 
* '''src/public/soundflags.h''' from create a mod, source sdk
 
* '''src/public/soundchars.h''' from create a mod, source sdk
 
* '''src/public/soundchars.h''' from create a mod, source sdk
* '''sciripts/game_sounds_header.txt''' from create a mod, source sdk
+
* '''scripts/game_sounds_header.txt''' from create a mod, source sdk
 
* '''scripts/game_sounds.txt''' from create a mod, source sdk
 
* '''scripts/game_sounds.txt''' from create a mod, source sdk
 
* '''scripts/game_sounds_manifest.txt''' from create a mod, source sdk
 
* '''scripts/game_sounds_manifest.txt''' from create a mod, source sdk
 +
 
==See Also==
 
==See Also==
 
* [[Dynamic Level Soundscripts]]
 
* [[Dynamic Level Soundscripts]]
 
{{stub}}
 
{{stub}}

Revision as of 15:59, 18 January 2006

Soundscripts

Soundscripts are located within the scripts folder. The game_sounds_manifest.txt will preload or precache the soundscripts.

Example Soundscript

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

Soundflags for Soundscripts

Channel Flags

  • CHAN_REPLACE = -1,
  • CHAN_AUTO = 0,
  • CHAN_WEAPON = 1,
  • CHAN_VOICE = 2,
  • CHAN_ITEM = 3,
  • CHAN_BODY = 4,
  • CHAN_STREAM = 5, // allocate stream channel from the static or dynamic area
  • CHAN_STATIC = 6, // allocate channel from the static area
  • CHAN_VOICE_BASE = 7, // allocate channel for network voice data
  • CHAN_USER_BASE = (CHAN_VOICE_BASE+128) // Anything >= this number is allocated to game code.

Volume Flags

  • VOL_NORM // 1.0 full volume
  • 0.0 // off

another example: "volume" "0.45,0.65"

Pitch Flags

  • PITCH_NORM 100 // non-pitch shifted
  • PITCH_LOW 95 // other values are possible - 0-255, where 255 is very high
  • PITCH_HIGH 120

another example: "pitch" "95,120"

SoundLevel Flags

  • SNDLVL_NONE = 0,
  • SNDLVL_20dB = 20, // rustling leaves
  • SNDLVL_25dB = 25, // whispering
  • SNDLVL_30dB = 30, // library
  • SNDLVL_35dB = 35,
  • SNDLVL_40dB = 40,
  • SNDLVL_45dB = 45, // refrigerator
  • SNDLVL_50dB = 50, // 3.9 // average home
  • SNDLVL_55dB = 55, // 3.0
  • SNDLVL_IDLE = 60, // 2.0
  • SNDLVL_60dB = 60, // 2.0 // normal conversation, clothes dryer
  • SNDLVL_65dB = 65, // 1.5 // washing machine, dishwasher
  • SNDLVL_STATIC = 66, // 1.25
  • SNDLVL_70dB = 70, // 1.0 // car, vacuum cleaner, mixer, electric sewing machine
  • SNDLVL_NORM = 75,
  • SNDLVL_75dB = 75, // 0.8 // busy traffic
  • SNDLVL_80dB = 80, // 0.7 // mini-bike, alarm clock, noisy restaurant, office tabulator, outboard motor, passing snowmobile
  • SNDLVL_TALKING = 80, // 0.7
  • SNDLVL_85dB = 85, // 0.6 // average factory, electric shaver
  • SNDLVL_90dB = 90, // 0.5 // screaming child, passing motorcycle, convertible ride on frw
  • SNDLVL_95dB = 95,
  • SNDLVL_100dB = 100, // 0.4 // subway train, diesel truck, woodworking shop, pneumatic drill, boiler shop, jackhammer
  • SNDLVL_105dB = 105, // helicopter, power mower
  • SNDLVL_110dB = 110, // snowmobile drvrs seat, inboard motorboat, sandblasting
  • SNDLVL_120dB = 120, // auto horn, propeller aircraft
  • SNDLVL_130dB = 130, // air raid siren
  • SNDLVL_GUNFIRE = 140, // 0.27 // THRESHOLD OF PAIN, gunshot, jet engine
  • SNDLVL_140dB = 140, // 0.2
  • SNDLVL_150dB = 150, // 0.2
  • SNDLVL_180dB = 180, // rocket launching

Wave Flag

 "rndwave" // plays more than one wave file in a random order
 {
 	"wave" 	"common/blah1.wav"
 	"wave" 	"common/blah2.wav"
 	"wave" 	"common/blah3.wav"
 }

Sound Characters for Soundscripts

  • CHAR_STREAM ' * '

// as one of 1st 2 chars in name, indicates streaming wav data

  • CHAR_USERVOX ' ? '

// as one of 1st 2 chars in name, indicates user realtime voice data

  • CHAR_SENTENCE ' ! '

// as one of 1st 2 chars in name, indicates sentence wav

  • CHAR_DRYMIX ' # '

// as one of 1st 2 chars in name, indicates wav bypasses dsp fx

  • CHAR_DOPPLER ' > '

// as one of 1st 2 chars in name, indicates doppler encoded stereo wav: left wav (incomming) and right wav (outgoing).

  • CHAR_DIRECTIONAL ' < '

// as one of 1st 2 chars in name, indicates stereo wav has direction cone: mix left wav (front facing) with right wav (rear facing) based on soundfacing direction

  • CHAR_DISTVARIANT ' ^ '

// as one of 1st 2 chars in name, indicates distance variant encoded stereo wav (left is close, right is far)

  • CHAR_OMNI ' @ '

// as one of 1st 2 chars in name, indicates non-directional wav (default mono or stereo)

  • CHAR_SPATIALSTEREO ' ) '

// as one of 1st 2 chars in name, indicates spatialized stereo wav

  • CHAR_FAST_PITCH ' } '

// as one of 1st 2 chars in name, forces low quality, non-interpolated pitch shift

Stereo Sound Directionality in Source

Adding ) in front of a stereo sound name in the soundscript such as ")weapons/m4a1/m4_shoot.wav" tells the sound engine that it is a spatialized sound. Use this on any stereo sound to give it directionality. If this is not used, when a sound originates to the right or left of you it will still sound like it is directly in front of you and you will not be able to tell where the sound is coming from (important on stereo gunshots). Stereo wav's that you want directionality with MUST have ) in them. Mono's do not need them, they will be spatialized already.

Distant Variant Sounds in Source

Adding ^ in front of a sound name, such as "^weapons/explode3.wav" tells the sound engine that it is a distance based sound. The left portion of the .wav is the 'near' sound that will play when the sound originates close to you, and the right portion of the .wav is the 'far' sound that will play when the sound originates far from you. If the ^ mark is not used in the soundscript the sound is treated as stereo with no directionality or distance. This is a different feature than the sndlvl entry to control attenuation. This distant variant feature allows you to play two different sounds (but using only one file) and cross-fading between the two depending on how far away the sound originates.

References

  • src/public/soundflags.h from create a mod, source sdk
  • src/public/soundchars.h from create a mod, source sdk
  • scripts/game_sounds_header.txt from create a mod, source sdk
  • scripts/game_sounds.txt from create a mod, source sdk
  • scripts/game_sounds_manifest.txt from create a mod, source sdk

See Also