# Understanding automatic virtualization

**URL:** <https://qa.fmod.com/t/understanding-automatic-virtualization/21924>\
**Category:** FMOD Studio\
**Tags:** unity\
**Created:** [July 25, 2024, 11:13am UTC](https://qa.fmod.com/t/understanding-automatic-virtualization/21924 "2024-07-25T11:13:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![deHaan](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/dehaan/32/68_2.png) [@deHaan](https://qa.fmod.com/u/deHaan)\
**Post date:** [July 25, 2024, 11:13am UTC](https://qa.fmod.com/t/understanding-automatic-virtualization/21924/1 "2024-07-25T11:13:18Z")

</div>

Hi,

I am trying to understand how automatic virtualization in FMOD works. I thought FMOD would automatically virtualize a silent event, but it doesn’t seem to be the case when I am checking in the profiler.

Am I misunderstanding how virtualization works?

Thank you!

---

<div class="post-metadata">

**Author:** ![joseph](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/joseph/32/264_2.png) [@joseph](https://qa.fmod.com/u/joseph)\
**Post date:** [July 26, 2024, 3:48am UTC](https://qa.fmod.com/t/understanding-automatic-virtualization/21924/2 "2024-07-26T03:48:33Z")

</div>

You are misunderstanding how virtualization works - which is common, because virtualization is a complex topic.

You’re right that the FMOD Engine automatically virtualizes silent content, but this virtualization is applied to individual [channels](https://www.fmod.com/docs/2.03/api/core-api-channel.html), rather than to their parent [event instances](https://www.fmod.com/docs/2.03/api/studio-api-eventinstance.html). An event instance may have multiple playing channels, as a new channel is spawned whenever a single instrument or programmer instrument begins playing - which is to say, a single instrument that plays only once in the lifetime of an event instance will spawn a single channel, whereas a single instrument that can be triggered repeatedly or loops will spawn multiple channels, and a scatterer instrument with a single instrument in its playlist will spawn one channel each time it starts playing a new instance of that single instrument.

Virtualization is applied at the channel level because the audibility of a channel can differ from that of the parent event instance. For example, in the case of the scatterer instrument I mentioned earlier, some of the channels it spawns might be a greater distance from the listener than others, and so might be attenuated to silence (and thus virtualized) while other channels in the same event instance remain audible.

Event instance virtualization does exist. However, isn’t tied to silence; instead, event instances are virtualized only when the number of instances of a particular event exceeds that event’s “max instances” property. When this occurs, the quietest instances are virtualized first - which _may_ mean event instances that are silent or close to it, but not necessarily.

So: An event instance being silent will not cause that event instance to be virtualized, but will cause all the channels associated with that event instance to be virtualized. This actually results in a greater resource saving, since it allows event instances that have some audible channels and some inaudible channels to be partly-virtualized, alongside the fully-silent and fully-virtualized event instances.

---

<div class="post-metadata">

**Author:** ![deHaan](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/dehaan/32/68_2.png) [@deHaan](https://qa.fmod.com/u/deHaan)\
**Post date:** [July 26, 2024, 7:27am UTC](https://qa.fmod.com/t/understanding-automatic-virtualization/21924/3 "2024-07-26T07:27:58Z")

</div>

Thank you for the explanation Joseph! Yeah I was confusing event virtualization with voice virtualization, so thank you for clearing that up!  
How would you recommend checking if all voices of an event are virtualized from code? Can I use something like [ChannelGroup.getNumChannels](https://www.fmod.com/docs/2.02/api/core-api-channelgroup.html#channelgroup_getnumchannels) for that?

---

<div class="post-metadata">

**Author:** ![joseph](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/joseph/32/264_2.png) [@joseph](https://qa.fmod.com/u/joseph)\
**Post date:** [July 29, 2024, 7:50am UTC](https://qa.fmod.com/t/understanding-automatic-virtualization/21924/4 "2024-07-29T07:50:55Z")

</div>

> [@deHaan](#):
>
> How would you recommend checking if all voices of an event are virtualized from code? Can I use something like [ChannelGroup.getNumChannels](https://www.fmod.com/docs/2.02/api/core-api-channelgroup.html#channelgroup_getnumchannels) for that?

You’d have to iterate through all the channels associated with the event and check them with **[Channel::isVirtual](https://www.fmod.com/docs/2.03/api/core-api-channel.html#channel_isvirtual)**.

I’m, curious as to why you’d want to do this, though. If it’s for profiling, I reccomend using FMOD Studio’s profiler, which can display a graph of the number of channels associated with an event over time if you click on “Voices” in the transport bar.

---

<div class="post-metadata">

**Author:** ![deHaan](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/dehaan/32/68_2.png) [@deHaan](https://qa.fmod.com/u/deHaan)\
**Post date:** [July 29, 2024, 10:20am UTC](https://qa.fmod.com/t/understanding-automatic-virtualization/21924/5 "2024-07-29T10:20:59Z")

</div>

Cool, thank you Joseph.

I was mainly curious if we hook into the “virtual events” to disable some of our own audio systems in Unity. So when all voices of an event are virtual we could stop some of our systems from using resources (except those that might put the event back into non-virtual mode of course)
