Rail3D*


 

Current Sound Implementation


see also Sound

Sound implementation

Existing Rail3D code includes a sound code implementation (Although this is disabled in general releases due to the lack of Distributable Sound FilesDistributable Sound Files)

The sound definition for rolling stock items consists of a block of xml code added to the stock (.stk) file.

This definition must open with <sound> and close with sound> and may contain a <horn> element and one or more <stream> elements, eg:


    
        Power
        Diesel
        5
        Speed
        Speed
    

    DieselHorn

<stream>

One or more streams should be defined: a stream is a sound produced by the vehicle and multiple streams may be mixed to produce complex sound effects.

A maximum of three streams are allowed. Streams should come before other elements such as <horn>

<scheme>

The scheme parameter defines the sound scheme in use, various schemes are available:

  • Speed: the sound varies with the vehicle speed. The sound is faded between waves at transitions.
  • Steam: the sound varies with vehicle speed but is not faded at transitions. At low speeds a single exhaust beat wav (defined by a <chuff> parameter is played for individual beats (this applies up to a lower limit speed defined by <speed0> (see below)
  • Power: the sound varies according to the position of the primary power controller. The sound is faded between waves at transitions.
  • rpm: the sound varies according to engine rpm (for diesel engines). Sound is faded between waves at transitions.

<set>

<numsounds>

<set> and <numsounds> define the wave files to be used, where set gives the base file name and numsounds the number of wave files. Thus for

Diesel
5

The wave files are Diesel0.wav Diesel1.wav Diesel2.wav Diesel3.wav and Diesel4.wav

<amplitudefunction>

optional

An amplitude function may be defined which varies the sound amplitude according to some other parameter. Amplitude functions currently defined are:

  • Speed: sound gets louder with increasing speed
  • Power: sound gets louder with increasing power controller position
  • rpm: sound gets louder with increasing engine rpm

<freqfunction>

optional

A frequency function may be defined which modulates the sound frequency according to some other parameter. Frequency functions currently defined are:

  • Speed: frequency increases with increasing speed
  • Power: frequency increases with increasing power controller position
  • rpm: frequency increases with increasing engine rpm

nb, if someone can convince me that the inverse functions are required, I’ll be happy to code them!

<horn>

The horn element defines the wav file to be used for horn/whistle events

Steam


    
        Steam
        Steam
        10
        Speed
        Chuff
        4
    
    Whistle

The steam scheme is best used for steam engines, features of this scheme:

  • Wave0 is used when stationary - and/or when coasting with the regulator close.
  • At low speeds (up to Speed0) Wave0 is overlaid with the Chuff wav (Which represents a single exhaust beat) which is synchronised with the engine exhaust
  • Above Speed0 waves 1 to n-1 are played in sequence, but not faded at transitions.
  • When slipping, the highest wave is played with high amplitude.

File format

Sound files should be .wav 11kHz mono


import