Sign in to follow this  
beercat

progressive volume with Doug Dawson's "dsd_fsx_xml_sound" gauge

Recommended Posts

Hi all,   
I use the  Doug Dawson's  "dsd_fsx_xml_sound" gauge regularly but I never succeeded to have a progressive sound while using the variable "dsd_xml_sound_volume_in". To avoid the problem (I don't have a big experience in xml programming), I use 4 wav files whose volume varies with some db. This gauge work perfectly but requires 4 wav files.   
  
 
<Element>
    <Select>
      <Value>
         (A:SIM ON GROUND,bool) not 
         9 11 (A:INCIDENCE ALPHA,degrees) rng and 
         if{ 2 (>L:buff1,number) } els{ 0 (>L:buff1,number) }
      </Value>
    </Select>
</Element>
 
<Element>
    <Select>
      <Value>
         (A:SIM ON GROUND,bool) not 
         11 13 (A:INCIDENCE ALPHA,degrees) rng and 
         if{ 2 (>L:buff2,number) } els{ 0 (>L:buff2,number) }
      </Value>
    </Select>
</Element>
 
<Element>
    <Select>
      <Value>
         (A:SIM ON GROUND,bool) not 
         13 15 (A:INCIDENCE ALPHA,degrees) rng and 
         if{ 2 (>L:buff3,number) } els{ 0 (>L:buff3,number) }
      </Value>
    </Select>
</Element>
 
<Element>
    <Select>
      <Value>
         (A:SIM ON GROUND,bool) not 
         (A:INCIDENCE ALPHA,degrees) 15 > and 
         if{ 2 (>L:buff4,number) } els{ 0 (>L:buff4,number) }
      </Value>
    </Select>
</Element>
  
 
Is it possible to replace these four wav files by only one and to use the variable "dsd_xml_sound_volume_in" to get the same result ?    
   
if INCIDENCE ALPHA < 9 = volume min
if INCIDENCE ALPHA > 15 = volume max
 
with a progressive sound between these two values
  
I hope that my English is not too bad !
 
Thank you for your help.
Jean Michel
Restauravia Team
 
 

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Hi Jean,

 

Yes, perfectly possible what you want, but you need the latest version of Doug's soundgauge (V5.2.0, dated Aug. 26th 2014) from his website.

With this version you can change the volume of each soundfile individually, in a much simpler way then with the ***_volume_in Lvar.

See the documentation in the zip file.

In the gauge:

<Element>
   <Select>
     <Value>
        (A:SIM ON GROUND,bool) !
        if{ 2 (>L:buff1,number) } els{ 0 (>L:buff1,number) }

        (A:INCIDENCE ALPHA,degrees) 9 -
        15 9 - /
        0 max 1 min
        3000 * 3000 -
        (>L:buff1_volume,number)
     </Value>
   </Select>
</Element>

and in the .ini file:

[Sounds]
Sound00= "YourSoundfile"

[LVars]
Lvar00=buff1

[Volume_Variables]
Lvar00=buff1_volume


So the sound is only On when aircraft is in the air, 
- with min. vol (-3000, almost inaudible) when INCIDENCE ALPHA < 9
- with max. vol (0) when INCIDENCE ALPHA > 15
- and volume lineairly between min and max when INCIDENCE ALPHA between 9 and 15.



Another substantial improvement of Doug's great gauge, since you don't need to hassle with the common volume_in Lvar (controlled by the soundcontrol-Lvar) anymore.

Which makes volume/pan control a lot easier to code.

 

You can even add a test to have the sound audible only in a certain View mode, using Lvar (L:ViewSystemStatus,number).

 

Rob

Share this post


Link to post
Share on other sites

Hi Jean,

 

You're welcome     :smile:

Glad to hear it worked for you.

As you can see, Doug made life so much easier with this new version ....

 

Cheers, Rob

Share this post


Link to post
Share on other sites
Hello Rob,

yes, it is much simpler with this new version.

Can I use the code freely for the future projects of the team ? I would mention your name in the "readme" file. 


Jean Michel


Restauravia Team


Share this post


Link to post
Share on other sites

No problem at all.

You can use/modify it as you like; it's just an example ......

 

Rob

Share this post


Link to post
Share on other sites

Hello, 

In the latest version of Doug's soundgauge (5.2.0), I did not understand the use of the variable " Frequency ".
 
[Frequency_Variables]
Lvar00=First_Frq_Var
Lvar01=Second_Frq_Var
 
