• 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.

MSFS Trying to make animation sounds get working in legacy, but no joy, help !

Messages
162
Country
italy
Following the SDK i wrote this piece of xml code to be set into model xml file:
Code:
<Behaviors>
<RootComponent ID="COCKPIT_SWITCHES">
<Component ID="battery_switch" Node="battery_switch">
    <AnimationTriggers Animation="battery_switch">
        <EventTrigger Count="1" Direction="Forward">
        <SoundEvent WwiseEvent="LARGE_SWITCH_CLICK" Action="Play"/>
        </EventTrigger>
    </AnimationTriggers>
</Component>
</RootComponent>
</Behaviors>
also the sound.xml in sound folder:
Code:
<SoundInfo Version="0.1">
<!--
    <WwisePackages>
        <MainPackage Name="Asobo_VL3"/>
    </WwisePackages>
-->
  <AcousticParameters>
      <Parameter Name="ReverberationPreset" ShareSetInside="rev_inside_vl3"/>
      <Parameter Name="Insulation_ExitClosed" Value="-10"/>
      <Parameter Name="Insulation_ExitOpen" Value="0"/>
  </AcousticParameters>
  <AnimationSounds>
      <Sound Wwisedata="false" WwiseEvent="LARGE_SWITCH_CLICK" FileName="large_switch_click" ViewPoint="Inside"/>
  </AnimationSounds>
</SoundInfo>

always receiving this error on console window:
Code:
Model behaviors XML
File: ssw_g_91_interior.xml
Component: COCKPIT_SWITCHES:battery_switch
<AnimationTriggers> : no Animation defined in COCKPIT_SWITCHES:battery_switch.
actually stuck here, tried several others ways such as:
Code:
<Behaviors>
<!-- INCLUDES -->
<Include ModelBehaviorFile="Asobo\Common.xml"/>
<Include ModelBehaviorFile="Asobo\Generic.xml"/>
<Include ModelBehaviorFile="Asobo\Exterior.xml"/>
<RootComponent ID="COCKPIT_SWITCHES">
<Component ID="battery_switch" Node="battery_switch">
<UseTemplate Name="ASOBO_GT_AnimTriggers_SoundEvent">
    <ANIM_NAME>battery_switch</ANIM_NAME>
    <WWISE_EVENT>LARGE_SWITCH_CLICK</WWISE_EVENT>
   </UseTemplate>
</Component>
</RootComponent>
</Behaviors>
having the same error from console.
Pretty sure animation has been set on model sources (.gltf)
Any ideas ?
tia
/Mario
 
Last edited:
Messages
238
Country
unitedkingdom
3 months later Mario.. did you become expert at having a switch in MSFS make a 'click' sound?

A cut-and-paste of the <model>.xml would be super helpful.

<rant>TBH the Asobo templates haven't really worked IMHO, as you go through 7 layers of abstraction to find a fairly convoluted base layer to cope with every use case, and eventually your case turns into a couple of lines of XML.</rant>
 
Messages
100
Country
ukraine
So far I only use
sound.xml
and it works. I tried to do something like the one described by you, but it also does not work out yet.
XML:
        <Sound WwiseData="true" WwiseEvent="sound" ViewPoint="Inside" NodeName="MeshNeme" LocalVar="VAR" Continuous="false" BreakOnStop="true">
            <Range LowerBound="1" />
            <Range UpperBound="0" />
        </Sound>
or 3 positions
XML:
        <Sound WwiseData="true" WwiseEvent="tumbler2" ViewPoint="Inside" NodeName="RAP_VSU" LocalVar="RAP_VSU" Continuous="false" BreakOnStop="true">
            <Range LowerBound="1" />
        </Sound>
        <Sound WwiseData="true" WwiseEvent="tumbler" ViewPoint="Inside" NodeName="RAP_VSU" LocalVar="RAP_VSU" Continuous="false" BreakOnStop="true">
            <Range UpperBound="0" />
        </Sound>
        <Sound WwiseData="true" WwiseEvent="tumbler" ViewPoint="Inside" NodeName="RAP_VSU" LocalVar="RAP_VSU" Continuous="false" BreakOnStop="true">
            <Range LowerBound="0" />
        </Sound>
        <Sound WwiseData="true" WwiseEvent="tumbler1" ViewPoint="Inside" NodeName="RAP_VSU" LocalVar="RAP_VSU" Continuous="false" BreakOnStop="true">
            <Range UpperBound="-1" />
        </Sound>
