openOMSI GitHub Discord

Docs / Routes and rail / Trolleybuses

Sounds

5 min readEdit this pagedocs/TROLLEYBUS.md

The gear makes six sounds of its own, from noise and decaying tones (no files):

Sound When Sound trigger Map key
hiss (a loop) the shoes sliding on the wire, louder with the current and the speed - (Trolley_Hiss, 0..1) -
arc crack current broken: a shoe leaving the wire or a pole coming off under load, an insulator or a frog crossed under power ev_trolleyarc -
frog clatter a shoe going through a frog ev_trolleyfrog (below) frog
contactor click the rheostat controller stepping ev_trolleycontactor -
thud a shoe landing on the wire or coming off it ev_trolleyhitup, wirehit, wireoff, dewire, hitmax (below) -
hook a pole's hook letting go or catching it ev_trolleyhookopen, hitdown (below) -
switch mechanism the selected leg actually changes, not when a shoe crosses it - (map-owned) switch

A vehicle plays its own recordings of the poles as OMSI 2 buses do their doors' (ev_doortriggeropen_0 as a door is ordered to move, ev_doorhitclose_0 as it hits its stop).

A pole's own triggers end in its number _<k>, from 1 as its Trolley_Pole<k> variables; the same trigger without the number plays for either pole (fired once when both do it in the same frame).

The game fires these for what happens to a pole, whoever moves it (a hand, a script's lifting gear, a bounce):

Sound trigger When What to record
ev_trolleyhookopen_<k> the pole is taken off its hook by hand the hook opening
ev_trolleyhitup_<k> its shoe lands on the wire the hit
ev_trolleywireoff_<k> its shoe is taken off the wire by the rope the shoe leaving it
ev_trolleyhitdown_<k> it comes down on the roof and its hook catches it the hit and the lock
ev_trolleydewire_<k> its shoe is thrown off the wire: a bounce, a bend, the bus too far aside the shoe flying off
ev_trolleyhitmax_<k> the loose boom is brought up short by its rope at max_angle the jolt
ev_trolleywirehit_<k> its shoe falls back on the wire after bouncing off it a knock
ev_trolleyfrog_<k> its shoe goes through a frog the clatter
ev_trolleyinsulator_<k> its shoe goes over a section insulator (silent without it) the click
ev_trolleyarc an arc's crack (see above) the crack
ev_trolleycontactor the rheostat controller steps the contactor

One recording for several of these is one [sound] with several [trigger]s, as OMSI 2's.

A vehicle's entry on a trigger replaces the game's own sound even while it is silent: a lifting gear's recording that has the shoe's hit in it (the script fires it with the run, as a door's opening) keeps the hit's own entry quiet while its script's run goes on, with a [volcurve] (a triggered sound's [conditionSingle] is not looked at, as in OMSI 2):

OMSI file
[sound]
pole_on_wire.wav
1
[trigger]
ev_trolleyhitup_1
[volcurve]
my_gear_running_1
[pnt]
0
1
[pnt]
1
0

Trolley_Pole<k>_Hit (0..1) is how hard pole k's last hit was (on the wire, back on it, against its rope), for a [volcurve] as OMSI 2's doorSpeed_<n>. A [volcurve] on Trolley_Pole<k>_Elev or _State cuts a run's sound short where a hand stops the pole, as door_<n> does a door's.

The boom's bounce has no sound of its own; a vehicle can loop a rattle or a spring's creak on Trolley_Pole<k>_Bounce (0..1).

The built-in hiss is located at each touching shoe, not the bus centre. Its maximum gain is 0.035: beyond 1 m a steep fade is added to the normal distance falloff, and it is completely silent at 5 m and beyond. It is also silent in the cab.

A bus-authored sound.cfg hiss keeps its own volume, viewpoint and 3-D settings; old sliding loops should not be played over the native hiss as well.

The other built-in sounds are at full volume within a set distance ([3d]-style: switch mechanism 15 m, arc crack 10 m, frog 8 m, thud and hook 6 m, contactors 4 m) and fall off as 1/d beyond.

In the player's cab the sounds on the roof come through the body at half volume and somewhat dull with doors and windows shut, a switch out on the line at a fifth and duller, both clear as doors and windows open (Snd_OutsideVol); the contactors are in the bus and are not muffled.

How a sound is heard is fixed when it starts: one started in the cab stays muffled if the view changes while it plays.

A vehicle plays its own the OMSI way, in its sound.cfg: an entry with [trigger] on one of the triggers above plays each time that happens (the game fires the trigger as a script's (T.L.ev_trolleyhitup_1) would), and the game's own sound is not played;

an entry whose volume curve or condition reads Trolley_Hiss takes the place of the hiss (a [sound] without a trigger loops; its [volcurve] on Trolley_Hiss makes it follow the hiss). An entry with a silent file or no volume silences a sound.

OMSI file
[sound]
sound\pole_hook.wav
1
[trigger]
ev_trolleyhookopen
[trigger]
ev_trolleyhitdown

[sound]
sound\shoe_hiss.wav
1
[volcurve]
Trolley_Hiss
[pnt]
0
0
[pnt]
1
1

A map chooses the overhead line's own sounds (frog crossings and switch movements) in a [trolley_sounds] block of its trolley.txt: each key on (the game's own), off, or a sound file beside trolley.txt (a file that cannot be read leaves the game's own). The vehicle's sounds (hiss, arc crack, contactors, thud, hook) are the vehicle's: those keys are ignored there with a warning.

Which plays: the vehicle's sound.cfg entry, else the map's choice, else the game's own. A vehicle and a map that say nothing hear the game's own sounds, as before.

switch is separate from frog: it plays once at the frog's world position whenever the selected leg really changes, including by radio, a power/indicator plate or a manual setting. Repeated selections, rejected requests and the initial state make no movement sound. This is a map sound, not a bus sound trigger.

It defaults to off, preserving existing maps' silence; switch on uses a generated metallic clack, and switch sounds\switch.wav uses the map's file. An unreadable replacement falls back to the generated clack. Multiple vehicles share the network's events, so the same movement is not played once per bus.

Something wrong or missing? Fix it on GitHub or open an issue.

↑↓ to move↵ to open