Gradient Sounds; 3 Stages

#1
Hey all,

Trying to model a landing gear wind noise that would have 3 stages of sounds. Low, medium and high attached to speed ranges and with 'gear down'.

Having problems with it behaving. I have tried a few things, nothing is working. The first try worked 2x then quit during the flight. Meaning, it worked 2 times dropping the gear, then stopped after that.

Can someone tell me what I am doing wrong? Perhaps you see a flaw in the code?

Original single sound system;

Code:
        (A:AIRSPEED SELECT INDICATED OR TRUE,knots) 100 >
          if{ (A:GEAR LEFT POSITION,percent) 20 >
              if{ 2 (>L:XMLSND173,enum) }
             els{ 3 (>L:XMLSND173,enum) } }

        (A:AIRSPEED SELECT INDICATED OR TRUE,knots) 99 <
        (A:GEAR LEFT POSITION,percent) 0 < or
              if{ 3 (>L:XMLSND173,enum) }
First try...

Code:
        (A:SIM ON GROUND,bool) !
        (A:AIRSPEED SELECT INDICATED OR TRUE,knots) 80 > and
          if{ (A:GEAR LEFT POSITION,percent) 1<
              if{ 2 (>L:XMLSND173,enum) 
                  2 (>L:XMLSND181,enum) or
                  2 (>L:XMLSND182,enum) or
                     if{ 3 L:XMLSND173,enum)
                         3 L:XMLSND181,enum)
                         3 L:XMLSND182,enum) } } }
2nd and 3rd try, variated...

Code:
// ACTIVATIONS

        80 100 (A:AIRSPEED SELECT INDICATED OR TRUE,knots) rng
          if{ (A:GEAR LEFT POSITION,percent) 20 >
              if{ 2 (>L:XMLSND181,enum) } }

        101 125 (A:AIRSPEED SELECT INDICATED OR TRUE,knots) rng
          if{ (A:GEAR LEFT POSITION,percent) 20 >
              if{ 2 (>L:XMLSND182,enum) } }

        126 400 (A:AIRSPEED SELECT INDICATED OR TRUE,knots) rng
          if{ (A:GEAR LEFT POSITION,percent) 20 >
              if{ 2 (>L:XMLSND173,enum) } }

// SHUT DOWNS

        (A:AIRSPEED SELECT INDICATED OR TRUE,knots) 10 >
          if{ (A:GEAR LEFT POSITION,percent) 0 <
              (>L:XMLSND181,enum) 2 == and 
             if{ 3 (>L:XMLSND181,enum) } }

        (A:AIRSPEED SELECT INDICATED OR TRUE,knots) 10 >
          if{ (A:GEAR LEFT POSITION,percent) 0 <
              (>L:XMLSND182,enum) 2 == and 
             if{ 3 (>L:XMLSND182,enum) } }

        (A:AIRSPEED SELECT INDICATED OR TRUE,knots) 10 >
          if{ (A:GEAR LEFT POSITION,percent) 0 <
              (>L:XMLSND173,enum) 2 == and 
             if{ 3 (>L:XMLSND173,enum) } }
 
#2
Too many syntax errors and typos ... better not use plain greater/less than ops, check bracketing and value assignments to your Lvars. First code snippet looks okay that way, so take it from there.
 
#3
Thanks Manfred. Immediately see a couple of mistakes here on the big screen.

Still had problems, so I ended up modifying and separating the original section into sections with ranges. Worked nicely.

Code:
<!-- LANDING GEAR WIND NOISE -->

// SOFT
        80 99 (A:AIRSPEED SELECT INDICATED OR TRUE,knots) rng
          if{ (A:GEAR LEFT POSITION,percent) 20 &gt;
              if{ 2 (&gt;L:XMLSND181,enum) }
             els{ 3 (&gt;L:XMLSND181,enum) } }

        (A:AIRSPEED SELECT INDICATED OR TRUE,knots) 80 &lt;
        (A:AIRSPEED SELECT INDICATED OR TRUE,knots) 99 &gt; or
        (A:GEAR LEFT POSITION,percent) 0 &lt; or
              if{ 3 (&gt;L:XMLSND181,enum) }

// MEDIUM
        100 134 (A:AIRSPEED SELECT INDICATED OR TRUE,knots) rng
          if{ (A:GEAR LEFT POSITION,percent) 20 &gt;
              if{ 2 (&gt;L:XMLSND182,enum) }
             els{ 3 (&gt;L:XMLSND182,enum) } }

        (A:AIRSPEED SELECT INDICATED OR TRUE,knots) 99 &lt;
        (A:AIRSPEED SELECT INDICATED OR TRUE,knots) 135 &gt; or
        (A:GEAR LEFT POSITION,percent) 0 &lt; or
              if{ 3 (&gt;L:XMLSND182,enum) }

// LOUD
        (A:AIRSPEED SELECT INDICATED OR TRUE,knots) 135 &gt;
          if{ (A:GEAR LEFT POSITION,percent) 20 &gt;
              if{ 2 (&gt;L:XMLSND173,enum) }
             els{ 3 (&gt;L:XMLSND173,enum) } }

        (A:AIRSPEED SELECT INDICATED OR TRUE,knots) 134 &lt;
        (A:GEAR LEFT POSITION,percent) 0 &lt; or
              if{ 3 (&gt;L:XMLSND173,enum) }

