• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

Seeking Input for Voice System; Simplification

Messages
10,163
Country
us-arizona
Hey all,

I would like to pick your minds and get some advice.....

I have a voice system I wish to implement on this aircraft concept I am making. So far, I have about 75 voice files. I will surely have more.

Some will be so dang easy... Place SND112 in mouse click zone. Easy peasy... But some like 'Gear is Down and Locked', or Landing Lights Off, Taxi Lights On, Pitot Heater Off (conditionals from a toggle, not that easy). That would be a ton of work. I need it to not loop, not system-flood, so I need switches. I need to get it done in one year (lolololololol.. LOLOLOL.... ) Or should I say, I would like to finish this part in 1 day. So I was wondering... What if... there were a system of on's and off's.. a simplistic sort of system that could universally handle this duty...


And... I would like to be able to turn off the voice system, for those that do not like it...

Example; (perhaps?)

Click Landing Gear Switch. Plays 'Lowering Landing Gear'. Gear Down Flag is on... Gear gets to 100 percent, plays 'Gear is down and locked!' Flag turned off.

Any recommendations on a very simple work flow for something this large?

Do I need to take a course in Macross (Macro) ShortHand?

I have a feeling I may have busted the limit on my present sound system....

And that is another thing. My present sound system is based on SND1 through SND 200. I wonder if it would be possible to do a sound system that is based on names of files? This would make things terribly more easy to handle and manage. Example; Park Brake is Off, Rear Canopy is Closed and Secure (RearCanopyIsClosedAndSecure), etc, etc.

Any thoughts?


Bill
 
Just got an idea... I could create a Voice System gauge that would handle all voice files. From there, an Update section would monitor everything that voice links would flag into. From there, an overall circuit (Element) would exist that would be 'active for voice' with initiation; bool... 0 == and when you 'turn off' the voice, the system is 1 == and voices are then terminated by an overall Element surround shell.

That simplifies that.

Then I would need to figure a way to start doing the linking and flagging to systems.

I did a similar system like this with the Learjet LJ24B where I had Ambient sounds flowing from a single XML gauge. Things like landing gear wind noise and things flowed through there. Was pretty cool having sounds all located in one area (mainly). I wouldnt be able to use MouseClick sounds if I did this if I wanted to control the on/off of voice system. Would have to link over.. And that might be quite a bit more extra code writing.... hmm...
 
If only it was possible to create a simple sound system with custom sound names.. And thinking on that... Would it be possible to create a sound system that would be anti-loop-smart? Another words, it couldnt accidentally loop when triggered via a flood.

Example; Gear down, percent 100 (if) trigger 'GearIsDownAndLocked' sound file. The 'smart sound system' would run the voice system one time. No other tricks and hoops to fly through to keep the sound playing one time. (Normally if you did that, the system would play that sound in a flood cascade, even though you have it set to play once. The condition keeps sending the command).
 
Bill,
For something like that, I think you want to look at <On Event> That way, the sounds will get played regardless of where the command came from. You would want the co-pilot's responses played whether I dragged the gear lever in the VC, hit the G key on the keyboard or hit the gear key on my Saitek panel. The only things you would put in the mouse areas would be the commands for the mouse clicks sounds.
So, yes, a single sound control gauge will be the way to go.

For the gear, I would ignore the events as well and just concentrate on gear position
In an update section, you would want something like:

Code:
if (GearPosition != 0 and GearPosition != 16355) GearInTransit = 1
if (GearPosition == 0 and GearInTransit == 1) GearUpSoundRequired == 1
if (GearPosition == 16355 and GearInTransit == 1 ) GearDownSoundRequired == 1
if (GearUpSoundRequired == 1)
    {
    PlayGearUpSound
    GearUpSoundRequired = 0
    GearInTransit = 0
    }
if (GearDownSoundRequired == 1)
    {
    PlayGearDownSound
    GearDownSoundRequired = 0
    GearInTransit = 0
    }
Flaps would require a similar, if somewhat more complex approach, as there is presumably more than just up and down positions.

For toggle events, you of course need to then measure the current value of the position variable. Keep in mind that the value returned will be the value before the event takes effect. The events are being intercepted by the gauge before they are processed by the simulator.

With my sound gauge (and I think Bill's) you can explicitly load a sound for playback on the voice device (presumably the player's headphones.) This might help with the immersion a little.

Doug
 