or 9 positions (galet)
XML:
        <Sound WwiseData="true" WwiseEvent="galetnyk9" ViewPoint="Inside" NodeName="DC_volts" LocalVar="DC volts" Continuous="false" BreakOnStop="true">
            <Range LowerBound="9" />
            <Range LowerBound="8" />
        </Sound>
        <Sound WwiseData="true" WwiseEvent="galetnyk8" ViewPoint="Inside" NodeName="DC_volts" LocalVar="DC volts" Continuous="false" BreakOnStop="true">
            <Range LowerBound="8" />
            <Range UpperBound="7" />
        </Sound>
        <Sound WwiseData="true" WwiseEvent="galetnyk7" ViewPoint="Inside" NodeName="DC_volts" LocalVar="DC volts" Continuous="false" BreakOnStop="true">
            <Range LowerBound="7" />
            <Range UpperBound="6" />
        </Sound>
        <Sound WwiseData="true" WwiseEvent="galetnyk6" ViewPoint="Inside" NodeName="DC_volts" LocalVar="DC volts" Continuous="false" BreakOnStop="true">
            <Range LowerBound="6" />
            <Range UpperBound="5" />
        </Sound>
        <Sound WwiseData="true" WwiseEvent="galetnyk5" ViewPoint="Inside" NodeName="DC_volts" LocalVar="DC volts" Continuous="false" BreakOnStop="true">
            <Range LowerBound="5" />
            <Range UpperBound="4" />
        </Sound>
        <Sound WwiseData="true" WwiseEvent="galetnyk4" ViewPoint="Inside" NodeName="DC_volts" LocalVar="DC volts" Continuous="false" BreakOnStop="true">
            <Range LowerBound="4" />
            <Range UpperBound="3" />
        </Sound>
        <Sound WwiseData="true" WwiseEvent="galetnyk3" ViewPoint="Inside" NodeName="DC_volts" LocalVar="DC volts" Continuous="false" BreakOnStop="true">
            <Range LowerBound="3" />
            <Range UpperBound="2" />
        </Sound>
        <Sound WwiseData="true" WwiseEvent="galetnyk2" ViewPoint="Inside" NodeName="DC_volts" LocalVar="DC volts" Continuous="false" BreakOnStop="true">
            <Range LowerBound="2" />
            <Range UpperBound="1" />
        </Sound>
        <Sound WwiseData="true" WwiseEvent="galetnyk1" ViewPoint="Inside" NodeName="DC_volts" LocalVar="DC volts" Continuous="false" BreakOnStop="true">
            <Range LowerBound="1" />
            <Range UpperBound="0" />
        </Sound>
 
Last edited:
Messages
238
Country
unitedkingdom
Trying to get an animated switch to play a WAV sound is harder than I expected. I've downloaded every freeware project I can find and haven't found a working example.

I am assuming, as mariomarotta says, this requires setup in model/<aircraft>.xml and sound/sound.xml - I don't see how the KAI31 example would work on its own.

In my tests below I'm trying to trigger a Wwise event button_switch_generic on one animated switch, and a 'legacy' sound custom_sound_01 on another animated switch, but no joy either way.

So far I have in sound.xml:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<SoundInfo Version="1.0">
    <WwisePackages>
        <MainPackage Name="Asobo_DA62"/>
    </WwisePackages>

    ... a lot of stuff from the Asobo file I copied (that is working e.g. for engine, wind sounds, etc.)

<AnimationSounds>

    <!-- GENERIC  ###############################################################-->
       <!-- Buttons =============================================================-->
       <Sound WwiseData="true" WwiseEvent="button_switch_generic" ViewPoint="Inside"/>

        ... a lot of other <Sound> entries from the Asobo file I copied, the I added:

        <Sound WwiseData="false" WwiseEvent="custom_sound_01" FileName="mysound"/> <!-- assume it will use sound/mysound.wav -->
    </AnimationSounds>
</SoundInfo>

And in model/<aircraft>.xml:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<ModelInfo>
    <LODS>
        .. usual stuff
    </LODS>
    <NodeAnimation type="WingFlex">
        .. usual stuff
    </NodeAnimation>

