Soundscripts: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
Line 11: Line 11:


Soundscripts are located within the scripts folder. The game_sounds_manifest.txt will preload or precache the soundscripts.
Soundscripts are located within the scripts folder. The game_sounds_manifest.txt will preload or precache the soundscripts.
 
==Example Soundscript==
 
== Example Soundscript ==
 
  "entry.name"
  "entry.name"
  {
  {
Line 23: Line 20:
  "wave" ")common/null.wav"
  "wave" ")common/null.wav"
  }
  }
 
==Channel Flags==
== Channel Flags ==
* CHAN_REPLACE = -1,
 
* CHAN_AUTO = 0,
<ul>
* CHAN_WEAPON = 1,
<li>CHAN_REPLACE = -1,
* CHAN_VOICE = 2,
<li>CHAN_AUTO = 0,
* CHAN_ITEM = 3,
<li>CHAN_WEAPON = 1,
* CHAN_BODY = 4,
<li>CHAN_VOICE = 2,
* CHAN_STREAM = 5, // allocate stream channel from the static or dynamic area
<li>CHAN_ITEM = 3,
* CHAN_STATIC = 6, // allocate channel from the static area
<li>CHAN_BODY = 4,
* CHAN_VOICE_BASE = 7, // allocate channel for network voice data
<li>CHAN_STREAM = 5, // allocate stream channel from the static or dynamic area
* CHAN_USER_BASE = (CHAN_VOICE_BASE+128) // Anything >= this number is allocated to game code.
<li>CHAN_STATIC = 6, // allocate channel from the static area
==Volume Flags==
<li>CHAN_VOICE_BASE = 7, // allocate channel for network voice data
* VOL_NORM // 1.0 full volume
<li>CHAN_USER_BASE = (CHAN_VOICE_BASE+128) // Anything >= this number is allocated to game code.
* 0.0 // off
</ul>
 
 
== Volume Flags ==
 
<ul>
<li>VOL_NORM // 1.0 full volume
<li>0.0 // off
</ul>
another example: "volume" "0.45,0.65"
another example: "volume" "0.45,0.65"
 
==Pitch Flags==
 
* PITCH_NORM 100 // non-pitch shifted
== Pitch Flags ==
* PITCH_LOW 95 // other values are possible - 0-255, where 255 is very high
 
* PITCH_HIGH 120
<ul>
<li>PITCH_NORM 100 // non-pitch shifted
<li>PITCH_LOW 95 // other values are possible - 0-255, where 255 is very high
<li>PITCH_HIGH 120
</ul>
another example: "pitch" "95,120"
another example: "pitch" "95,120"
 
==SoundLevel Flags==
 
* SNDLVL_NONE = 0,
== SoundLevel Flags ==
* SNDLVL_20dB = 20, // rustling leaves
 