Bill, I've mentioned many times that playing sounds is as easy as "1, 2, 3" and I mean that quite literally:
  • 1 - play sound once
  • 2 - play sound in a loop
  • 3 - stop looped sound
  • 4 - Set Sound Volume, using the single volume variable
  • 5 - Set Sound Pan, using the single pan variable
  • 6 - Load sound on Windows sound device (speakers)
  • 7 - Load sound on Windows voice device (headphones)
  • 8 - Unload sound
Granted that a single-shot playback is only guaranteed when called for in a mouse callback, but it's up to the developer to properly handle single-shot playback anywhere else. Using Doug's suggestion of <On Event> scheme is the easiest way to take care of this issue.

The reason why my sound gauge uses SNDnn.wav instead of "named" sound files is simply because it was required to keep it backwards compatible with the original sound module's naming convention.

Incidentally, the max number of sounds is 1000. Unless specified explicitly, the default the number of sounds is 200. I recommend however that you explicitly state the max number of sounds when loading the sound module as this will set up the array for only the number actually required.
 
I assume you are using Fr. Bill's modified sound gauge and that was based on Doug's gauge. (hopefully commands are the same)
It also assumes that if a command of 2 (loop) will continually restart the repeating sound if the command is flooding in.
None of the below has been tested as is but was taken from previous coding projects..

With 75 sounds for the system one should not just go into it "willy nilly" and start coding or using specialized L:Var names for sound, it will become a mess - guaranteed.

1st - Whatever sound gauge you are using (Doug Dawson or equiv) assign the sounds L:Vars using a strongly formatted type, that way <Macro>s can be used effectively. Also make notes of what L:Var_## applies to what sound for reference, a spreadsheet is perfect. Using well formatted L:Var names also makes it much easier to use, and, if wanted, the advanced pan/volume controls provided by Doug's gauge within <Macro>s. eg.

[LVars]
Lvar_000=SND_000
Lvar_001=SND_001
Lvar_002=SND_002
Lvar_003=SND_003
... and on

2nd - Anti - Loop feature.. In electronics it is called a "flip-flop" and is used as a very basic memory. You should also have a reset in your code to reset the flip-flop (as electronics do) so the end user would not have to reload the aircraft if a specific situation should need to reset it.

The macros..

XML:
<!--
GENERAL COMMAND FOR SOUND NO ANTI LOOP
1st parameter = sound gauge control number
2nd parameter = L:Var suffix of the sound
-->
<Macro Name="CmdSnd">@1 (>L:SND_@2, number)</Macro>

<!--
GENERAL COMMAND FOR SOUND USING ANTI LOOP
1st parameter = sound gauge control number
2nd parameter = L:Var suffix for both the sound and the flip flop
3rd parameter = Anti Loop set/reset, 1 = Set, 0 = Reset
-->
<Macro Name="AL_CmdSnd">@3 (L:SND_ALoop_@2, bool) != if{ @1 (>L:SND_@2, number) @3 (>L:SND_ALoop_@2, bool) }</Macro>

<!--
ANTI LOOP CONDITION - check state of anti loop just in case needed outside the above macro call
1st parameter = L:Var suffix for the flip flop (must be the same as sound number)
-->
<Macro Name="AL_Check">(L:SND_ALoop_@1, bool)</Macro>

<!--
ANTI LOOP RESET - just in case needed
1st parameter = L:Var suffix for the flip flop (must be the same as sound number)
-->
<Macro Name="AL_Reset">0 (>L:SND_ALoop_@1, bool)</Macro>

Some examples, assuming Doug's sound gauge commands -

XML:
<!-- SIMPLE, PLAY SOUND #076 ONCE, NO ANTI LOOP -->
blah blah blah if{ @CmdSnd(1, 076) }

<!-- SIMPLE, PLAY SOUND #054 REPEATING, NO ANTI LOOP -->
blah blah blah if{ @CmdSnd(2, 054) }

<!-- SIMPLE, STOP REPEATING SOUND #054, NO ANTI LOOP -->
blah blah blah if{ @CmdSnd(0, 054) }

<!-- ADVANCED, PLAY SOUND #076 ONCE,  USING ANTI LOOP -->
blah blah blah if{ @AL_CmdSnd(1, 076, 1) }

<!-- ADVANCED, RESET THE ANTI LOOP OF SOUND #076  -->
blah blah blah if{ @AL_Reset(076) }

<!-- ADVANCED, PLAY SOUND #022 REPEATING,  USING ANTI LOOP (this has a great purpose) -->
blah blah blah if{ @AL_CmdSnd(2, 022, 1) }

