1. Dashboard
  2. Articles
  3. Members
    1. Recent Activities
    2. Users Online
    3. Team
    4. Search Members
  4. Blog
    1. Articles
  5. Filebase
    1. Shop "Z"
  6. Forum
  7. Lexicon
    1. Documentation
  8. 🏷️Support
    1. FAQ
    2. Kuid's
  9. Gallery
    1. Albums
  • Login or register
  • Search
Lexicon
  • Everywhere
  • Articles
  • Pages
  • Blog Articles
  • Files
  • Forum
  • Lexicon
  • Tickets
  • FAQ
  • Gallery
  • More Options
  1. Wikiquik
  2. Lexicon

Soundscript

  • Wikiquik
  • January 27, 2024 at 8:55 PM
  • 230 times viewed
  • C++
     repeat-delay  0,0
     distance      50,150
     ambient       0
     attachment    ""
     nostartdelay  0
     priority      1
     trigger       ""
     volume        1
     value-range   0,0
     sound-asset
     sound
     {
     }
    Display More
    C++
     kind map
     soundscript
     {
       morning
       {
         ambient 1
         value-range 1, 0.1
         volume 0.3
         sound
         {
           0 "sound_day_1.wav"
           1 "sound_day_2.wav"
         }
       }
       night
       {
         ambient 1
         value-range 0, 0.9
         volume 0.3
         sound
         {
           0 "night_sound_loop.wav"
         }
       }
     }
    Display More


    DEFAULT

    1 ambient

    0If true this is an 'ambient' sound, ambient sounds are played in 2D and do not make use of 3D positioning in the world other than to affect volume. Unlike positional sounds, ambient sounds may be stereo.

    2 attachment

    Point to attach the sound source to. Attachment points are specified in the mesh file during creation.

    3 distance

    50,150The minimum distance (first value, in meters) defines the radius within which the sound remains at 100% volume. Beyond that distance, the sound volume will begin to decay naturally. The maximum distance (second value, in meters) defines a radius beyond which the game need no longer play the sound. This does not mean that the sound will fade to zero by the maximum distance, but rather that the sound may cut off abruptly beyond that point. It is up to the content creator to choose an appropriate maximum distance - smaller is better for performance, but overly small values may result in the sound audibly cutting off. Many Trainz editions ignore the configured maximum distance value and instead perform their own optimized calculation of the appropriate value.

    4 nostartdelay

    0If added and true this tag specifies that the sound will play immediately once triggered. By default sounds have a random start delay between 0 & 4 seconds. Start delay should be left active in most cases, as turning it off may cause significant audio artifacts when several identical sounds are in proximity.

    5 priority

    1Sets the priority of the sound, if their are not enough sound channels available higher priority sounds will be played first. Defaults to 1, can be negative.

    6 repeat-delay

    0,0Time range (in seconds) to delay, after the sound finishes playing, before playing the sound again. To set a constant delay either set both these values the same or only provide one of them, otherwise a random value between them will be chosen. When used with a trigger event (see the 'trigger' tag), a positive value indicates that the sound should not repeat, but should wait until triggered again.

    7 sound

    Contains list of the sound files to play. If the list has more than one entry then one file will be picked at random from the list. The value of each tag in this container is the filename of a WAV sound file. Filenames are relative to the base directory of the asset, i.e. relative to the location of the config file. Sampling rate can be 22kHz (22,050Hz) or 44kHz (44,100Hz). The higher sampling rate doubles the size of the file for no significant improvement in quality, and is not recommended. For some purposes there are additional requirements - for instance directional sounds must be mono.

    8 sound-asset

    The asset to source the sound files from. Allows the creation of "sound library" assets, so that sound files can be shared between multiple other assets. Defaults to the current asset.

    9 trigger

    The 'trigger' tag gives your sound a name that can allow it to be played from TrainzScript (see: Class MapObject), animations and certain predefined events. (At least one of these "predefined events" is to use the word "toggle" when including a soundscript container in the config.txt of a "MOjunction". This will make the sound fire each time the turnout is switched)

    10 value-range

    0,02 numbers, where the numbers are not the same, which set the start and end times for the sound to play. Midnight is 0.5, midday = 0.0 or 1.0. (TBD. This is a bit vague.)

    11 volume

    1Specifies the volume gain of the sound. Defaults to 1 (100%).
    • Sound
    • Quote

Share

  • Previous entry Složka o výší úrovni
  • PDF

Table of Contents

  • 1 ambient
  • 2 attachment
  • 3 distance
  • 4 nostartdelay
  • 5 priority
  • 6 repeat-delay
  • 7 sound
  • 8 sound-asset
  • 9 trigger
  • 10 value-range
  • 11 volume

Categories

  1. Default Category 50
  2. Scripting 18
  3. Configuration files 9
  1. Privacy Policy
  2. Contact
  3. Legal Notice
Lexicon 7.1.12, developed by www.viecode.com
Powered by WoltLab Suite™ 6.0.22