SOUND EXAMPLES

This section contains examples of the contents of the sound.xml / soundai.xml file for various different situations.

 

Complete Sound XML Example

The example below shows a complete sound definition for an aircraft in Microsoft Flight Simulator. After this we will show some shorter example code related to specific features from the sound XML:

<?xml version="1.0" encoding="utf-8" ?>
<SoundInfo Version="0.1">
    <WwisePackages>
        <MainPackage Name="Asobo_CRJ1000"/>
    </WwisePackages>
    <AcousticParameters>
        <Parameter Name="ReverberationPreset" ShareSetInside="rev_inside_default"/>
        <Parameter Name="Insulation_ExitClosed" Value="-24"/>
        <Parameter Name="Insulation_ExitOpen" Value="-12"/>
    </AcousticParameters>
    <AlwaysPlaySounds>
        <Sound WwiseData="true" WwiseEvent="YOKE_MOVEMENT" ViewPoint="Inside" NodeName="YOKE_PILONE_L_LOD00">
            <WwiseRTPC SimVar="YOKE X POSITION" Units="PERCENT" Index="0" Derived="true" RTPCName="SIMVAR_YOKE_X_POSITION_DERIVED"/>
            <WwiseRTPC SimVar="YOKE Y POSITION" Units="PERCENT" Index="0" Derived="true" RTPCName="SIMVAR_YOKE_Y_POSITION_DERIVED"/>
        </Sound>
        <Sound WwiseData="true" WwiseEvent="rattle_kinematic" >
            <WwiseRTPC SimVar="ROTATION VELOCITY BODY X" Units="PERCENT" Index="0" RTPCName="SIMVAR_ROTATION_VELOCITY_BODY_X"/>
            <WwiseRTPC SimVar="ROTATION VELOCITY BODY Y" Units="PERCENT" Index="0" RTPCName="SIMVAR_ROTATION_VELOCITY_BODY_Y"/>
            <WwiseRTPC SimVar="ROTATION VELOCITY BODY Z" Units="PERCENT" Index="0" RTPCName="SIMVAR_ROTATION_VELOCITY_BODY_Z"/>
        </Sound>
    </AlwaysPlaySounds>
    <WindSounds>
        <Sound WwiseEvent="wind_sound" WwiseData="true" />    
    </WindSounds>
    <GroundSounds>
        <Sound WwiseEvent="CENTER_TOUCHDOWN" FadeOutType="2" FadeOutTime="0.5" WwiseData="true" >
            <WwiseRTPC SimVar="WHEEL RPM" Units="RPM" Index="0" Derived="true" RTPCName="SIMVAR_WHEEL_RPM_DERIVED"/>
        </Sound> 
        <Sound WwiseEvent="LEFT_TOUCHDOWN" FadeOutType="2" FadeOutTime="0.5" WwiseData="true" >  
            <WwiseRTPC SimVar="WHEEL RPM" Units="RPM" Index="1" Derived="true" RTPCName="SIMVAR_WHEEL_RPM_DERIVED"/>
        </Sound>
        <Sound WwiseEvent="RIGHT_TOUCHDOWN" FadeOutType="2" FadeOutTime="0.5" WwiseData="true" >
            <WwiseRTPC SimVar="WHEEL RPM" Units="RPM" Index="2" Derived="true" RTPCName="SIMVAR_WHEEL_RPM_DERIVED"/>
        </Sound>
        <Sound WwiseEvent="GROUND_ROLL" WwiseData="true" FadeOutType="2" FadeOutTime="0.2"/>
        <Sound WwiseEvent="LEFT_WING_SCRAPE" WwiseData="true" />
        <Sound WwiseEvent="RIGHT_WING_SCRAPE" WwiseData="true" />
        <Sound WwiseEvent="FUSELAGE_SCRAPE" WwiseData="true" />
        <Sound WwiseEvent="CRASH_SOUND" WwiseData="true" />
        <Sound WwiseEvent="SPLASH_SOUND" WwiseData="true" />
    </GroundSounds>
    <MiscellaneousSounds>
        <Sound WwiseEvent="EXIT_OPEN" WwiseData="true" />
        <Sound WwiseEvent="GEAR_DOWN" WwiseData="true" />
        <Sound WwiseEvent="GEAR_UP" WwiseData="true" />
        <Sound WwiseEvent="FUEL_PUMP" WwiseData="true" />
        <Sound WwiseEvent="STALL_WARNING" WwiseData="true" />
        <Sound WwiseEvent="OVERSPEED_WARNING_SOUND" WwiseData="true" />
        <Sound WwiseEvent="NO_SMOKING_ALERT" WwiseData="true" />
        <Sound WwiseEvent="SEATBELTS_ALERT" WwiseData="true" />
    </MiscellaneousSounds>
    <EngineSoundPresets>
        <Sound WwiseEvent="Combustion" ConeHeading="180" WwiseData="true" EngineIndex="1" FadeOutType="2" FadeOutTime="5"/>
        <Sound WwiseEvent="Combustion" ConeHeading="180" WwiseData="true" EngineIndex="2" FadeOutType="2" FadeOutTime="5"/>
        <Sound WwiseEvent="JetWhine" WwiseData="true" EngineIndex="1" RPMMin="1"/>
        <Sound WwiseEvent="JetWhine" WwiseData="true" EngineIndex="2" RPMMin="1"/>
    </EngineSoundPresets>
    <SimVarSounds> 
        <Sound WwiseData="true" WwiseEvent="aileron_left" NodeName="AILERON_LEFT_LOD01" ContinuousStopDelay="1.0" SimVar="AILERON POSITION" Units="PERCENT" Index="1">
            <WwiseRTPC SimVar="AILERON POSITION" Units="PERCENT" Index="1" RTPCName="SIMVAR_AILERON_POSITION" />
        </Sound>
        <Sound WwiseData="true" WwiseEvent="aileron_right" NodeName="AILERON_RIGHT_LOD01" ContinuousStopDelay="1.0" SimVar="AILERON POSITION" Units="PERCENT" Index="0">
            <WwiseRTPC SimVar="AILERON POSITION" Units="PERCENT" Index="0" RTPCName="SIMVAR_AILERON_POSITION" />
        </Sound>
        <Sound WwiseData="true" WwiseEvent="rudder" NodeName="RUDDER_LOD01" ContinuousStopDelay="1.0" SimVar="RUDDER POSITION" Units="PERCENT" Index="0">
            <WwiseRTPC SimVar="RUDDER POSITION" Units="PERCENT" Index="0" RTPCName="SIMVAR_RUDDER_POSITION" />
        </Sound>
        <Sound WwiseData="true" WwiseEvent="elevator" NodeName="ELEVATOR_TRIM_LEFT_LOD01" ContinuousStopDelay="1.0" SimVar="ELEVATOR POSITION" Units="PERCENT" Index="0">
            <WwiseRTPC SimVar="ELEVATOR POSITION" Units="PERCENT" Index="0" RTPCName="SIMVAR_ELEVATOR_POSITION" />
        </Sound>
        <Sound WwiseData="true" WwiseEvent="flaps_left" NodeName="FLAP_LEFT04A_LOD00" ContinuousStopDelay="1.0" SimVar="TRAILING EDGE FLAPS LEFT PERCENT" Units="PERCENT" Index="0">
            <Requires SimVar="FLAP DAMAGE BY SPEED" Units="BOOL" Index="0">
                <Range UpperBound="0" />
            </Requires>    
            <WwiseRTPC SimVar="TRAILING EDGE FLAPS LEFT PERCENT" Units="PERCENT" Derived="true" Index="0" RTPCName="SIMVAR_TRAILING_EDGE_FLAPS_LEFT_PERCENT_DERIVED" />
        </Sound>
        <Sound WwiseData="true" WwiseEvent="flaps_right" NodeName="FLAP_RIGHT04A_LOD00" ContinuousStopDelay="1.0" SimVar="TRAILING EDGE FLAPS RIGHT PERCENT" Units="PERCENT" Index="0">
            <Requires SimVar="FLAP DAMAGE BY SPEED" Units="BOOL" Index="0">
                <Range UpperBound="0" />
            </Requires>    
            <WwiseRTPC SimVar="TRAILING EDGE FLAPS RIGHT PERCENT" Units="PERCENT" Derived="true" Index="0" RTPCName="SIMVAR_TRAILING_EDGE_FLAPS_RIGHT_PERCENT_DERIVED" />
        </Sound>
        <Sound WwiseEvent="GEAR_MOVEMENT" WwiseData="true" FadeOutType="2" FadeOutTime="0.1" SimVar="GEAR TOTAL PCT EXTENDED" Units="PERCENT">
            <WwiseRTPC SimVar="GEAR TOTAL PCT EXTENDED" Units="PERCENT" Index="0" RTPCName="SIMVAR_GEAR_TOTAL_PCT_EXTENDED" />
            <WwiseRTPC SimVar="GEAR TOTAL PCT EXTENDED" Units="PERCENT" Derived="true" Index="0" RTPCName="SIMVAR_GEAR_TOTAL_PCT_EXTENDED_DERIVED" />
        </Sound>
        <Sound WwiseData="true" WwiseEvent="lever_throttle" ViewPoint="Inside" NodeName="LEVER_THROTTLE_1_LOD00" ContinuousStopDelay="1.0" SimVar="GENERAL ENG THROTTLE LEVER POSITION" Units="PERCENT" Index="1">
            <WwiseRTPC SimVar="GENERAL ENG THROTTLE LEVER POSITION" Units="PERCENT" Index="1" Derived="true" RTPCName="SIMVAR_GENERAL_ENG_THROTTLE_LEVER_POSITION_DERIVED" />
        </Sound>
        <Sound WwiseData="true" WwiseEvent="pedal_movement" ViewPoint="Inside" NodeName="YOKE_L" ContinuousStopDelay="1.0" SimVar="RUDDER PEDAL POSITION" Units="PERCENT" Index="0">
            <WwiseRTPC SimVar="RUDDER PEDAL POSITION" Units="PERCENT" Index="0" Derived="true" RTPCName="SIMVAR_RUDDER_PEDAL_POSITION_DERIVED" />
        </Sound>
        <Sound WwiseData="true" WwiseEvent="rattle_ground" ViewPoint="Inside" FadeOutType="2" FadeOutTime="0.5" ContinuousStopDelay="0.5" SimVar="SIM ON GROUND" Units="BOOLEAN" Index="0">
            <Range LowerBound="1.0" />
            <Requires SimVar="GROUND VELOCITY" Units="METERS PER SECOND" Index="0">
                <Range LowerBound="0.1" />
            </Requires>
            <WwiseRTPC SimVar="GROUND VELOCITY" Units="METERS PER SECOND" Index="0" RTPCName="SIMVAR_GROUND_VELOCITY" />
            <WwiseRTPC SimVar="SURFACE TYPE" Units="ENUM" Index="0" RTPCName="SIMVAR_SURFACE_TYPE" />
            <WwiseRTPC SimVar="GENERAL ENG COMBUSTION SOUND PERCENT" Units="PERCENT OVER 100" Index="1" RTPCName="SIMVAR_GENERAL_ENG_COMBUSTION_SOUND_PERCENT" />      
        </Sound>   
        <Sound WwiseData="true" WwiseEvent="rain_sound" SimVar="AMBIENT PRECIP RATE" Units="millimeters of water" Index="0"> 
            <Range LowerBound="0.1" />
            <WwiseRTPC SimVar="AMBIENT PRECIP RATE" Units="millimeters of water" Index="0" RTPCName="SIMVAR_AMBIENT_PRECIP_RATE"/> 
            <WwiseRTPC SimVar="AIRSPEED INDICATED" Units="KNOTS" Index="0" RTPCName="SIMVAR_AIRSPEED_INDICATED"/> 
        </Sound>
    </SimVarSounds>