<!-- ADVANCED, STOP SOUND #022,  USING ANTI LOOP (this has a great purpose) -->
blah blah blah if{ @AL_CmdSnd(0, 022, 0) }

<!-- ADVANCED, COMBINE THE 2 ABOVE IN A IF ELSE -->
blah blah blah if{ @AL_CmdSnd(2, 022, 1) }  els{ @AL_CmdSnd(0, 022, 0) }

<!-- SOMETHING WITH A PURPOSE ;) -->
<!-- PLAY SOUND #073 REPEATEDLY WHEN THE CENTER GEAR IS IN TRANSIT ONLY, WITH ANTI LOOP -->
0.1 99.9 (A:Gear Center Position, Percent) rng if{ @AL_CmdSnd(2, 073, 1) } els{ @AL_CmdSnd(0, 073, 0) }

<!-- SOMETHING WITH A PURPOSE ;) -->
<!-- PLAY SOUND #088 REPEATEDLY WHEN THE CANOPY IS NOT CLOSED AND SPEED IS BETWEEN 100 AND 150 KTS, WITH ANTI LOOP -->
100 150 (A:AIRSPEED INDICATED, knots) rng (A:CANOPY OPEN, percent) 1 &gt; and if{ @AL_CmdSnd(2, 088, 1) } els{ @AL_CmdSnd(0, 088, 0) }

EDIT -- Another example and too much coffee lol!!
Situation = Taking girlfriend / wife up in your aerobatic aircraft
Sound #025 = Screaming
Trigger = Pulling greater than +4 g's or -2 g's
Play situation = sound only plays once as the g force(s) are exceeded but will not play again until a touch and go is performed..
Why? = too much coffee, being a goofball
XML:
<!-- TRIGGER -->
-2 4 (A:G FORCE, GForce) rng ! if{ @AL_CmdSnd(1, 025, 1) }

<!-- RESET ON TOUCH AND GO -->
@AL_Check(025) (A:SIM ON GROUND, bool) and if{ @AL_Reset(025) }
 
Last edited:
Some more advice ... maybe more than you need at this point.

Here, why not have a whole standalone two-engined a/c (WIP) that illustrates how it is done using Doug's Sound gauge (note, two versions, one FSX and one p3dv4). Install and carefully look at the sound gauges and files in folder panel.modern. Test in sim, to see what it can do (lots!), then copy it over to your setup and adapt as needed. Do give credit to Daniel Gauthier for his splendid system of xml coding switches, states, and cockpit chatter.

[edit: link removed]
 
Last edited by a moderator:
Many thanks guys for the input. Much appreciated.

MJahn wrote;
Test in sim, to see what it can do (lots!), then copy it over to your setup and adapt as needed.

I'll check this out. Just downloaded it.

Roman wrote;

EDIT -- Another example and too much coffee lol!!
Situation = Taking girlfriend / wife up in your aerobatic aircraft
Sound #025 = Screaming
Trigger = Pulling greater than +4 g's or -2 g's
Play situation = sound only plays once as the g force(s) are exceeded but will not play again until a touch and go is performed..
Why? = too much coffee, being a goofball

Sounds like me in the morning, lolol...
 
And... have begun revamping of sounds folder... conversion to SND's, conversion to WAV's, voice files created and renamed... legend created... Renaming of effects files... getting ready for the coding event... ack!
 
I have been looking for more information on 'On Event'. The only thing I have found so far is this in a section that Bjoern posted on one of my other posts.

Code:
0 (>L:LHC_WT9_Save, bool)
}
</Value>
</Select>
</Element>
<!-- Keys>
<On Event="SITUATION_SAVE">
1 (>L:LHC_WT9_Save, bool)
</On>
</Keys -->
</Gauge>

I have parused the FSX SDK and found nothing on this; 'On Event'. Can someone please explain it or point me to a thread that shows how to use this? (Very interesting... ) This would be fore XML?
 
Bill, the following is just one trivial example of the <On Event> command. It's purpose is to play the switch sound if someone turns on/off the autopilot master, regardless of whether it was a gauge click, a VC mouse click, or the keyboard:
Code:
  <Macro Name="AP_Click">
    1 (&gt;L:XMLSND2,enum)
  </Macro>
  <Keys>
    <On Event="AP_MASTER">@AP_Click</On>
  </Keys>
