Testing New Sound Controls for Diesels

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pschlik
    Senior Member



    • Jun 2011
    • 289
    • Missouri
    • MSOR

    #1

    Testing New Sound Controls for Diesels

    I have begun work on a series of diesel engine improvements that have been at the back of my mind for some time. To start, sound.

    Existing diesel engines have had pretty limited capabilities for sounds, which has similarly limited how immersive those sounds can be. Really the only thing the sound system gives you is "Variable2" which depends on engine RPM but is measured on a scale of 0-1 for whatever reason. On locomotives with multiple engines, you can't make sounds that depend on what other engines are doing (Variable2 is based on the first engine only). You can't make sounds for the engine starting up or shutting down (Variable2 returns 0.0 when the engine is idle, but it also returns 0.0 when the engine is off, can't tell the difference). And the big annoyance is that there just isn't a way to make sounds that depend on how hard the engine is working (Variable2 will be 1.0 when the engine is a full speed whether the reverser is in neutral or the engine is actually working hard at full power).

    To address that, I have added sound controls for engine RPM (like, actual engine RPM, not Variable2), engine power, and engine torque, all of which work with multiple engines. And there are also controls for the tractive effort and power at the wheels, which diesel locomotives didn't have access to before, and those might be useful for transmission or motor sounds.

    This is only in unstable versions or OR, as well as the latest NewYear MG, I think. But I know a bunch of you have felt disconnected from new features, and I think there are some folks here who would find these features useful. I'm not the expert in sounds, I've just done a little messing around is all, so there might be other ideas that would be useful that I didn't think of. Do give it a try and share ideas:

    New sound variable! EngineRPMControlled
    • Allows for programming sounds to respond based on actual engine RPM values, instead of a unitless value from 0 to 1.
    • Works for all RPM values, even below idle RPM or above max RPM.
    • Special setup in the parser allows for an arbitrary number of engines to be supported. EngineXRPMControlled will respond to the RPM of the Xth engine, so Engine2RPMControlled will use the RPM of the second engine. (If the engine number specified is invalid, or the locomotive has no diesel engines, the control will always return 0 RPM. If the value "X" is not present, the 1st engine is used.)
    • For triggers, EngineRPM_Inc_Past and EngineRPM_Dec_Past can be used, and this also supports multiple engines EngineXRPM_Inc_Past and EngineXRPM_Dec_Past

    New sound variable! EnginePowerControlled
    • Controls sounds in response to actual instantaneous engine power output, with all values assumed to be in watts unless power units are given in the .sms file. Very useful for making sounds that change depending on how hard the engine is working, instead of how fast it is spinning.
    • Also supports multiple engines, following the syntax EngineXPowerControlled, eg ``Engine2PowerControlled``. As before, if there is no engine "X", the control will return 0 kW, and if the value is not present then the power output of the 1st engine will be used.
    • For triggers, use EnginePower_Inc_Past or EnginePower_Dec_Past, and for multiple engines EngineXPower_Inc_Past and EngineXPower_Dec_Past.

    New sound variable! EngineTorqueControlled
    • Similar to engine power, but for personal preference some creators may find torque more appropriate to measure instantaneous power output. All torque values specified in the .sms file are assumed to be newton-meters.
    • For multiple engines, use EngineXTorqueControlled. Same rules as usual, if engine number "X" doesn't exist, a value of 0 is used, and if "X" isn't included the 1st engine is assumed.
    • On triggers, use EngineTorque_Inc_Past and EngineTorque_Dec_Past for single engine locomotives, and EngineXTorque_Inc_Past and EngineXTorque_Dec_Past on multi engine locomotives.

    New sound variable (for all locomotives)! TractiveEffortControlled
    • Control sounds depending on the tractive effort applied by the locomotive, regardless of type, using values in newtons by default (or other force units as defined in the .sms file), instead of arbitrary 0-1 values.
    • Positive tractive effort values indicate tractive effort in the same direction as motion, but negative values will be produced as well to indicate effort opposite the direction of travel (such as dynamic braking).
    • This also has triggers, TractiveEffort_Inc_Past and TractiveEffort_Dec_Past.

    New sound variable (for all locomotives)! TractivePowerControlled
    • Influence sounds using the power, in watts unless other power units are specified in the .sms, applied at the rail, regardless of locomotive type. Note that this is after all transmission losses, set values accordingly.
    • Like tractive effort, positive power is in the same direction as the direction of travel (like when accelerating), while negative power will be returned if power is in the opposite direction to the direction of travel (like dynamic braking).
    • Triggers are TractivePower_Inc_Past and TractivePower_Dec_Past.

    Don't know what newton-meters of torque your engine is producing? Use the updated sound debug window (Alt + S) and select the locomotive from the list of sound sources to see the W, N, N-m, etc values used by the sound system without the need to manually do a bunch of conversions.
    Last edited by pschlik; 06-22-2026, 22:51.

    Contributing to ORTS since 2023
    Find me on GitHub @SteelFill

    Like what I do? Join my Patreon to help me do more!
  • pschlik
    Senior Member



    • Jun 2011
    • 289
    • Missouri
    • MSOR

    #2
    Heads up to anyone wanting to try this, I changed the way units work to allow .sms files to accept units of measure like any other part of OR does. But that meant changing the default units. If you don't specify units for tractive effort then the units are now assumed to be NEWTONS (previously, this was kilonewtons), and if you don't specify units for tractive power or engine power then the value is assumed to be in WATTS (previously, this was kilowatts).

    Unfinished features can have changes like this that technically break things, so be careful getting too deep into unstable versions.

    Now, the plus side is that instead of doing this:
    Code:
            FrequencyCurve(
                    Engine2PowerControlled
                    CurvePoints ( 4
                            990             16050
                            1330            18050
                            1800            20050
                            2125            22050
                    )
                    Granularity ( 100 )
            )
    You can now do this (if horsepower is your preferred unit):
    Code:
            FrequencyCurve(
                    Engine2PowerControlled
                    CurvePoints ( 4
                            1325hp          16050
                            1790hp          18050
                            2415hp          20050
                            2850hp          22050
                    )
                    Granularity ( 100 )
            )​
    Or if you liked using kilowatts, you'll have to change it to something like this:
    Code:
            FrequencyCurve(
                    Engine2PowerControlled
                    CurvePoints ( 4
                            990kW             16050
                            1330kW            18050
                            1800kW            20050
                            2125kW            22050
                    )
                    Granularity ( 100 )
            )​
    This isn't just for the new sound controls though. A few relevant existing variables can also have custom units entered (and this should work for variable triggers too, not just curves):
    • Distance/CarDistanceTrack/CarTunnelDistance[Controlled/_Inc_Past/_Dec_Past] accept all normal ORTS distance units such as ft or mi, default is still meters
    • Speed[Controlled/_Inc_Past/_Dec_Past] accepts all normal ORTS speed units like mph, default is still m/s
    • BrakeCyl/BackPressure[Controlled/_Inc_Past/_Dec_Past] accept all normal ORTS pressure units from bar to kPa, default is still psi
    • CurveForce/TractiveEffort[Controlled/_Inc_Past/_Dec_Past] accept all normal ORTS force units which still includes kN, default is now newtons (was always newtons for CurveForce)
    • TractivePower/EnginePower[Controlled/_Inc_Past/_Dec_Past] accept all normal ORTS power units, both hp and kW are included, default is now watts​

    Contributing to ORTS since 2023
    Find me on GitHub @SteelFill

    Like what I do? Join my Patreon to help me do more!

    Comment

    • jbtower
      Senior Member


      • Jul 2005
      • 572
      • Yorkville, Illinois, USA.
      • ORTS

      #3
      I'm impressed!
      Kevin Kelleher

      Comment

      • wwhall
        Senior Member


        • May 2010
        • 652
        • Kansas
        • MSOR

        #4
        This looks very intriguing. I've posted over on Elvas Tower over the years wishing for a lot of these features, plus one more: being able to having Automatic Engine Start Stop (AESS)--with the associated sounds--possible. The challenge there is both the sound files and capability for AESS enabled, but also to have the locomotive "aware" of its coolant temperature, outside temperature, operating state, and other parameters that control AESS.

        Comment

        • pschlik
          Senior Member



          • Jun 2011
          • 289
          • Missouri
          • MSOR

          #5
          The next thing I'm working on is a lot more control over engine RPM, including the option to define custom behaviors based on various data points. That could achieve various AESS configurations without the need for a bespoke feature, as long as whoever is making the engine does the proper set-up.

          Might have some of the simpler parts of it in Unstable this weekend, though so far it's taken a lot of behind the scenes changes since nobody's really messed with diesel engine behavior for like 10 years. I will make threads when that is available and explain the changes and new things.

          Edit: Parts of the aforementioned change is available now on Unstable versions, see this thread to discuss. For now, there are no custom behaviors (instead, I spent time improving the underlying behavior of engines, especially making fuel consumption more realistic) like AESS, but there is changing engine RPM with ETS (HEP) enabled and changing RPM with dynamic brakes. That also has some consequences for the sound changes; engine power output now changes when the engine increases in speed (more power output, sounds react accordingly) and when the engine decreases in speed (less power output, possibly even negative if engine friction dominates), and it's now possible to make engines that run at constant RPM with only power output changing with throttle setting-a perfect use case for the new sounds.
          Last edited by pschlik; 07-26-2026, 04:00.

          Contributing to ORTS since 2023
          Find me on GitHub @SteelFill

          Like what I do? Join my Patreon to help me do more!

          Comment

          • pschlik
            Senior Member



            • Jun 2011
            • 289
            • Missouri
            • MSOR

            #6
            Another update, not related to diesel sounds specifically, but this thread is morphing to be more about work on sounds in general.

            Multiple .sms files can now be defined at once in Unstable, though just for interior and exterior sounds on trains. I have yet to investigate other parts of the program for more .sms files, but trains are usually the most complicated sound-emitting objects, so that's where this is most useful.

            To use multiple .sms files, simply add a space after the previous one and type in another:
            Code:
                 Sound ( "..\\..\\Common.Snd\\Engine_16-645E3.sms" "..\\..\\Common.Snd\\Horn_K3LA.sms" )

            You can add as many as you like, and it doesn't have to be split between engines and horns, choose however you want to divide things up to make a modular sound set. Repeat the setup for interior .sms files in the Engine ( section. Just note that you cannot define multiple .sms files by using multiple Sound parameters. Like other parts of OR, adding additional copies of a parameter will override any previous copies. Make sure your updated Sound parameters go at the end of the Wagon ( and Engine ( section to override any old ones.

            This works much like how track sounds work; all the given .sms files are processed at the same time as independent sound sources, and the sound streams of each will play according to the rules defined. The updated sound debug window will show each .sms file separately, keeping things organized and understandable. Note that this means each .sms file needs to have the proper structure, with TR_Sms, ScalabiltyGroup, Activation, Deactivation, and so on. Even if the .sms file only plays 1 sound stream, it still needs all that header data to work correctly.

            There is some extra processing required to handle more sound sources, even if the total number of sound streams is the same. This means technically it is more efficient to assemble a modular sound set using include files (a lot of people seem to not realize that include files can be used in any of the structured text formats used by OR, this includes .sms and .cvf files. See my mods for examples on how sounds and cab views can use include files) to generate one exterior .sms file and one interior .sms file. However, the include file approach is more complicated and adds yet more files to your hard drive, so which method is used is down to what feels right. Of course, the methods can be combined to use multiple .sms files, each of which is assembled from many .inc files. Feel free to get creative and try things out.

            Contributing to ORTS since 2023
            Find me on GitHub @SteelFill

            Like what I do? Join my Patreon to help me do more!

            Comment

            • Erick_Cantu
              1000 Post Veteran


              • Jun 2004
              • 1041
              • Brighton, MA 02135
              • General

              #7
              The ability to use include code in SMS files is something that didn't actually work before - I tried it once and the sim was not happy! But that was around 2022 or so. Much has probably changed since then! When I have time, I want to put together a test locomotive, probably with some spare parts, and do an all-up test.

              Thanks for all the cool work!
              Erick Cantu
              North American V-Scale
              Facebook | Email
              Those who would give up essential liberty, to purchase a little gasoline, deserve neither liberty nor gasoline.

              Comment

              • pschlik
                Senior Member



                • Jun 2011
                • 289
                • Missouri
                • MSOR

                #8
                I've used include files with sounds for a few years now, too long to remember if anything specific changed at any point. But you can get pretty granular, down to doing things like specifying an individual volume curve in an include file. Just need to be careful to make sure the include file includes the right amount of syntax, it can be a lot less obvious how much is required with files as complicated and fragile as the SMS's, and remember the usual rules like starting and ending the include file with blank lines.

                Contributing to ORTS since 2023
                Find me on GitHub @SteelFill

                Like what I do? Join my Patreon to help me do more!

                Comment

                • pwillard
                  3000 Post Veteran



                  • Nov 1999
                  • 3070
                  • Cumming Ga
                  • ORTS

                  #9
                  Slightly off-topic question here, but can scenery items have sounds, with "file includes"?
                  http://www.railsimstuff.com
                  Just Blender now, 3DCrafter only when I have to.
                  Formerly The Keystone Works (All Permissions Granted)
                  Things I work on: https://github.com/pwillard

                  Comment

                  • pschlik
                    Senior Member



                    • Jun 2011
                    • 289
                    • Missouri
                    • MSOR

                    #10
                    Sure, no reason that wouldn't work. I think uncompressed .w/.ws files can use includes, but that's definitely not a commonly used technique.

                    Contributing to ORTS since 2023
                    Find me on GitHub @SteelFill

                    Like what I do? Join my Patreon to help me do more!

                    Comment

                    • pschlik
                      Senior Member



                      • Jun 2011
                      • 289
                      • Missouri
                      • MSOR

                      #11
                      These features will appear in this week's testing version on Friday and will then be in the next stable version 1.7 whenever we get around to it.

                      Contributing to ORTS since 2023
                      Find me on GitHub @SteelFill

                      Like what I do? Join my Patreon to help me do more!

                      Comment

                      Working...