</SoundInfo>

 

 

Wwise Package Definition Examples

When using WwisePackages, the definition should be done at the start of the XML using the <WwisePackages> element, like this:

<WwisePackages>
    <MainPackage Name="MyCompany_MyAircraft"/>
    <AdditionalPackage Name="MyCompany_MyAircraft_Additional1"/>
    <AdditionalPackage Name="MyCompany_MyAircraft_Additional2"/>
</WwisePackages>

If this element is not specified, the name of the package loaded in game will be deduced by the path of sound.xml file.

 

 

Acoustic Parameters Example

Below is an example using the <AcousticParameters> element to set up sharsets:

<AcousticParameters>
    <!-- the game-defined auxiliary bus in the cockit is "rev_inside_default" aux bus -->
    <Parameter Name="ReverberationPreset" ShareSetInside="shareset_inside_name" ShareSetOutide="shareset_outside_name"/>
</AcousticParameters>

 

Below is an example using the <AcousticParameters> element to set up audio attenuation:

<AcousticParameters>
    <!-- Sounds comming from outside will be attenuate by -22dB in the cockpit, if exit doors are closed -->
    <Parameter Name="Insulation_ExitClosed" Value="-22"/>
    <!-- Sounds comming from outside will be attenuate by -12dB in the cockpit, if exit doors are open -->
    <Parameter Name="Insulation_ExitOpen" Value="-12"/>
