Sounds
sounds/waves/ contains raw audio data which is referred to by ksnd files in sounds/shaders/.
ksnd files define the actual sound effects played in the game. They can mix multiple sounds together, add delays, dynamically shift the volume and pitch, and control other properties.
The number of sounds is specified at the beginning of the file with sounds[N] =
, followed by a block containing N
sub blocks, each defining a sound to play when the ksnd is invoked.
The number of sound definitions must match the value of N
, or the game will not load.
Types
General Properties
wavefile |
wav file to play e.g., |
bOneInstancePerSource | can't be replayed until the previous instance finishes |
bLoop | loop until the source is removed, dies, or stops it via script |
bEnableVolumeEnvelope | enables the shifting properties in the corresponding envelope block |
bEnablePitchEnvelope | |
bFadeIfObstructed | source requires line of sight to the player for this sound to be audible |
bUpdateNoEnvelope | [unused] |
bLinkToEnvelope | [unused] |
bFullVolume | do not reduce volume with distance from the player |
delay | how long after the ksnd was invoked to play this sound |
priority | There's a limit to how many sounds can be playing at once. Sounds with a higher priority are given precedence when that limit is reached. |
random | probability that the sound will play (0.0 to 1.0 ) |
radioVolume |
|
Envelope Blocks
These blocks control volume and pitch, as well as dynamic volume and pitch shifting.
All values except for max
require the corresponding envelope boolean to be set, except for start ≤ 0.002
in volume_envelope
.
These blocks work slightly differently from each other, so be mindful of the details.
volume_envelope
max | base volume scalar of the sound |
start |
initial and target fraction of volume will ramp from |
end | |
duration | how long it takes to ramp from initial to target volume |
envStartTime |
how long to stay at initial volume, before beginning to ramp toward target volume |
pitch_envelope
max |
pitch scalar this value will only be used when |
start |
initial and target pitch pitch will shift from |
end | |
duration | how long it takes to shift from start to end |
envStartTime | how long to stay at start , before beginning to shift toward end |