# Advanced Sound.xml Features On this page we will be exploring some of the more advanced Wwise features that can be implemented within the `sound.xml` file. To start with, we'll be explaining the engine audio setup as a continuation of the following two sections: - [Engine Audio Setup](engine-audio-setup/) - [Advanced Audio Effects](advanced-audio-effects/) And then we'll look at a few other elements within the file and how they relate to Wwise and the effect they will have on audio in the simulation. Note that much of the example XML shown on this page is based on the basic file that we created here: - [Creating The Sound.xml](creating-the-sound-xml/)   The file currently should look something like this: ``` xml ```   This section does not cover *all* the available sound XML elements, only those that we consider important and/or essential. However there is extensive documentation for the other elements - as well as many examples of use - on the following pages: - [Sound XML Properties](../../content-configuration/sounds/sound-xml/) - [Sound Examples](../../content-configuration/sounds/sound-xml-examples/)     ### <AcousticParameters> We'll start filling out the sound-xml file with the **acoustic parameters** container. This will be used to define the reverb sharesets that we want to use for our aircraft. These ShareSets will have been created previously within Wwise as **Game Defined Auxiliary Sends**. For more information see here: [Reverb](advanced-audio-effects/#reverb). {{< callout context="caution" title="IMPORTANT!" icon="outline/alert-triangle" >}} In the following example, we show how to use an outside ShareSet along with a Game-Defined Auxiliary Send. If you are using a User-Defined Auxiliary Send, you **do not need to define it** in your `sound.xml` file using the `` element. For more information see the section on [User Defined Auxiliary Sends](advanced-audio-effects/#user_defined). {{< /callout >}} To start with you'll need to add the `` element. This is a container element and has no parameters of it's own. It simply holds further `` elements which we'll define in a moment: ``` xml ``` Since we're setting up a Game Defined Auxiliary Send for custom inside and/or outside reverb, we will need to give the name of the parameter, and the ShareSet(s) it should be using, so our XML will now look like this: ``` xml ``` In this example we've used the parameter named "ReverberationPreset" to tell the simulation that we're setting up reverb, and then we've opted to use both inside *and* outside reverb ShareSets. Using these attributes means that all audio that has been created in Wwise and that has been set to use the **Game Defined Auxiliary Sends** will use the ShareSet effect(s) that you have set for inside and/or outside using this parameter. These ShareSets will be applied at runtime on a custom auxiliary bus. NOTE: If you have not used any game defined auxiliary sends, then the "ReverberationPreset" parameter can be omitted.   Since we're discussing the `` container, we'll also quickly mention the other available parameter names: `Insulation_ExitClosed` and `Insulation_ExitOpen`. These are used to define the attenuation of the outside sounds in the cockpit when the aircraft doors are closed or opened. In the following example we define a 12{{< glossterm >}}db{{< /glossterm >}} sound attenuation with closed doors and no sound attenuation with opened doors: ``` xml ```     ### <EngineSoundPresets> The next container you'll want to add to the XML file is ``. Using this container element, you would then go ahead and define multiple `` elements, one for each of the different engine events defined in Wwise. {{< callout context="note" title="NOTE" icon="outline/bulb" >}} Remember, events are named using the `Play_[SoundbankName]_[WwiseEvent]` schema in Wwise, so in the `` attributes, you only need to supply the `[WwiseEvent]` part. {{< /callout >}}   Let's look at a single sound definition and briefly explain the attributes that have been applied to it (since the <Sound> element has a great many attributes and only some are generally used for engines): ``` xml ```   The parameters used here are typical for a looping engine sound: - `WwiseEvent` - this is the name of the Wwise event that is being defined. - `ConeHeading` - this is used to set the direction of the "sound cone", in degrees, where 0° is facing forward. - `FadeOutType` - this attribute allows sounds to be faded out when they are set to stop playing, and the value given determines how the fade out will be implemented (in this case using a sine curve). - `FadeoutTime` - this allows you to set the time, in seconds, that the sound will take to fade out. - `RPMMin` - this allows you to define at which RPM the combustion and propeller / rotor events stop and the shutdown event will play. - `WwiseData` - this allows you to define if the event is using the WwiseData (True) or the WaveData (False) flow. - `EngineIndex` - the index of the engine sound to use (for a single engine aircraft this will always be 1).   Below is the example file in full, with all the appropriate engine sounds: ``` xml ```     ### <EngineSoundStates> The `` element is a container element for `` and is used to specify an audio event to be played when a specific engine state is reached. When using this container, three different engine states are available - Off, Start, and On - and therefor three boolean values must be defined to set when the sound should be played in relation to the engine state. In the example below, we play the Wwise event `eng1_prop_non_combustion` to play a specific propeller sound when the engine is shutdown: ``` xml ``` In the image below you can see how we've set up this sound in Wwise: {{< image-center src="images/4_Sound/Aircraft_Audio/sound_xml/sound_5_prop.png" alt="Audio Setup In Wwise For An <EngineSoundState> Element" >}}     ### <EngineSoundTransitions> The final engine-specific element that we'll discuss here is ``. This is another container element for `` and allows you to set an audio sample to play when there is a change in the engine state. As such you will have to set "from" state and a "to" state, which can be one of: "On", "Off", "Start". For example: ``` xml ``` In general, these engine sounds need nothing more than an event to be created for them in Wwise.     ### <AlwaysPlaySounds> This element allows you to define various sounds that will always be playing - unless the package is unloaded - and that do not require any parameters to be set up. In this example we are using this element for the to play "rattle" sound effects to simulate the sound of the fuselage and other components when the aircraft is moving.   To start with let's look at how this is set up in Wwise. For the "rattle" sound we have used two "random" containers in Wwise, one for the inside and one for the outside. These random containers will use any one of a selection of audio files for the sound event, and they're a great way to ensure variety in the sound effect so it won't become annoying to the user. The container hierarchy is as follows: Main "rattle" Actor Mixer > Switch container > Inside/Outside Blend containers > Pitch/Yaw/Roll Random containers Inside each random container we have our sounds, and to the container itself we have assigned one of three RTCP with the SimVars `ROTATION VELOCITY BODY X` (pitch container), `ROTATION VELOCITY BODY Y` (yaw container), and `ROTATION VELOCITY BODY Z` (roll container). These SimVars will further modify the sound based on the actual axis of the aircraft while flying: {{< image-center src="images/4_Sound/Aircraft_Audio/sound_xml/sound_4_rattle.png" alt="The Random Container RTPC Setup" >}} {{< callout context="note" title="NOTE" icon="outline/bulb" >}} In the image above you can see that there are three RTPC values being affected by a single SimVar. A sound can have as many RTPC values as required. Also note that you may define a **LocalVar** instead of a SimVar as a control variable. {{< /callout >}}   You would then create a new **Event** for for the rattle switch container - `Play_TestAircraft_rattle_kinematic` - which is what you would reference in the sound.xml file. In this file you would create a `` container element, and then add the Wwise event using a `` element, which will also need you to define additional `` sub-elements to link the event with the appropriate SimVars: ``` xml ```     ### <WindSounds> The `` element is similar to the `` element in that it is designed to play continuously, unless the package is unloaded. The sounds used in this element do not require any parameters to be set up, and the associated events are triggered internally and automatically by the simulation. However, you can still use **Game Parameters** to have the sound behave dynamically within the simulation, as shown in the following image where we've set the wind audio RTPC to use the `SIMVAR_AIRSPEED_TRUE` parameter to modulate the sound in real time: {{< image-center src="images/4_Sound/Aircraft_Audio/sound_xml/sound_6_wind.png" alt="The Wind Sound Audio Setup In Wwise" >}}   To actually tell the simulation to play the sound, you would have something like this in the `sound.xml` file: ``` xml ```     ### <GroundSounds> The `` element is a container element for `` and is used to primarily to add sound effects that will play when the aircraft touches down (although it can have other uses, like groundroll on different surfaces, or fuselage rattle when on the ground, etc..). In this example we've set up Wwise so that the touchdown sound of each wheel of the aircraft is linked to the `VERTICAL SPEED` simvar, which will modulate the sound using RTPC: {{< image-center src="images/4_Sound/Aircraft_Audio/sound_xml/sound_7_ground.png" alt="The Ground Rattle Audio Setup In Wwise" >}}   The sound.xml file would then look like this, with three <Sound> entries (one for each wheel) all using the `` sub-elements to link the events with the appropriate SimVar: ``` xml ``` {{< callout context="note" title="NOTE" icon="outline/bulb" >}} In this case, we use the attribute "Derived" which allows you to use a derived SimVar value. This RTPC is **not** sent by default by the simulation (only the non-derived is sent) so we have to specify it in the sound.xml. {{< /callout >}}