<Behaviors>
    <!-- INCLUDES ###################################-->
        <Include ModelBehaviorFile="Asobo\Common.xml"/>
        <Include ModelBehaviorFile="Asobo\Exterior.xml"/>
    <!-- ###################################-->

    <AnimationTriggers Animation="LED_switch">
            <EventTrigger Count="2" Direction="Both">
                   <SoundEvent WwiseEvent="button_switch_generic" Action="Play"/>
            </EventTrigger>
    </AnimationTriggers>

    <AnimationTriggers Animation="Radio_button">
            <EventTrigger NormalizedTime="0.1" Direction="Forward">
                <SoundEvent WwiseEvent="custom_sound_01" Action="Play"/>
            </EventTrigger>
            <EventTrigger NormalizedTime="0.9" Direction="Backward">
                <SoundEvent WwiseEvent="custom_sound_01" Action="Play"/>
            </EventTrigger>
   </AnimationTriggers>

</Behaviors>

   ... lots of other animations

    <Animation name="LED_switch" guid="16bac68d-ce1c-47ad-89f2-d228f8069d60" type="Sim" typeParam="AutoPlay" typeParam2="LED_switch" length="100"/>
    <PartInfo>
        <Name>LED_switch</Name>
        <AnimLength>100</AnimLength>
        <Animation>
            <Parameter>
                <Lag>500</Lag>
                <Code>(A:LIGHT STROBE, boolean) if{ 0 } els{ 100 }</Code>
            </Parameter>
        </Animation>
    </PartInfo>

    .. and there's a similar entry for Radio_button.

For the custom_sound_01 I have a file sound/mysound.wav which I've confirmed is ok with MSFS (it plays if I swap it into something else).

You can see I've unpicked the whole 'Template' chain for Behaviours with the <AnimationTriggers> taken from the asobo-aircraft-common base-level templates.

Given this template unpicking, I think mariomarotta's issue is the lack of the <Animation name="battery_switch" ...> in the model/<aircraft.xml> file, but why it's not in there I don't know (it looks like his second template example should have added it). Personally I'd unwind the templates to try and work that out.

ANY clues of what I should do to get a WAV file to play on a switch click would be appreciated.
 
Messages
100
Country
ukraine
My sound files are packed in kai31_tu134.PC.PCK using WWISE. And there is a pack in the Sound folder

sound.xml
XML:
?xml version="1.0" encoding="utf-8" ?>

<SoundInfo Version="0.1">

    <WwisePackages>
        <MainPackage Name="kai31_tu134"/>
    </WwisePackages>
 
<!-- AlwaysPlaySounds ========================================================================================== -->  
  <!-- TRIGGERS SOUNDS ========================================================================================== --> 

    <!-- RATTLES ========================================================================================== -->    
    <!-- MISC ========================================================================================== -->     

    
      <!-- RAIN ========================================================================================== --> 
    
  
<!-- AnimationSounds ####################################################################################-->  

<AnimationSounds>


</AnimationSounds>


<SimVarSounds>

<!-- COMMON  #############################################################################################-->
    <!-- ELECTRICAL ========================================================================================== -->  

        <Sound WwiseData="true" WwiseEvent="tumbler1" ViewPoint="Inside" NodeName="AKK1" LocalVar="AKK1" Continuous="false" BreakOnStop="true">
            <Range LowerBound="1" />
        </Sound>
        <Sound WwiseData="true" WwiseEvent="tumbler2" ViewPoint="Inside" NodeName="AKK1" LocalVar="AKK1" Continuous="false" BreakOnStop="true">
            <Range UpperBound="0" />
        </Sound>

  </SimVarSounds>

</SoundInfo>


XML:
 <?xml version="1.0" encoding="utf-8" ?>
<ModelInfo version="1.1" guid="{xxxxxxxxxxxxxx-xxxx-xxxxx-xxxx-xxxxxxxxx}">
    <LODS>
        <LOD minSize="150" ModelFile="TU134_interior.gltf"/>
    </LODS>

<Behaviors>
    ......
 
</Behaviors>


<Animation name="AKK1" guid="xxxxxxx-xxxxxx-xxxx-xxxxx-xxxxxxxxxxx" typeParam2="AKK1" length="10" type="Sim" typeParam="AutoPlay" />
  <PartInfo>
    <Name>AKK1</Name>
    <AnimLength>10</AnimLength>
    <Animation>
      <Parameter>
        <Code>(L:AKK1,bool) 10 *</Code>
        <Lag>100</Lag>
      </Parameter>
    </Animation>
    <MouseRect>
      <Cursor>Hand</Cursor>
      <CallbackCode>(L:akk1_kolp,bool) if{ (L:AKK1,bool) ! (&gt;L:AKK1,bool) }</CallbackCode>
    </MouseRect>
  </PartInfo>

 
