CCG/PFX: Sound Scripts

From TrainzOnline
< CCG
Jump to: navigation, search

Contents

Sound Scripts

Soundscripts give ambient or directional sounds to objects. They cannot be used on track, bridge or spline objects. Refer to the new tracksound container options to change track sound on a bridge or tunnel for example.

Wav files should be located within the same directory as the config.txt file. Examples as follows:

MOJUNCTION

Config.txt

kuid <KUID:###:#####>
kind mojunction
region Australia
trackside 2
light 1
mesh-table
 {
   mode0
     {
       mesh lever1/lever1.im
       auto-create 1
     }
   mode1
     {
       mesh lever2/lever2.im
   }
 }
soundscript
 {
   toggle
    {
      trigger toggle
      distance 5, 100
      nostartdelay 1
      repeat-delay 1
      sound
      {
       0  points.wav
      }
    }
 }
etc.


PEOPLE CROWD

Config.txt:

kind               "scenery"
region             "Australia"
trains-build       2.9
username           "Test Crowd"
kuid               <KUID:###:#####>
category-class     "MH"
category-region    "AU"
category-era       "1960s" 
soundscript
 {
  daysingle
   {
     repeat-delay  0
     distance      3,150
     sound
     {
      0            "crowd_1.wav"
     }
  }
}
etc.

MAP

Config.txt:

kind               "map"
kuid               <KUID:###:#####>
soundscript
 {
  morning
   {
    ambient        1
    value-range    1, 0.1
    volume         0.3
    sound
     {
       0           "ctry_day_1.wav"
     }
   }
  night
   {
    ambient        1
    value-range    0,0.9
    volume         0.3
    sound
     {
       0           "night_loop.wav"
     }
   }
 }
username           "Britain"
workingscale       0
workingunits       0
water              <KUID:-1:8009>
region             "Britain"
etc.


THUNDERBOX

Config.txt:

kuid               <KUID:###:#####>
region             "Australia"
light              1
kind               "scenery"
soundscript
 {
   dayloop
   {
     repeat-delay  15,50
     distance      5,50
     sound
      {
        0          "strain_1.wav"
      }
   }
 }
  
 etc.


Breakdown of Soundscripts

repeat-delay

1 or 2 numbers (min, max, in sec) time to delay between the end of the sound playing, and playing it again randomised between (min .. max)
default min = 0 default max = min


attachment

Attachment point on the object to which the sound is attached.
Default: The sound will attach to the origin of parent object (not used for ambient sound)


distance

2 numbers (metres)
1st number = the distance at which the sound is played at 100%
2nd number = The cut-off distance. Doesn't affect the volume of the sound default: 50m, 150m


sound

List of .wav files to play (randomly picked if more than one)


volume

Gain of the sound Default 1.0 = 100%


ambient

0 or 1, default 0 is off Ambient sounds have no 3D "position" and may be stereo. Non-ambient (positional) sounds are positioned on the object and must be mono - see attachment above


value-range

2 numbers, currently used only for day/night sound effects.
Midnight is 0.5, midday = 0.0 or 1.0 Where the numbers are not the same, this sets the start and end times for the sound to play.
Default 0,0 (off)


trigger

A trigger may be used in an event file (.evt) associated with an animation. It plays at selected key frames of the animation as defined in the event file. Sound files may be triggered in this manner, and from scripting.
Used in the mojunction example (switch lever) the "toggle" action is automatically triggered when the lever is operated and the sound plays. The sound doesn't play until the trigger message happens, as a result of the lever operating.


nostartdelay

0 or 1, default 0 If not set, the sound will have a short delay before playing, this stops flanging (flanging is a really nasty sound caused when several copies of the same sound are played at once).


dayloop, daysingle, morning, night are sub-container names chosen by user. Each is a single word only. Do not use a space.


Please refer to examples and detailed explanations of additional tags in the earlier chapters of this document.


Return to CCG Index

Content Creator's Guide

Personal tools