Ducking/Mixing Audio Within The Same Event In Real Time?

My team and I are currently working on a game where the game music changes based on the type and amount of enemies that are on screen.

For example, if there is one enemy of type A, the type A mark 1 instrument plays. If there are two enemies of type A, type A mark 2 instrument plays. If there is one enemy of type A and one enemy of type B, the type A and type B instruments play together, and so on and so forth.

At first I was thinking of using snapshots.

After doing the math, we have 63 total combinations of music between types of enemies and amount of enemies on-screen. Would I need to make 63 snapshots? Or is there a way to do simple ducking, volume lowering, etc automatically?

Thanks so much for your help!

No. A snapshot doesn’t usually affect every property in your project; it’s much more common for it to only affect a specific list of properties that are relevant to that snapshot. This makes it possible to play multiple different snapshots at the same time without their interfering with each other, provided they affect different parts of your project.

For example, if you wanted to create a snapshot that increases the volume of the “Enemy Type A” bus, you’d scope the volume of the “Enemy Type A” bus into that snapshot, but not the volume of the “Enemy type B” bus. If you wanted to create a snapshot that increases the volume of the “Enemy Type B” bus, you’d scope the volume of the “Enemy Type B” bus into that snapshot, but not the volume of the “Enemy type A” bus. Then, if you played just the first snapshot, it’d increase the volume of the “Enemy Type A” bus; if you played just the second snapshot, it’d increase the volume of the “Enemy Type B” bus; if you played both snapshots at once, you’d increase the volumes of both buses; and if you played neither snapshot, both buses would remain at their default volumes. That’s four different possible combinations of behavior, from only two snapshots.

That being said, snapshots may not the right tool for what you’re trying to do, as snapshots can only affect the content of the mixer, not the internal behavior of events. Depending on what you’re trying to do, you may be better off using parameters, as I’ll describe below.

Yes. Nearly any property you see inside an event can be automated on a parameter. It sounds like you want to create a piece of music that contains multiple instruments that play constantly, but change which of these instruments are audible dynamically over time. This is relatively common, and not too hard to achieve.

The easiest way to do it is creating a music event that contains each of the instruments on a different audio track. Then, automate the volumes of those tracks on a series of parameters, each of which represents the number of each enemy type that is currently on screen: “Enemy Type A,” “Enemy Type B,” and so on. Automation lets you specify the value a property should have for each possible value of parameter that automates it; once you’ve done that, your game’s code would only need to set the parameters to the number of enemies of each type that are present on-screen whenever those numbers change, and your music would automatically adapt.

For an example of this kind of event, see the “Music/Level 02” event in the examples.fspro project that comes included with FMOD Studio. (This example uses just one parameter rather than several different ones, but should be sufficient to demonstrate the concept.)

Understood! Thank you very much