Last edited:
Messages
238
Country
unitedkingdom
KAI31 - thank you so much for posting here - with your advice I was able to get my switch to 'click', using your sound.xml 'simvar' method rather than the model/<aircraft>.xml 'AnimationTriggers' I was trying. I'm currently using the Asobo DA62 'soundbank' and can't be 100% sure what's in there so was never sure which bit of my code was broken, but the button_switch_generic WwiseEvent is working fine.

With your help I've ended up with the following code, where I can flip a local var L:SOUND_CLICK in any animation <Code> to have the 'click' sound occur, E.g.

model/<aircraft>.xml :
Code:
    <Animation name="LED_switch" guid="16bac68d-ce1c-dead-beef-d228f8069d60" type="Sim" typeParam="AutoPlay" typeParam2="LED_switch" length="100"/>
    <PartInfo>
        <Name>LED_switch</Name>
        <AnimLength>100</AnimLength>
        <Animation>
            <Parameter>
                <Lag>500</Lag>
                <Code>(A:LIGHT STROBE, boolean) d (&gt;L:SOUND_CLICK, boolean) if{ 0 } els{ 100 }</Code>
            </Parameter>
        </Animation>
    </PartInfo>

sound/sound.xml:
Code:
<SimVarSounds>
     ... other entries

    <Sound WwiseData="true" WwiseEvent="button_switch_generic" ViewPoint="Inside" NodeName="LED_switch" LocalVar="SOUND_CLICK" Continuous="false" BreakOnStop="true">
    </Sound>
</SimVarSounds>
 
Messages
100
Country
ukraine
With your help I've ended up with the following code, where I can flip a local var L:SOUND_CLICK in any animation <Code> to have the 'click' sound occur, E.g.
Always happy to help.

Yes, I know that you can make a trigger on a variable - a switch via 'd (>VAR)' , but I don't do that because I want every click and on different switches to sound different, that's why I've written everything like that.
 
Messages
32
Country
australia
I think it may have been broken in one of the recent updates. This code used to work for me
Model xml:
XML:
<UseTemplate Name="ASOBO_GT_Anim_Code">
                <ANIM_NAME>AIRFRAME_CanopySlider</ANIM_NAME>
                <PART_ID>AIRFRAME_CanopySlider</PART_ID>
                <ANIM_LENGTH>100</ANIM_LENGTH>
                <ANIM_CODE>
                        (L:AIRFRAME_CanopySlider, number) 100 *
                </ANIM_CODE>
                <AnimationTriggers Animation="AIRFRAME_CanopySlider">
                <EventTrigger NormalizedTime="0.1" Direction="Backward">
                    <SoundEvent WwiseEvent="canopy_open" Action="Play"/>
                </EventTrigger>
                <EventTrigger NormalizedTime="0.1" Direction="Forward">
                    <SoundEvent WwiseEvent="canopy_close" Action="Play"/>
                </EventTrigger>
                <EventTrigger NormalizedTime="0.9" Direction="Backward">
                    <SoundEvent WwiseEvent="canopy_open" Action="Play"/>
                </EventTrigger>
                </AnimationTriggers>
            </UseTemplate>

In Sounds xml (inside animation sounds):
XML:
<Sound WwiseData="true" WwiseEvent="canopy_close" ViewPoint="Inside"/>
    <Sound WwiseData="true" WwiseEvent="canopy_open" ViewPoint="Inside"/>
    <Sound WwiseData="true" WwiseEvent="canopy_slide" ViewPoint="Inside"/>

It was working for me, and more seemingly more reliable than the simvar checks. In my case it was the only way to go since the Lvar was just a bool and not a sliding/animating float.

It seems to no longer work
 
Messages
32
Country
australia
Ignore my last, the animation sound triggers work fine. In my example, the animation triggers need to be moved OUTSIDE the template (duh).
 
Messages
238
Country
unitedkingdom
This is still causing me grief after many months. I can get a 'stock' sound to play from inside the 110 megabyte DA62 sound pack on a pre-defined 'event', but I absolutely have not managed to get a 38 kilobyte 'hello.wav' to play from a file directly in the sound folder.

I.e. all I want to do is change a var and have a wav file play. Surely that is the simplest possible custom trigger of a sound?

