Triggering a sound event from regular code

Hi, we are wondering how we can trigger a Wwise event from a regular piece of
code (not template, not animation related, no using simvars, etc). It is
possible?

Define a “regular piece of code”: XML, JS, WASM?

We have found many examples of how to execute an event wwise, but all of them
are linked with a button, switch, knob, etc. In this case we need to execute
the wwise event when a set of conditions given by the state of the variables
are met. Is it possible to do that?

Hello @NandoHer and @gonzalofrv You can use SimVarSounds for this and use
your own local var Sound Examples
(flightsimulator.com)

Regards, Sylvain

Yea as mentioned below SimVarSounds allows you to trigger a sound event based
on the output of a SimVar or LVar

Hello @NandoHer and @gonzalofrv I forgot about it but you also have the W
event you can use in RPN code. Reverse Polish Notation
(flightsimulator.com)

You just have to call this event using the wwise event name and pass 0/1 to
disable/enable it. Regards, Sylvain

Hi, Sorry for the thread revival - I wanted to ask with the W:Events , is
there anything unique required from the sound.xml or Wwise Event definitions?
I am trying to trigger a Wwise Event from JS when a button is pressed, but am
having no luck so far. Thanks Dan

Hello Asobo,

It would be nice to have at least one example of how to set the W variable correctly to play a Wwise event from RPN in a template, model def, etc… The SDK mentions the availablitity of the W variable, but we could not find any example on how to use it in the entire SDK (unless we are missing something). For example, we tried different ways to call the Wwise event to play the sound from a simple on/off switch in one of our templates, and nothing seems to work:

1 (>W:WwiseEventName)
1 (>W:Play_WwiseEventName)
1 (>W:Play_OurAircraftSoundPackage_WwiseEventName)
1 (>W:WwiseEventID12345)

using 1/0 as well

Nothing worked and we stopped guessing…

So what is the correct syntax to call a Wwise event to play a sound when setting the W variable from our XML RPN code?

I need to add that we are able to achieve everything we need in our sound project by configuring the sound.xml file and creating RTPCs in Wwise (great tools!), but it would nice if we could also call a Wwise event directly from our XML model definitions or templates using RPN.

-Alain

The only information found in the SDK about the W variable:

" This is a Wwise Event ID and allows you to trigger a Wwise event based on logic driven by the XML. This makes it more flexible than the sounds defined in sound.cfg and the AnimSoundEvents, although more complex to use."

In answer to the original question. in HTML instruments you can trigger sounds defined in sound.xml: SoundServer | MSFS Avionics Frameworks and Instruments