I've added a bunch of <On Key> and <On Event> commands at the bottom of the script for my 2d GNS530/430 gauges that will allow my 3D VC buttons/knobs to reference the 2D gauge's commands and @Macros:
Code:
   <Keys>
      <On Event="GPS_OBS_BUTTON">@OBSButton</On>
      <On Event="GPS_MSG_BUTTON">@MSGButton</On>
      <On Event="GPS_FLIGHTPLAN_BUTTON">@FPLButton</On>
      <On Event="GPS_TERRAIN_BUTTON">@TerrainButton</On>
      ....
   </Keys>
In essence, you can use any of the K:commands as an <On Event> as you wish.
 
Dang... I never knew this existed... Many thanks, Bill.

Would I be correct in saying one can write this with regular code as well as with Macro or does one need to combine this with Macro only?

Also, does this have an 'Off' Event? Another words, if it has 'On' then it must have 'Off' Event also, right? Even with half, with having 'On' that is good enough, but thought I would ask.

Many thanks,


Bill
 
The @Macro is simply for convenience (and also because they are necessary when used for gps500 based scripts!). You can issue any command you wish to as the operand of the <On Event> call. I could have written this instead of defining a @Macro for example.
Code:
  <Keys>
    <On Event="AP_MASTER">1 (&gt;L:XMLSND2,enum)</On>
  </Keys>
No, there is no "<Off Event>... :rotfl:
 
The @Macro is simply for convenience (and also because they are necessary when used for gps500 based scripts!). You can issue any command you wish to as the operand of the <On Event> call. I could have written this instead of defining a @Macro for example.
Code:
  <Keys>
    <On Event="AP_MASTER">1 (&gt;L:XMLSND2,enum)</On>
  </Keys>
No, there is no "<Off Event>... :rotfl:

Many thanks, Bill.
 
I found that I can have conditionals in a 'On Event' event. :D Sweet......


Code:
    <On Event="GEAR_TOGGLE">
              (A:GEAR LEFT POSITION,percent) 100 ==
                  if{ 1 (>L:XMLSND152,bool) }
                els{ 1 (>L:XMLSND142,bool) }
    </On>
 
Work continues on the 'coding event' of the AI Voice Pack system. It is alive!

Some samples...

Code:
// COMMS PAGE AI VP FLAG AND TRIGGER
        (A:ELECTRICAL MASTER BATTERY,bool) 1 ==
        (L:COMMS WAKEUP Switch,bool) 1 == and
        (L:COMMS PAGE AI VP FLAG,bool) 0 == and
            if{ 1 (>L:XMLSND120,bool)
                1 (>L:COMMS PAGE AI VP FLAG,bool) }
// RESET COMMS WAKEUP FLAG FOR AI VP
        (L:COMMS WAKEUP Switch,bool) 0 ==
        (L:COMMS PAGE AI VP FLAG,bool) 1 == and
            if{ 0 (>L:COMMS PAGE AI VP FLAG,bool) }
// LIGHTS PAGE AI VP FLAG AND TRIGGER
        (A:ELECTRICAL MASTER BATTERY,bool) 1 ==
        (L:LIGHTS2 PAGE WAKEUP Switch,bool) 1 == and
        (L:LIGHTS PAGE AI VP FLAG,bool) 0 == and
            if{ 1 (>L:XMLSND141,bool)
                1 (>L:LIGHTS PAGE AI VP FLAG,bool) }
// RESET LIGHTS PAGE WAKEUP AND FLAG FOR AI VP
        (L:LIGHTS2 PAGE WAKEUP Switch,bool) 0 ==
        (L:LIGHTS PAGE AI VP FLAG,bool) 1 == and
            if{ 0 (>L:LIGHTS PAGE AI VP FLAG,bool) }



  <Keys>
    <On Event="AP_MASTER">1 (&gt;L:XMLSND2,enum)</On>
    <On Event="GEAR_TOGGLE">
              (A:GEAR LEFT POSITION,percent) 100 ==
                  if{ 1 (>L:XMLSND152,bool) }
                els{ 1 (>L:XMLSND142,bool) }
    </On>
    <On Event="FLAPS_UP">1 (>L:XMLSND166,bool)</On>
    <On Event="FLAPS_DOWN">1 (>L:XMLSND165,bool)</On>
    <On Event="SPOILERS_TOGGLE">
               (A:SPOILERS LEFT POSITION,percent) 100 ==
                    if{ 1 (>L:XMLSND164,bool) }
                  els{ 1 (>L:XMLSND163,bool) }
    </On>
    <On Event="PARKING_BRAKES">
             (A:BRAKE PARKING POSITION,bool) 1 ==
                    if{ 1 (>L:XMLSND149,bool) }
                  els{ 1 (>L:XMLSND148,bool) }
     </On>
    <On Event="FLAPS_INCR"></On>
    <On Event="FLAPS_DECR">1 (>L:XMLSND165,bool)</On>
    <On Event="FLAPS_UP">1 (>L:XMLSND166,bool)</On>
    <On Event="FLAPS_DOWN">1 (>L:XMLSND165,bool)</On>
    <On Event="PITOT_HEAT_TOGGLE">
             (A:PITOT HEAT,bool) 1 ==
                    if{ 1 (>L:XMLSND150,bool) }
                  els{ 1 (>L:XMLSND151,bool) }
     </On>
    <On Event=""></On>
    <On Event=""></On>
    <On Event=""></On>
    <On Event=""></On>
    <On Event=""></On>
  </Keys>