For successfully playing a sound already built into a Wwise Sound Pack, I have the following, which emits a 'click' sound (from the DA62 sound bank) whenever I toggle my L:SOUND_CLICK variable:
Code:
<SimVarSounds>
     ... other entries

    <Sound WwiseData="true" WwiseEvent="button_switch_generic" ViewPoint="Inside" NodeName="LED_switch" LocalVar="SOUND_CLICK" Continuous="false" BreakOnStop="true">
    </Sound>
</SimVarSounds>

The SDK says to use WwiseData="false" and FileName="hello" to play a file called sound/hello.wav but gives no examples of a complete <Sound> entry using those parameters.

Has ANYONE out there got a working example of a <Sound> entry in sound.xmlwhich plays a wav file from the sound folder which you can trigger by simply toggling a variable?
 
Messages
238
Country
unitedkingdom
And after a fair amount of pain, I've found the solution. For some reason the WwiseEvent property is still required even though you are using a custom WAV, so this works:

Code:
    <Sound WwiseData="false" WwiseEvent="STALL_WARNING" FileName="take_up_slack" ViewPoint="Inside" NodeName="gauge_radio"
        LocalVar="SOUND_TAKE_UP_SLACK" Continuous="false" BreakOnStop="true"/>

The WwsiseEvent="STALL_WARNING" is irrelevant but necessary.

In this example:
(L:SOUND_TAKE_UP_SLACK, number)can simply be toggled between 0 and 1 and each time it changes the sound/take_up_slack.wav audio file (16-bit PCM) will play once eachtime the var changes.
 
Messages
10,055
Country
us-arizona
And after a fair amount of pain, I've found the solution. For some reason the WwiseEvent property is still required even though you are using a custom WAV, so this works:

Code:
    <Sound WwiseData="false" WwiseEvent="STALL_WARNING" FileName="take_up_slack" ViewPoint="Inside" NodeName="gauge_radio"
        LocalVar="SOUND_TAKE_UP_SLACK" Continuous="false" BreakOnStop="true"/>

The WwsiseEvent="STALL_WARNING" is irrelevant but necessary.

In this example:
(L:SOUND_TAKE_UP_SLACK, number)can simply be toggled between 0 and 1 and each time it changes the sound/take_up_slack.wav audio file (16-bit PCM) will play once eachtime the var changes.

Interesting that you needed STALL_WARNING. It must be a keyway to add things into the Wwise system. Nice find.

This is a single sound that I got working, custom sound, and entered into the Sound.XML;
This entry is in the SimVarSounds section;

<Sound WwiseData="false" WwiseEvent="custom_sound_02" FileName="window_sliding_closed" LocalVar="SUN SHADES" Continuous="false" ViewPoint="Inside" Direction="Backward" ChangedOnly="true"/>
Note, you can only have 12 custom sounds.

I tried for a double sound on the same LocalVar, but that isnt possible presently in Wwise.

<Sound WwiseData="false" WwiseEvent="custom_sound_01" FileName="window_sliding_open" LocalVar="SUN SHADES" Continuous="false" ViewPoint="Inside" Direction="Forward" ChangedOnly="false"/> <Sound WwiseData="false" WwiseEvent="custom_sound_02" FileName="window_sliding_closed" LocalVar="SUN SHADES" Continuous="false" ViewPoint="Inside" Direction="Backward" ChangedOnly="true"/>

Only the second one works.
 
Messages
10,055
Country
us-arizona
Small note. If you are doing a 'custom sound' that will not be in the PCK, you must enter <Sound WwiseData="false" .... so that the system knows its from outside of the PCK sound pack.

And... of course, place your WAV file in the Sound folder with those.
You can use Asobo stock PCK's and tap into most of their stock sound systems that link into the common named parts/animations/node names, etc. If you used the Behavior names for parts, then if you drop in the Asobo Savage Cub, for instance, you should immediately have linked sounds 'working' that are tied into animations in the sim, such as knob sounds, click sounds, the joystick noises and squeaks, etc, etc. You can also delete the engine sound section from the SoundXML in your planes sound folder and put in a Legacy sound file setup as a secondary sound system. But test it first. I have done this successfully with 2 planes, but one started to malfunction. The engine now cuts out intermittently on exterior view modes.

I dont know how hard the Wwise system is to 'compile' things, but this part has me really happy. Its not toooo difficult, once you figure out how its done. It had me worried before.
 
Top