</AcousticParameters>

 

 

Engine Preset Examples

Below is an example using the <EngineSoundPresets> element to set up sound presets for engines:

<EngineSoundPresets>
    <!-- sound will stop if the engine state goes to 'off' and if the 3rd engine is below the 675rpm threshold -->
    <Sound WwiseEvent="Combustion" ConeHeading="225" RPMMin="675" WwiseData="true" EngineIndex="3"/>
    <!-- sound will play if the engine state goes to off and if the 3rd engine rpm is below the 675rpm threshold --> 
    <Sound WwiseEvent="Shutdown" ConeHeading="225" RPMMin="675" WwiseData="true" EngineIndex="3"/>
    <!-- sound will play the wwise event "Play_SimObjectName_eng3_combustion_from_left" on the 3rd engine.-->
    <Sound WwiseEvent="Combustion" CustomSuffix="from_left" ConeHeading="225" RPMMin="675" WwiseData="true" EngineIndex="3"/>
    <!-- sound will play the wwise event "Play_SimObjectName_eng3_shutdown_from_left" on the 3rd engine.--> -->
    <Sound WwiseEvent="Shutdown" CustomSuffix="from_left" ConeHeading="225" RPMMin="675" WwiseData="true" EngineIndex="3"/>
</EngineSoundPresets>

