# Sound XML 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 2024. After this we will show some shorter example code related to specific features from the sound XML: ``` xml ```     ### Wwise Package Definition Examples When using WwisePackages, the definition should be done at the start of the XML using the `` element, like this: ``` xml ``` 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 `` element to set up sharsets: ``` xml ```   Below is an example using the `` element to set up audio attenuation: ``` xml ```     ### Engine Preset Examples Below is an example using the `` element to set up sound presets for engines: ``` xml --> ``` The following presets example is specific to helicopters: ``` xml ``` The following example shows the setup for exterior engine audio to be linked to doors, so that the audio in the cockpit will change if a door to the exterior is opened or closed (for more information please see here: [Engine Audio When The Cockpit Is Open](../../sound/aircraft-audio/engine-audio-setup/#cockpit_open)): ``` xml ```   ### Engine State And Transition Examples Below is an example using the `` element to link sounds with an engine: ``` xml ```   The following example is for setting a transition sound for an engine using the `` element: ``` xml ```     ### Miscellaneous Sounds Example The short example below shows how the `` element can be used: ``` xml ```     ### SimVar Sounds Examples The short example below shows how the `` element can be used: ``` xml ```   In addition to the `` elements, the `` element allows to add other SimVar or LocalVar conditions on a sound to be played: ``` xml ```     #### Local Variables Instead of using the `SimVar` attribute for the `` element, you can set up local variables as conditions to play a sound using the `LocalVarEX1` attribute. This works the same way as the `SimVar` attribute, except it requires no additional `Units` and `Index` attributes: ``` xml ``` 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. {{< callout context="note" title="NOTE" icon="outline/bulb" >}} For a list of all simulation variables with their units and indices, visit the [Simulation Variables](../../programming-apis/simvars/simulation-variables/) section of the documentation. {{< /callout >}}     #### Animation The `` container element can be used to define sounds that will be played based on an animation, for example: ``` xml ```     #### InputEvents You can also associate a sound effect with an [Input Event](../models/modelbehaviors/input-event-xml-properties/) using SimVar sounds: ``` xml ```     #### Derived Values When working with SimVar sounds, you can use a derived value to trigger the sound effect, as shown in the following examples.   This sound will play whenever the derived value of the SimVar is changing: ``` xml ```     This sound will play whenever the derived value of the SimVar is between -10 and -1, *and* when the value reaches 25 when rising: ``` xml ```   This sound will play whenever the derived value of the SimVar is between -10 and -1, *and* when the value reaches 0 when falling: ``` xml ```     #### Parameters When working with SimVar sounds, it is possible that the SimVar you wish to use requires more than a single index to be passed through to it to get a specific value. In these cases you can use the `ParamN` attribute within the `` declaration. When using this attribute it is worth noting the following: - The first parameter (`Param0`) can be given in different ways and in all forms is the initial index for the SimVar being used. The three methods of defining this index is as follows: - In the `SimVar` attribute as ``` xml SimVar=":" ``` - In an `Index` attribute as ``` xml Index="" ``` - In a `Param0` attribute as: ``` xml Param0="" ``` - Further parameters are given as `Param1`, `Param2`, `Param3`, etc... The identifying value *N* needs to be given in consecutive order, and has to start at 0 or 1 (`Param0` being optional, as explained above). - Names in parameters *are* supported, meaning that you can pass in a parameter name insead of a fixed value. Note that the name must be surrounded with single quoates and include a `_n` suffix, For example: ``` xml Param1="'ParamName'_n" ```   The snippet below shows a SimVar sound trigger being defined using the `ParamN` attribute: ``` xml ` element can be used: ``` xml ```     ### Animation Sounds Example To fully give an example of the `` element, we must first give some details of how the XML for the animation itself should be created. This is done under the `` element of the [`[model].xml`](../Models/Model_XML_Properties.htm) file, using an `` element, or within a ``. Within the `` element you would then have the `` sub-element, then finally, within the `` element you would have the `` self-closing sub-element. If we put all this together, we have entries in the `` element that looks like this: ``` xml ```   Finally, in the `sound.xml` file we can use the `` element to trigger the sound: ``` xml ```   You can find full details on how to set up animation sounds on the following page: - [Adding Sound To Interactions](../models/modelbehaviors/usingbehaviours/interactions/adding-sound-to-interactions/)     ### 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: ``` xml SoundOnly voice_alert_500ft 500 500 1 ``` The sound would then be defined under the `` element like this: ``` xml ```