* SNDLVL_25dB = 25, // whispering
<ul>
* SNDLVL_30dB = 30, // library
<li>SNDLVL_NONE = 0,
* SNDLVL_35dB = 35,
<li>SNDLVL_20dB = 20, // rustling leaves
* SNDLVL_40dB = 40,
<li>SNDLVL_25dB = 25, // whispering
* SNDLVL_45dB = 45, // refrigerator
<li>SNDLVL_30dB = 30, // library
* SNDLVL_50dB = 50, // 3.9 // average home
<li>SNDLVL_35dB = 35,
* SNDLVL_55dB = 55, // 3.0
<li>SNDLVL_40dB = 40,
* SNDLVL_IDLE = 60, // 2.0
<li>SNDLVL_45dB = 45, // refrigerator
* SNDLVL_60dB = 60, // 2.0 // normal conversation, clothes dryer
<li>SNDLVL_50dB = 50, // 3.9 // average home
* SNDLVL_65dB = 65, // 1.5 // washing machine, dishwasher
<li>SNDLVL_55dB = 55, // 3.0
* SNDLVL_STATIC = 66, // 1.25
<li>SNDLVL_IDLE = 60, // 2.0
* SNDLVL_70dB = 70, // 1.0 // car, vacuum cleaner, mixer, electric sewing machine
<li>SNDLVL_60dB = 60, // 2.0 // normal conversation, clothes dryer
* SNDLVL_NORM = 75,
<li>SNDLVL_65dB = 65, // 1.5 // washing machine, dishwasher
* SNDLVL_75dB = 75, // 0.8 // busy traffic
<li>SNDLVL_STATIC = 66, // 1.25
* SNDLVL_80dB = 80, // 0.7 // mini-bike, alarm clock, noisy restaurant, office tabulator, outboard motor, passing snowmobile
<li>SNDLVL_70dB = 70, // 1.0 // car, vacuum cleaner, mixer, electric sewing machine
* SNDLVL_TALKING = 80, // 0.7
<li>SNDLVL_NORM = 75,
* SNDLVL_85dB = 85, // 0.6 // average factory, electric shaver
<li>SNDLVL_75dB = 75, // 0.8 // busy traffic
* SNDLVL_90dB = 90, // 0.5 // screaming child, passing motorcycle, convertible ride on frw
<li>SNDLVL_80dB = 80, // 0.7 // mini-bike, alarm clock, noisy restaurant, office tabulator, outboard motor, passing snowmobile
* SNDLVL_95dB = 95,
<li>SNDLVL_TALKING = 80, // 0.7
* SNDLVL_100dB = 100, // 0.4 // subway train, diesel truck, woodworking shop, pneumatic drill, boiler shop, jackhammer
<li>SNDLVL_85dB = 85, // 0.6 // average factory, electric shaver
* SNDLVL_105dB = 105, // helicopter, power mower
<li>SNDLVL_90dB = 90, // 0.5 // screaming child, passing motorcycle, convertible ride on frw
* SNDLVL_110dB = 110, // snowmobile drvrs seat, inboard motorboat, sandblasting
<li>SNDLVL_95dB = 95,
* SNDLVL_120dB = 120, // auto horn, propeller aircraft
<li>SNDLVL_100dB = 100, // 0.4 // subway train, diesel truck, woodworking shop, pneumatic drill, boiler shop, jackhammer
* SNDLVL_130dB = 130, // air raid siren
<li>SNDLVL_105dB = 105, // helicopter, power mower
* SNDLVL_GUNFIRE = 140, // 0.27 // THRESHOLD OF PAIN, gunshot, jet engine
<li>SNDLVL_110dB = 110, // snowmobile drvrs seat, inboard motorboat, sandblasting
* SNDLVL_140dB = 140, // 0.2
<li>SNDLVL_120dB = 120, // auto horn, propeller aircraft
* SNDLVL_150dB = 150, // 0.2
<li>SNDLVL_130dB = 130, // air raid siren
* SNDLVL_180dB = 180, // rocket launching
<li>SNDLVL_GUNFIRE = 140, // 0.27 // THRESHOLD OF PAIN, gunshot, jet engine
==Wave Flag==
<li>SNDLVL_140dB = 140, // 0.2
"rndwave" // plays more than one wave file in a random order
<li>SNDLVL_150dB = 150, // 0.2
{
<li>SNDLVL_180dB = 180, // rocket launching  
"wave" ")common/blah1.wav"
</ul>
"wave" ")common/blah2.wav"
 
"wave" ")common/blah3.wav"
 
}
== 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"
 
}
 
 
==References==
==References==
 
* public/soundflags.h from create a mod, source sdk
<ul>
* '''sciripts/game_sounds_header.txt''' from create a mod, source sdk
<li>public/soundflags.h from create a mod, source sdk
* '''scripts/game_sounds.txt''' from create a mod, source sdk
<li>sciripts/game_sounds_header.txt from create a mod, source sdk
* '''scripts/game_sounds_manifest.txt''' from create a mod, source sdk
<li>scripts/game_sounds.txt from create a mod, source sdk
<li>scripts/game_sounds_manifest.txt from create a mod, source sdk
</ul>

Revision as of 23:03, 11 November 2005

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.

Stub

This article or section is a stub. You can help by expanding it.


Soundflags for 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"
}

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"
}

References

  • public/soundflags.h from create a mod, source sdk
  • sciripts/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