The following presets example is specific to helicopters:

<EngineSoundPresets>
    <!-- This sound will be linked to the First Rotor and will stop if that rotor RPM is below the 285rpm threshold. The wwise event will be "Play_SimObjectName_rotor1_rotor"  -->
    <Sound WwiseEvent="Rotor" FadeOutType="2" FadeOutTime="1" WwiseData="true" RPMMin="285" RotorIndex="1" EngineIndex="1"  />
    <!-- This sound will be linked to the Second Rotor and will stop if that rotor RPM is below the 2770rpm threshold. The wwise event will be "Play_SimObjectName_rotor2_rotor"  -->
    <Sound WwiseEvent="Rotor" ConeHeading="90"  FadeOutType="2" FadeOutTime="1" WwiseData="true" RPMMin="2770" RotorIndex="2" EngineIndex="1" />
</EngineSoundPresets>

 

Engine State And Transition Examples

Below is an example using the <EngineSoundStates> element to link sounds with an engine:

<EngineSoundStates>
    <!-- sound will play on Engine 1 when the engine is in "Start" and "On" states -->
    <Sound WwiseEvent="MySound" WwiseData="true" EngineIndex="1"  StateOff="false" StateStart="true" StateOn="true" />
</EngineSoundStates>

 

The following example is for setting a transition sound for an engine using the <EngineSoundTransitions> element:

<EngineSoundTransitions>
    <!-- sound will play on Engine 2, when the engine goes from Star to On -->
    <Sound WwiseEvent="MySound" WwiseData="true" StateFrom="Start" StateTo="On"  EngineIndex="2"/>