Odd that it takes the written version of greater then and less then and makes them < and > symbols on the web posting.
 

n4gix

Resource contributor
#4
It would have been far simpler still to use the volume control... Just saying!

For example, here is a "volume control knob" that I use in my sound module "Test Gauge":
Code:
    <Area Left="362" Top="70" Height="70" Width="70">
      <Cursor Type="Hand"/>
      <Tooltip>Volume</Tooltip>
      <Click Kind="LeftSingle+RightSingle+WheelUp+WheelDown+DownRepeat">
        (M:Event) 'LeftSingle' scmp 0 ==
        (M:Event) 'WheelDown' scmp 0 == or
        if{ (L:VolKnob, enum) -- 0 max (>L:VolKnob, enum) (L:XMLSND5_VOL, enum) -4000 &gt; if{  (L:XMLSND5_VOL,enum) 40 - (>L:XMLSND5_VOL,enum) } }
        (M:Event) 'RightSingle' scmp 0 ==
        (M:Event) 'WheelUp' scmp 0 == or
        if{ (L:VolKnob, enum) ++  100 min (>L:VolKnob, enum) (L:XMLSND5_VOL, enum) 0 &lt; if{ (L:XMLSND5_VOL,enum) 40 + (>L:XMLSND5_VOL,enum) } }
      </Click>
    </Area>
Every XMLSNDn file has a corresponding XMLSNDn_VOL variable available. You need only set the volume level before playing the sound, or if you wish you can control the volume dynamically while the sound is playing as in the example above.

Note that this form of volume control is based on attenuation of the sound. The range is from -10000 (silence) to 0 (full volume). However, in practice -4000 is effectively dead silence, so my range in the example above is limited from -4000 to 0 in 40 unit steps.

With this scheme, you could adjust the volume level based on the actual airspeed for smooth and continuous change in wind noise.
 
#5
That is brilliant, Bill! Very interesting.

I would need to see how you work the coding on that or I fear it would take me 6 months to figure it out. :(

Many thanks for the heads up on this.


Bill
LHC
 
#6
Hi,

Since you don't need the mouse stuff, you can ignore that. This part is what you need, and means:

Code:
(L:XMLSND5_VOL, enum) -4000 &gt; if{  (L:XMLSND5_VOL,enum) 40 - (>L:XMLSND5_VOL,enum)
(L:XMLSND5_VOL, enum) is the volume your sounds will play at (I assume all sounds?).

If (L:XMLSND5_VOL, enum) is greater than -4000 then reduce the value of this variable by 40 and store it back into the variable. Now your volume is 40 less than it was before.

So if you need a specific file to play at a specific volume, you could do something like:

Code:
 -2000  (&gt;L:XMLSND5_VOL,enum)  2 (&gt;L:XMLSND182,enum)
Then after this line you could reset the volume to the default (0?) to play any further sounds.

This is all based on assumptions how this works, hopefully I'm not too far off.
 

Heretic

Resource contributor
#7
I could never figure out how the volume variable works. From Bill's code, I take that the value range is 0 to 9000. But is it global?
 

n4gix

Resource contributor
#10
That is absolutely correct. We can't actually "increase" volume, but we can "attenuate" the volume dynamically via my sound module. There are two separate "volume" controls; individual and global. In the mouse section I posted previously, I gave an example of individual volume control of one specific sound. That control works just like a volume knob on a home stereo or television. Fully quiet to full volume!

nnn (>L:XMLSND_VOLUME,number) is Global control, range is -100 decibels (-10000) to 0 decibels (0).
nnn (>L:SMLSNDx_VOL,number) is Individual control, range is -100 decibels (-10000) to 0 decibels (0).

Similarly to the above, you can also control the PAN position, such that the sound is sent to the left or right channel's speaker, or anywhere in between. This means that a switch on the pilot's side is spatially correct, or the 'wind' from an open window will likewise have correct spatial orientation.

For pan, a value of -10000 is a 100 decibel attenuation of the right channel, so full left pan, while a value of 10000 is a 100 decibel attenuation of the left channel, so full right pan. As with the volume, the effective range is closer to 40 dB, so -4000 to 4000 is sufficient.

nnn (>L:XMLSND_PAN,number) is Global control, range is -100 decibels (-10000) to 100 decibels (10000).
nnn (>L:SMLSNDx_PAN,number) is Individual control, range is -100 decibels (-10000) to 100 decibels (10000).

There are many, many ways one can use this functionality to enhance their project. One example would be to mute all cockpit sounds when not in the VC... :idea:
 

rcbarend

Resource contributor
#13
Yes, Doug's freeware module can do all of this as well. :cool:
Hi Bill,

If you don't mind me asking:
With this reply (and another reply you made in another thread started by Bill ("Lionheart") ), makes me think you have made your own version of Doug Dawsons XMLsound module.
Am I right ?
And if so: is there any relation ?
Just curious ....

Rob
 

n4gix

Resource contributor
#14
Doug assisted me greatly when I was expanding the sound module. While I had a working system, his contributions greatly simplified and expanded the features! Perhaps his greatest contribution though was taking the ubiquitous "gaugesound.dll" and turning it into a library so that it was no longer required to be present in the sim's root folder, and also by compiling both x86 and x64 versions of the library.

One of the challenges he helped me overcome was to keep my existing customers' released products working while still adding more features and options.
 
Top