Setting Sound Files

Index

Introduction

Sound File Basics

Sound File Format

Key Open Rails Trigger Events for Sounds

Example Sound Configurations

Creating WAV Files

Troubleshooting and Debugging

Useful Links


Introduction

SMS (Sound Management System) files are used in OR to add sounds to the experience of operating trains, and this page describes how to set up sound files for Open Rails, and is based upon contributions by Roger van Duijnhoven

If you wish to provide any feedback on this page, please use the contact page. It would be great to have some feedback, as this helps to ensure the accuracy of the information.

top


Sound File Basics

Files Required

To set up a train with functional sounds the following files will be required:

Locomotives - there are two sound files that are used for the configuration of sounds for a locomotive, xxxxxCAB.SMS and xxxxxENG.SMS. Where 'xxxxx' is a name of the model. The file xxxxCAB.SMS is used for the inside, so the cabin sounds. The file xxxxENG.SMS is used for the outside. This name must be specified exactly in the "wagon of engine" section in the corresponding ENG file.

Tenders and Wagon - Wagons (freight wagons, passenger coaches or tenders) also have their own xxxxx.SMS file, which lists the external sounds. This name must be specified exactly in the corresponding WAG file. If a passenger view has been made, it can also have its own SMS file.

Sound file location

Typically each piece of rolling stock (locomotive or wagon, etc.) has its own folder in the \TRAINSET folder, and this folder contains all ENG and WAG files required to define the train. An additional folder called \SOUND is usually included to hold all the relevant sound information, such as the SMS and WAV. The WAV file is a sound recording that is usually in a particular format, and is "called" by the SMS file to provide the relevant sound effect. Where the sounds are likely to be used by many different items of rolling stock, it is often prefferable to create a common folder to hold the sounds. This prevents the need to duplicate the sound files in multiple locations on the HDD.

Naming Conventions

Where the SMS and WAV files are located in the same folder structure as the rolling stock, then when referenced in the ENG or WAG, just the name of the sound file is required as OR will automatically search for the sound files in the \SOUND folder.

Where a common sound folder structure is used (for example, "common_sounds"), it will be necessary to provide a path that OR can follow to find the files, such as ../../common_sounds/xxxx.sms. Where the appropriate reference to the common directory represents the WAV file in the sound file.

top


Sound File Format

Below is a description how the SMS files are built and how to 'read' them.

Overall SMS Format

Typically the overall format of the SMS files might look something like the following:


SIMISA@@@@@@@@@@JINX0x1t______

Tr_SMS (


     ScalabiltyGroup( 5
         Activation ( CabCam () Distance (100) )
         Deactivation ( ExternalCam () PassengerCam () Distance (100) )
         Stereo ()


            Streams ( 2
                Stream (

                    Skip ( **** Air Horn **** )
                    Priority ( 6 )
                    Triggers ( 2
                         Discrete_Trigger ( 8 StartLoopRelease ( 1 File ( "2tonsAirhorn.wav" -1 ) SelectionMethod ( SequentialSelection ) ) )
                         Discrete_Trigger ( 9 ReleaseLoopRelease () )
                           )

                     )
                Stream (

                     Skip ( **** bell **** )
                     Priority ( 6 )
                     Volume ( 0.9 )
                     Triggers ( 2
                         Discrete_Trigger ( 10 StartLoopRelease ( 1 File ( "bell1.wav" -1 ) SelectionMethod ( SequentialSelection ) ) )
                         Discrete_Trigger ( 11 ReleaseLoopRelease () )
                           )


                     FrequencyCurve(
                         SpeedControlled
                             CurvePoints ( 7 etc. etc.
                                )
                             )

                     )
                  )

             )
       )

The following points should be noted about the above format:

1. The SMS file container ( "head and tail part ).
2. Every sound or 'sound function' is included within an appropriate Stream.
3. Every Stream has his triggers (lines).
4. Optional frequency or volume curve settings.
5. It is important to ensure that all the "brackets" are matched, otherwise incorrect operation may occur.

The components of the above SMS file are now described below in more detail.

SMS File "Header" and "Tail" Structure

The SMS file has a "header" structure, and a "tail" section which contains all the relevant sound commands. The header structure looks like this:
SIMISA@@@@@@@@@@JINX0x1t______

The "tail" structure is enclosed within the Tr_SMS ( ) statement. Typically the "tail" is structured with a number of subsections, and is contained within the Tr_SMS statement, as follows:

Tr_SMS (

   ( The contents of the ScalibilityGroups are described hereafter )

)

The key sub-sections of the above overall file structure are described in more detail in the following sections.

Comments

Comments can be added to the SMS using one of the following syntaxes:
Skip ( text )
Comment ( text )
_( text )

It is strongly recommended that lots of comments are used in the SMS file, as these will help the creator to remeber the logic that they have used, and also make the file easier to read by others.

ScalibilityGroup

The SMS files can consist of multiple groups ScalabiltyGroup. The different groups are used in MSTS to make a difference as "Player locomotive", "AI locomotive", etc. and to define their own sounds. However OR only uses one group, so for "OR only use" you can remove the other parts. (you can also leave it, as OR "won't care").

The ScalabiltyGroup section takes the following form:

     ScalabiltyGroup( x
         Activation ( y )
         Deactivation ( y )
         Stereo ()

            ( The contents of the Streams are described hereafter )
         )

Where x = the number of the scalability group.

The lines Activation ( y ) and Deactivation ( y ) indicate within which view the sounds in this file are audible and at what maximum distance. The y value will be an appropriate combination of one or more of the following parameters.

Valid parameters are:
ExternalCam () - External Camera View (Keypress 2 3 4);
CabCam () - Camera within the cab (Keypress 1);
PassengerCam () - camera within the passenger view (Keypress 5);
Distance ( z ) - distance z (in metres) from the sound source that a sound can still be heard.

This is also when a SMS file is "active". In OR you can check this via the sound Debug tool. See below for more detail.

The difference between CAB.SMS and ENG.SMS is also that the ExternalCam and CabCam have been swapped.

Stereo ( ) - is not used in OR. However if in one Stream stereo .wav sound is used, never use mono .wav sounds in the same Stream.

Streams

Every sound or 'sound function' is included within an appropriate Stream command, which in turn are enclosed within the Streams command. A Stream also has 'a head and a tail', with various triggers that control the sound.

The "head and tail part" of a Stream consists of:

     Streams ( 2
            Stream (

                Priority ( x )
                Volume ( y )

                   ( The contents of the Triggers are described hereafter )
             )
         )

The value Streams ( x is very important, as x indicates the number of Stream statements included. The function is simple, it indicates how many Stream ( are used in the respective file. [Remember the 's' !! Streams ( or Stream ( ]

Priority ( x ) - The "Priority" is necessary in a stream, but has no meaning in OR.

Volume ( y ) - The 'stream volume' can be adjusted by changing the y value. Valid values are between (0.0) = 0% to (1.0) = 100%. Although the advice is to leave everything at 100%, and give the correct volume of the WAV file via a sound editor.

A Stream may have additional settings, such as the frequency or volume being changed depending on the speed or power. Practically this may be necessary for sounds like traction motors, turbo, diesel engine, etc. This is done by using the FrequencyCurve or VolumeCurve. (See examples in locomotive SMS files).

Trigger

The triggers section has the following format:

Triggers ( x
        ( Each of the different Trigger statements has a slightly different format as described below )
    )

where x = number of triggers to follow (This value must also be given exactly, because other errors occur and sounds do not function properly).

Each trigger line starts with "the type of trigger" as "if trigger is activated, do next". Think of a trigger as a one-time action or passing point! (never an "on / off function").

The following types of triggers are available to use:

Discrete_Trigger - this is a one-off trigger, and takes the form Discrete_Trigger ( x y ), where x = Trigger event, and y = Play Command. For example, if you press the Space bar to activate the "Horn" function, the discrete_trigger will only allow a one-off playing of the sound, even if you keep the Space bar is held pressed. (See the
Table of Key Open Rails Trigger Events for Sounds for all discrete_triggers events).

Initial_Trigger - Actually "start with ...." and immediately start the relevant sound file. An Initial_Trigger is also often used to set other triggers "activated or deactivated" as a starting point. It takes the form of Initial_Trigger ( x ) where x = play command as described below.

Random_Trigger - This trigger is occasionally used to play a number of sounds, with intermediate pauses. It has its own structure. It takes the form of Random_Trigger ( x ) x = play command as described below.

Variable_Trigger - This trigger start when a certain 'variable value' is reached. It takes the form of Variable_Trigger ( x y ) where x = one of the variables described below, and y = play command as described below.

These variables include the following:
Speed_Inc_Past, Speed_Dec_Past, CurveForce_Inc_Past, CurveForce_Dec_Past, BrakeCyl_Inc_Past, BrakeCyl_Dec_Past, Distance_Inc_Past, Distance_Dec_Past, Variable1_Inc_Past, Variable1_Inc_Past, Variable2_Inc_Past, Variable2_Inc_Past, Variable3_Inc_Past, Variable3_Inc_Past.

Each of these parameters is typically written as Speed_Inc_Past ( x ) where x = a kind of % 'variable value', not a parameter such as km/h, Miles, etc. The 'variable value' can be tested and read during various circumstances via Sound Debug monitor in OR. It is suggested that a "simple route" with no objects, etc. is used for testing, such as the Coals to Newcastle test route. This is because the sound debug monitor requires a lot of performance.

Play Commands

Play commands have the following format:

PlayCommand ( x y z )
where x= number of sound files, y = sound file name, and z = Selection Method.

The following types of play commands are available to use:

PlayOneShot - sound is played once.

StartLoopRelease - sound is played in a continuous loop from the first cue point to the last cue point.

ReleaseLoopReleaseWithJump - sound loop is stopped, typically grouped with the above play command.

StartLoop - sound is played in a continuous loop from the first cue point to the last cue point.

ReleaseLoopRelease - sound loop is stopped, typically grouped with the above play command.

SetStreamVolume - adjusts the Stream volume. Practically, you often use these as "on" and "off", so the value (1.0) = 100% and (0.0) = 0% respectively. This can be used if the trigger + sound is still playing in the background, but you want to mute the sound beforehand. Regarding volume of the sound in question, always try to make sure that the source WAV file has the correct volume or adjust this via an audio editor. (increase or decrease a few dB).

EnableTrigger - activates certain triggers (rules) within this stream. This means that a certain trigger (rule) may or may not work during certain moments in the simulator. It is also often used to define dependencies, so chooses like if "trigger-1 is allowed to work when trigger 3 is activated". IOW, a kind of temporary "on / off buttons", depending on what activity you are doing during the simulator. Again, the count is very important that it is filled in exactly. Also the 'reading order' from top to bottom, as the steam is executed in the simulator. So with adjustments always "10x check. For example, EnableTrigger ( x ) x = the trigger line number within the current groups of Triggers.

DisableTrigger - deactivates a certain trigger (line), as described with EnableTrigger.

Selection Method

The Selection Method command has the following format:
SelectionMethod ( x )
where x= file play method.

The following types of selection method commands are available to use:

SequentialSelection -each sound file is played "alternately" with each activation of the trigger. Naturally if there is only one file, then this will be the only filed played.

RandomSelection - each sound file is played "randomly" with each activation of the trigger.

General Comments

Some general remarks:

top


Key Open Rails Trigger Events for Sounds

The key trigger events in Open Rails that can have a sound attached to them are described in the following table.

Sound Events (updated Apr 2020)

top


Example Sound Configurations

In this section some simple sample sound configurations will be provided to help see how it all "comes together".

Each "sound function" (Horn, Bell, Doors open/close, Brakes, etc.) are configured separately in a "Stream". In this way, the sounds can also be used "independently of each other". The composition of the triggers (in a Stream) mainly depends on the function and the available sounds.

Example 1 -

For example when the driver in the cab operates the brakes the following configuration will play a WAV file that makes a sound like the brakes being released or applied.


Stream (
Skip ( **** AirTrainBrake**** )
Priority ( 6 )
Triggers ( 2
Discrete_Trigger ( 14 PlayOneShot ( 1 File ( "TrainBrake1.wav" -1 ) SelectionMethod ( SequentialSelection ) ) )
Discrete_Trigger ( 54 PlayOneShot ( 1 File ( "TrainBrake2.wav" -1 ) SelectionMethod ( SequentialSelection ) ) )

)
)

In this example: Two Triggers are configured which operate as follows, when Trigger event #14 (Train Brake Pressure Increase) is triggered, the WAV file TrainBrake1 will be played once. Similarly when Trigger event #54 (Train Brake Pressure Decrease) is triggered, the WAV file TrainBrake2 will be played once.

Example 2 -


Stream (
Skip ( **** Stoker sounds. ****)
Priority ( 5 )
Volume(0.3)
Triggers ( 2
Variable_Trigger ( Variable3_Inc_Past 1 StartLoopRelease ( 1 File ( "fuel_coal.wav" -1 ) SelectionMethod ( SequentialSelection ) ) )
Variable_Trigger ( Variable3_Dec_Past 1 ReleaseLoopRelease () )
)
)

In this example: Two Triggers are configured to provide sounds for the fuel stoker. The first trigger is activated once Variable3 increases beyond a value of 1. The WAV file is then played continuously until the second trigger is activated once Variable3 decreases below a value of 1, and hence stops playing the WAV.

Example 3 -


Stream (
Priority ( 6 )
Volume ( 0.5 )
Triggers ( 3
Initial_Trigger ( StartLoop ( 1 File ( "fs_power_cruise0.wav" -1 ) SelectionMethod ( SequentialSelection ) ) )

Variable_Trigger ( Speed_Inc_Past 0.1 ReleaseLoopRelease () )
Variable_Trigger ( Speed_Dec_Past 0.1 StartLoop ( 1 File ( "fs_power_cruise0.wav" -1 ) SelectionMethod ( SequentialSelection ) ) )
)
)

In this example: The Initial_Trigger is used to play the WAV file fs_power_cruise0.wav initially when first starting OR, and whilst the locomotive is stationary. The other two triggers are to turn this sound off if the spped of the locomotive is above 0.1m/s, ie the locomotive starts to move. Conversely if the locomotive speed drops below 0.1m/s (ie it is stationary) then the sound will be played again.

More complex sounds can be found by trying the locomotives which have been set up, and studying their respective sound files.

top


Creating WAV Files

top


Troubleshooting and Debugging

top


Useful Links

top