</EngineSoundTransitions>

 

 

Miscellaneous Sounds Example

The short example below shows how the <MiscellaneousSounds> element can be used:

<MiscellaneousSounds>
    <Sound WwiseEvent="STALL_WARNING" WwiseData="true" />
    <Sound WwiseEvent="OVERSPEED_WARNING_SOUND" WwiseData="true" />
    <Sound WwiseEvent="AP_PREFLIGHT_CHECK_OVER" WwiseData="true" /> 
</MiscellaneousSounds>

 

 

SimVar Sounds Examples

The short example below shows how the <SimVarSounds> element can be used:

<SimVarSounds>
    <!--This sound will play every time the simvar value changes -->
    <Sound WwiseEvent="Sound_For_Test_1" WwiseData="true" SimVar="SIMVAR TEST 1" Units="PERCENT" Index="0"/>
    <!--This sound will play whenever the simvar value is between 10 and 15, and when it's over 25. -->
    <Sound WwiseEvent="Sound_For_Test_2" WwiseData="true" SimVar="SIMVAR TEST 2" Units="PERCENT" Index="0">
        <Range LowerBound="10.0" UpperBound="15.0"/>
        <Range LowerBound="25.0" />
    </Sound>
</SimVarSounds>

 

In addition to the <Range /> elements, the <Requires> element allows to add other SimVar or LocalVar conditions on a sound to be played:

<SimVarSounds>
    <!--This sound will play if :
        - SIMVAR TEST 1 value is between 10 and 15, and when it's over 25,
        - And if SIMVAR TEST 2 value is above 60, 
        - And if SIMVAR TEST 3 value changes. -->
    <Sound WwiseEvent="Sound_For_Test_2" WwiseData="true" SimVar="SIMVAR TEST 1" Units="PERCENT" Index="0">
        <Range LowerBound="10.0" UpperBound="15.0"/>
        <Range LowerBound="25.0" />
        <Requires SimVar="SIMVAR TEST 2" Units="PERCENT" Index="0">
            <Range LowerBound="60" />
        </Requires>
        <Requires SimVar="SIMVAR TEST 3" Units="PERCENT" Index="0"></Requires>
    </Sound>
</SimVarSounds>

 

Local Variables

Instead of using the SimVar attribute for the <Sound> element, you can set up local variables as conditions to play a sound using the LocalVar attribute. This works the same way as the SimVar attribute, except it requires no additional Units and Index attributes:

<SimVarSounds>
    <!--This sound will play whenever the Local variable value is between 0.1 and 0.15, and when it's over 0.25. -->
    <Sound WwiseEvent="Sound_For_Test" WwiseData="true" LocalVar="MyLocalVar TEST 1" >
        <Range LowerBound="0.1" UpperBound="0.15"/>
        <Range LowerBound="0.25" />
        <Requires SimVar="MyLocalVar TEST 2">
            <Range LowerBound="1" />
        </Requires>
    </Sound>
</SimVarSounds>

In addition to previously mentioned attributes, ContinuousStopDelay can be set to a value in seconds and will delay the stop of the continuous sound linked to the SimVar after the condition for stopping has been reached.

NOTE: For a list of all simulation variables with their units and indices, visit the Simulation Variables section of the documentation.

 

Animation

The <SimVarSounds> container element can be used to define sounds that will be played based on an animation, for example:

<SimVarSounds>
    <Sound WwiseData="true" WwiseEvent="sunshield_left_stops" Animation="Sunshield_L" Model="Interior" ViewPoint="Inside" NodeName="Sunshield_L_BASE" ContinuousStopDelay="1" Continuous="false" >
        <Range Lowerbound="0.9"/>
        <Range UpperBound="0.1"/>
        <WwiseRTPC Animation="Sunshield_L" Model="Interior" Derived="true" RTPCName="ANIMATION_SUNSHIELD_MOVEMENTS_DERIVED" RTPCAttackTime="0.1" RTPCReleaseTime="0.1"/>
    </Sound>
</SimVarSounds>

 

InputEvents