In what case can we use it ?
Jean Michel
Restauravia Team

Share this post


Link to post
Share on other sites

I assume it has to do with the schedule frequency of the gauge (i.e. times per sec. to check start/stop etc. sounds).

Default: 18 times per sec.

So unless you're using 500-1000 sounds, I wouldn't worry about perfomance ....

 

Rob

Share this post


Link to post
Share on other sites
Actually, it has nothing to do with scheduling, but the Frequency_Variables Lvar for that sound is passed to DirectX.

Just checked that with Doug.

 

What is does:it changes both pitch and playing speed of the sound.

 

With the Lvar=0, pitch and speed are unaffected.

 

With Lvar positive, the Lvar influences speed and pitch around the sound’s sample frequency.

Example:

If the sound’s sample frequency is 11025 Hz: (== bitrate 88 kbps for a mono sound)

- Lvar=11025 plays the sound at normal speed and pitch.

- Lvar=5512.5 halves the play speed and pitch.

- Lvar=22050 doubles the play speed and pitch.

 

Very nifty feature; I allready have an application for it .....

 

Rob

Share this post


Link to post
Share on other sites

 

Actually, it has nothing to do with scheduling, but the Frequency_Variables Lvar for that sound is passed to DirectX.
Just checked that with Doug.
 
What is does:it changes both pitch and playing speed of the sound.
 
With the Lvar=0, pitch and speed are unaffected.
 
With Lvar positive, the Lvar influences speed and pitch around the sound’s sample frequency.
Example:
If the sound’s sample frequency is 11025 Hz: (== bitrate 88 kbps for a mono sound)
- Lvar=11025 plays the sound at normal speed and pitch.
- Lvar=5512.5 halves the play speed and pitch.
- Lvar=22050 doubles the play speed and pitch.
 
Very nifty feature; I allready have an application for it .....
 
Rob

 

 

Thankyou for the explanation Rob. I will have to look into this. :BigGrin:

Share this post


Link to post
Share on other sites

hello Rob

this fonction is very interesting ! Does it mean that we can modulate the pitch of à sound progressively in proportion to, for example, the speed of the plane ?

Jean Michel

Restauration team

http://www.restauravia.fr

Share this post


Link to post
Share on other sites

hello Rob

this fonction is very interesting ! Does it mean that we can modulate the pitch of à sound progressively in proportion to, for example, the speed of the plane ?

Jean Michel

Restauration team

http://www.restauravia.fr

Hi Jean,

 

Yes, for whatever criterium you want. So airspeed is one of them.

 

Note though, that the Frequency_Variables Lvar changes both pitch of the sound AND the speed at which it is played. See my post above. 

So for a simple .wav sound (like a pure Sinwave) that is played repetitively, "speed" doesn't matter.

However, the sound is also compressed/extented in time which can lead to very funny (and maybe: undesirable) results for more complex sounds.

 

By the way: my explanation on sound pitch/speed change is just based on what I observe when I "play" with this Lvar .....

 

Rob

Share this post


Link to post
Share on other sites
 
Hi Rob,
I'm gonna go see if i can find a code which corresponds to the action that I look for: a second variable which would increase the pitch of the wind sound proportionally with the speed of the plane with a progressive sound when the cockpit is opened.
It would be necessary to use 
 
[sounds]
Sound00=wind.wav
 
[LVars]
Lvar00=wind
 
[Volume_Variables]
Lvar00=wind_volume
 
[Frequency_Variables]
Lvar00=wind_pitch
 
for the same sound file. But i don't now if is it possible.
 
with your help Rob, I write this code for the progressive wind volume.
 
<Element>
   <Select>
     <Value>
        (A:General eng rpm:1,RPM) 10 >
        (L:ViewSystemStatus,number) 2 == and
        (A:EXIT OPEN:0,percent) 2 > and
        if{ 2 (>L:wind,number) } els{ 0 (>L:wind,number) }
        (A:EXIT OPEN:0,percent) 2 -
        100 2 - /
        0 max 1 min
        2000 * 2000 -
        (>L:wind_volume,number)
     </Value>
   </Select>
</Element>
 
This gauge offers so much possibility as I would like to exploit it at the most.
Doug's sound gauge increases the realism of fsx and I could not make any more without. Thank Mr Dawson !
... and thank you for your help !
Jean Michel
Restauravia team 
http://www.restauravia.fr 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this