Find out when the Scatterer Instrument started playing the instrument and which one

In my Unity game, I use the Scatterer Instrument to simulate the conversations of a crowd of people. I want to add subtitles to the game, but I don’t know if it’s possible in Unity to somehow find out that an instrument has started playing in the Scatterer Instrument of a specific event (it’s also desirable to know which one specifically) in order to link the appearance of subtitles to this?


It’s not possible to know when (most) individual instruments have started playing. Using event callbacks (see the Event Callbacks section of the Studio Docs), it’s possible to know when an event has started playing, and more importantly, when a Programmer instrument in that event is about to play - as such, to accomplish your desired behavior I’d recommend pairing a Programmer instrument with your Scatterer instrument.

If you add a Programmer instrument with an audio table to your Scatterer instrument’s playlist, you can use an event callback from a Unity script to trigger an FMOD.Studio.EVENT_CALLBACK_TYPE.CREATE_PROGRAMMER_SOUND callback whenever a Programmer instrument is about to be created by the Scatterer instrument. From there, inside the callback you can specify a random audio table key for the Programmer instrument to use, and pair that with the corresponding subtitle.

I’d suggest taking a look at the Programmer Sound Scripting Example in our Unity Documentation for an example of how to implement a Programmer instrument callback. The example uses the event’s user data property to store an audio table key and access it in the callback. However, by storing a class that contains the variables you need as user data instead, you can pass not only the audio table key but also delegate functions or other variables that you can use to trigger/track your subtitles.

Hope this helps!