I do not have the 'shell' on/off Element system created yet. Will do that soon as well. Just getting things operating.

I have lots of dings and bleeps, etc, in the system 'with' the Voice system, and didnt know how to handle that, as they overlap each other. I ended up splicing the sounds and voices so I didnt have to come up with a technology to stack them in play-order. Simplification is key.... (no pun intended... )
 
I have lots of dings and bleeps, etc, in the system 'with' the Voice system, and didnt know how to handle that, as they overlap each other.

You need some logic to check if the current play is finished before starting the next, and also to add the necessary delays between them. Something like this:
Code:
<Update>
    (A:STALL WARNING,bool) (>L:alarm_01,bool)
    (A:GENERAL ENG RPM:1,rpm) 2700 > (>L:alarm_04,bool)
    15.0 29.92 (A:ENG MANIFOLD PRESSURE:1,inHG) rng ! (>L:alarm_05,bool)
    26.0 30.2 (A:ELECTRICAL AVIONICS BUS VOLTAGE,volt) rng ! (>L:alarm_08,bool)
   
    (L:voice_pause,number) 0 > if{ (L:voice_pause,number) -- (>L:voice_pause,number) }
    els{
        (L:voice_id,number) 0 ==
        if{
            (L:voice_id,number) 0 == (L:voice_01,bool) 0 == (L:alarm_01,bool) and and if{ 1 (>L:voice_01,bool) 1 (>L:dsd_sound_01,number) 1 (>L:voice_id,number) }
            (L:voice_id,number) 0 == (L:voice_02,bool) 0 == (L:alarm_02,bool) and and if{ 1 (>L:voice_02,bool) 1 (>L:dsd_sound_02,number) 2 (>L:voice_id,number) }
            (L:voice_id,number) 0 == (L:voice_03,bool) 0 == (L:alarm_03,bool) and and if{ 1 (>L:voice_03,bool) 1 (>L:dsd_sound_03,number) 3 (>L:voice_id,number) }
            (L:voice_id,number) 0 == (L:voice_04,bool) 0 == (L:alarm_04,bool) and and if{ 1 (>L:voice_04,bool) 1 (>L:dsd_sound_04,number) 4 (>L:voice_id,number) }
            (L:voice_id,number) 0 ==
            if{
                0 sp0 (* flag reset *)
                (L:voice_01,bool) 0 > if{ 0 (>L:voice_01,bool) 1 sp0 }
                (L:voice_02,bool) 0 > if{ 0 (>L:voice_02,bool) 1 sp0 }
                (L:voice_03,bool) 0 > if{ 0 (>L:voice_03,bool) 1 sp0 }
                (L:voice_04,bool) 0 > if{ 0 (>L:voice_04,bool) 1 sp0 }
                l0 if{ 90 (>L:voice_pause,number) } (* 5 sec pause between cycles *)
            }
        }
        els{
            (L:voice_id,number) 1 == if{ (L:dsd_sound_01,number) 0 == if{ 0 (>L:voice_id,number) } }
            (L:voice_id,number) 2 == if{ (L:dsd_sound_02,number) 0 == if{ 0 (>L:voice_id,number) } }
            (L:voice_id,number) 3 == if{ (L:dsd_sound_03,number) 0 == if{ 0 (>L:voice_id,number) } }
            (L:voice_id,number) 4 == if{ (L:dsd_sound_04,number) 0 == if{ 0 (>L:voice_id,number) } }
            (L:voice_id,number) 0 == if{ 18 (>L:voice_pause,number) } (* 1 sec pause between alarms *)
        }
    }
</Update>

Here is a Complete Voice Gauge with some additional features:
https://www.fsdeveloper.com/forum/resources/e-i-av-17-voice-annunciator-gauge.224/

HTH.
 
Last edited:
Back
Top