You can also associate a sound effect with an Input Event using SimVar sounds:

<SimVarSounds>
    <Sound WwiseEvent="fuel_pump1_on" WwiseData="true" FadeOutType="2" FadeOutTime="0.2" InputEvent="FUEL_Pump_1" Units="Number">
        <Range UpperBound="0"/>
        <Requires SimVar="ELECTRICAL MASTER BATTERY" Units="BOOLEAN" Index="1">
            <Range LowerBound="1" />
        </Requires>
    </Sound>
</SimVarSounds>

 

 

Event ID Example

The short example below shows how the <EventIdSounds> element can be used:

<EventIdSounds>
    <!-- sound will play every time the event is fired -->
    <Sound WwiseEvent="Sound_For_Test_1" WwiseData="true" EventId="KEY_TEST_EVENT_1"/>
    <!-- sound will play only when the event fired has a different value than the last time it was fired -->  
    <Sound WwiseEvent="Sound_For_Test_2" WwiseData="true"  EventId="KEY_TEST_EVENT_2" ChangedOnly="true"/>        
</EventIdSounds>

 

 

Animation Sounds Example

To fully give an example of the <AnimationSounds> element, we must first give some details of how the XML for the animation itself should be created. This is done under the <Behaviors> element of the [model].xml file, using an <AnimationTrigger> element, or within a <Component>. Within the <AnimationTrigger> element you would then have the <EventTrigger> sub-element, then finally, within the <EventTrigger> element you would have the <SoundEvent /> self-closing sub-element. If we put all this together, we have entries in the <Behaviors> element that looks like this:

<AnimationTriggers Animation="MyAnimationName1">
    <!-- MySound1 will play each time the animation timeline reaches 25% and 75% -->
    <EventTrigger Count="2" Direction="Both">
        <SoundEvent WwiseEvent="MySound1" Action="Play"/>
    </EventTrigger>
</AnimationTriggers>
<AnimationTriggers Animation="MyAnimationName2">
<!-- MySound2 will play each time the animation timeline reaches 10% when going forward,
    and each time the animation timeline reaches 90% when going backward -->
    <EventTrigger NormalizedTime="0.1" Direction="Forward">
        <SoundEvent WwiseEvent="MySound2" Action="Play"/>
    </EventTrigger>
    <EventTrigger NormalizedTime="0.9" Direction="Backward">
        <SoundEvent WwiseEvent="MySound2" Action="Play"/>
    </EventTrigger>
</AnimationTriggers>

 

Finally, in the sound.xml file we can use the <AnimationSounds> element to trigger the sound:

<AnimationSounds>
    <!--This sound will play every time the event "MySound" is sent through the animation-->
    <Sound WwiseData="true" WwiseEvent="MySound" ViewPoint="Inside"/>
</AnimationSounds>

 

Avionic Sounds Example

When triggering a sound from an instrument, it must be defined using the same WwiseEvent ID string in both the instrument XML and the sound.xml file. Below is an example of sounds being defined for a panel:

<Alert>
    <Type>SoundOnly</Type>
    <SoundEvent>voice_alert_500ft</SoundEvent>
    <Condition>
        <StateMachine>
            <State id="Under" value="0">
                <Transition to="Over">
                    <GreaterEqual>
                        <Simvar name="PLANE ALT ABOVE GROUND" unit="feet"/>
                        <Constant>500</Constant>
                    </GreaterEqual>
                </Transition>
            </State>
            <State id="Over" value="0">
                <Transition to="Alerting">
                    <Lower>
                        <Simvar name="PLANE ALT ABOVE GROUND" unit="feet"/>
                        <Constant>500</Constant>
                    </Lower>
                </Transition>
            </State>
            <State id="Alerting" value="1">
                <Transition to="Under">
                    <Constant>1</Constant>
                </Transition>
            </State>
        </StateMachine>
    </Condition>
</Alert>

The sound would then be defined under the <AvionicSounds> element like this:

<AvionicSounds> 
    <Sound WwiseData="true" WwiseEvent="voice_alert_500ft" />
</AvionicSounds>