A player enters combat with four enemies, takes a hit, kills two of them, and is left with one enemy and half health. Over the course of that twenty-second fight, the music has to intensify when the combat starts, spike when the player is hit, pull back when the odds improve, and return to exploration when the last enemy dies. If the audio team simply hard-cuts between three prepared tracks at each of those moments, the score will sound like a series of switches, and the player will hear the system operating rather than the game reacting.
The problem is not the tracks themselves. It is the mapping layer between gameplay state and music state. That layer decides what the music responds to, how quickly it responds, and how it behaves when the game's state is ambiguous. A system where the mapping is well-designed feels invisible. A system where the mapping is naive produces music that either lags behind the action or jumps between intensities every few seconds.
The vertical layering tutorial covers the implementation in Wwise — how to build the stems, set up the RTPC curves, and wire the layers to the mix. This article assumes that layer structure exists and focuses on the layer above it: what the gameplay side should send to the audio system, how to combine those signals into a single intensity value, and how to keep the music from sounding twitchy.
Why does a naive music intensity system sound like a switch?
The most common approach to gameplay-driven music is to define three or four intensity levels and switch between them when the game state crosses thresholds. Combat begins, intensity goes to 2. Health drops below 30 percent, intensity goes to 3. Combat ends, intensity goes to 0.
This approach fails for two reasons. The first is that the game state does not actually change in discrete steps. A player's health is a continuous value, not a category. The number of enemies is discrete, but the threat they pose depends on their positioning, their remaining health, and the player's current resources. Treating a continuous situation as a discrete one produces music that is technically correct but feels disconnected from the moment.
The second reason is that the thresholds create a "flip-flop" problem. If the health threshold for intensity 3 is 30 percent and the player's health hovers around that value — taking damage, healing, taking damage — the music will switch back and forth between intensity 2 and intensity 3 every few seconds. This is not just distracting; it breaks the player's immersion because the music is drawing attention to a system that should be invisible.
The solution to both problems is to treat intensity as a continuous value with a smoothing filter, and to define the mapping from gameplay signals to that value in a way that is neither binary nor jittery.
Which gameplay signals should drive the music?
The first design decision is which signals from the game actually affect the music. Most games have dozens of values that could plausibly be relevant, and passing all of them to the audio system produces an intensity value that fluctuates unpredictably.
The signals that work best fall into three categories: threat, which describes how much danger the player is currently in; activity, which describes how much the player is doing; and outcome, which describes how well the player is doing. A small number of signals from each category is enough to drive the full intensity system.
| Category | Signal | Typical range | Weight |
|---|---|---|---|
| Threat | Enemies in aggro radius | 0 to 5 | 0.35 |
| Threat | Lowest nearby enemy HP % | 0 to 100 | 0.15 |
| Activity | Player attacks per 5 sec | 0 to 8 | 0.20 |
| Activity | Player movement speed | 0 to 1 (walk to sprint) | 0.10 |
| Outcome | Player health % (inverted) | 0 to 100 | 0.15 |
| Outcome | Combo / killstreak bonus | 0 to 1 | 0.05 |
The weights are suggestions, and the exact distribution depends on the game. An action game where the player constantly attacks should weight activity higher; a stealth game where the player is usually trying to avoid detection should weight threat higher and activity lower. The principle is that the sum of the weights is 1.0, so that the combined intensity value is always in the same range as the individual signals.
The lowest nearby enemy HP signal is worth explaining because it is counterintuitive. As an enemy takes damage, the music should intensify, not relax — the player is winning but the tension is highest in the moment before the kill. This signal is inverted from what the player's health signal does, and getting the direction wrong produces music that pulls back right when the moment is at its peak. The combat audio system design covers the same pattern at the sound-effect level; the music follows the same logic.
How do you combine the signals into one intensity value?
The combination is a weighted sum, but each signal has to be normalized first. A signal that ranges from 0 to 100 does not contribute the same amount to the sum as a signal that ranges from 0 to 5, so all signals are mapped to a common 0 to 1 range before they are weighted.
The code below shows the pattern. Each signal is normalized with its own range, weighted, and summed. The result is a value between 0 and 1 that represents the current intensity of the gameplay moment.
float ComputeRawIntensity(CombatState state)
{
float enemyCount = Mathf.Clamp01(state.EnemiesInAggro / 5f);
float enemyLow = Mathf.Clamp01(
1f - (state.LowestEnemyHP / 100f)
);
float attackRate = Mathf.Clamp01(
state.AttacksLast5Sec / 8f
);
float movement = Mathf.Clamp01(state.MoveSpeed);
float playerHealth = Mathf.Clamp01(
1f - (state.PlayerHP / 100f)
);
float combo = Mathf.Clamp01(state.ComboBonus);
return enemyCount * 0.35f
+ enemyLow * 0.15f
+ attackRate * 0.20f
+ movement * 0.10f
+ playerHealth * 0.15f
+ combo * 0.05f;
}
The output of this function is a raw intensity value that changes every frame. The music system cannot use this value directly, because a rapid change in enemy count or health would produce a sudden jump in the music. The next step is smoothing.
How do you smooth the intensity without making it feel laggy?
Smoothing is the step that separates a working music intensity system from a twitchy one. The raw value needs to be filtered so that it responds quickly to changes in the game state without jumping instantly, but not so slowly that the music lags behind the action.
The standard filter is the exponential smoothing filter, also known as a one-pole low-pass. It moves the current value toward the target value by a fixed fraction each frame, where the fraction is determined by a time constant.
float smoothedIntensity = 0f;
float attackTime = 1.5f; // seconds to reach 63% of target
float releaseTime = 4.0f; // seconds to fall back
void UpdateIntensity(float rawTarget, float deltaTime)
{
float tau = (rawTarget > smoothedIntensity)
? attackTime
: releaseTime;
float alpha = 1f - Mathf.Exp(-deltaTime / tau);
smoothedIntensity += (rawTarget - smoothedIntensity) * alpha;
}
The important detail is that the filter uses different time constants for rising and falling intensity. Rising intensity uses a shorter time constant so that the music responds promptly when combat starts. Falling intensity uses a longer time constant so that a brief pause in the action does not immediately drop the music back to calm.
The specific values that work for most games are between 1.0 and 2.0 seconds for attack and between 3.0 and 6.0 seconds for release. The attack value determines how quickly the music reacts to the player engaging with an enemy; the release value determines how long the music stays intense after the last enemy dies. A longer release value is almost always better than a shorter one, because the moment when combat ends is exactly when the music should sustain rather than fade.
The smoothing filter is applied once per frame, which means the intensity value updates at the game's framerate. This is different from the parameter smoothing in the weather audio system, which updates at a fixed rate. The difference is that weather parameters change slowly and the update rate is chosen to match, while music intensity changes with the player's actions and needs to track the framerate closely enough that the response feels immediate.
What does the smoothed value actually control?
The smoothed intensity value is sent to the audio middleware as a single RTPC or Parameter, and the middleware maps it to the volume of the music layers. The mapping is not linear, because the perceptual difference between intensity 0.3 and 0.5 is larger than the difference between 0.7 and 0.9.
The mapping that works well for music layers is a set of overlapping curves, one per layer, each with a different range. The ambient layer is fully audible at all intensities. The melody layer rises from silence at intensity 0.2 to full volume at 0.5. The percussion layer rises from silence at 0.4 to full volume at 0.7. The lead layer rises from silence at 0.6 to full volume at 0.9.
The overlap between the curves is what makes the transitions smooth. Between intensity 0.2 and 0.5, the ambient layer is fading toward background and the melody layer is rising. At 0.4, the percussion layer begins to rise while the melody is still prominent. At 0.6, the lead layer begins to rise while the percussion is still increasing. No two layers peak at the same intensity, and no two layers are both at zero at the same intensity, which means the music always has at least one layer prominent and never has two layers competing.
The exact crossover points depend on the music. A game with very distinct layer characters — where the percussion is clearly rhythmic and the ambient is clearly textural — can afford wider overlaps, because the ear separates the layers easily. A game where the layers are similar in character needs tighter overlaps so that the layers do not blur into each other.
How do you handle transitions between different musical sections?
The intensity system above handles changes within a single musical section — the same theme, played at different intensities. A complete music system also has to handle transitions between different sections, such as moving from a combat theme to an exploration theme, or from a town theme to a dungeon theme.
The transition is a separate mechanism from the intensity system, and it is usually implemented as a horizontal re-sequencing system on top of the vertical layering. The transition fires when a major state change occurs — combat starts, the player enters a new region — and the exact timing of the transition is chosen to land on a musically sensible boundary.
The most common approach is to schedule the transition for the next bar or the next phrase boundary, so that the new section begins on a downbeat. The Wwise implementation uses the Transition Segment feature to handle this. The transition can be immediate or scheduled, and for most games the scheduled version produces a smoother result, even though it means waiting up to a couple of seconds for the transition to fire.
The intensity value persists across the transition. When the game state changes from exploration to combat, the exploration theme transitions to the combat theme, and the combat theme starts at the same intensity value that the exploration theme had at the moment of transition. If the exploration theme was at intensity 0.4, the combat theme begins at 0.4 and rises as the combat develops. This preserves the continuity of the score, and it prevents the sudden jump that would occur if the combat theme always started at intensity 0.
When does a music intensity system become a problem?
The system described above works well for games where the player's state changes frequently and the music is meant to track those changes. It becomes a problem in three specific situations.
The first is a game where the player's actions do not map cleanly to a single intensity value. A turn-based RPG, for example, has a clear distinction between combat and exploration, but the intensity within combat does not vary much from turn to turn. A system that tracks intensity within a turn-based combat will produce music that changes slightly every turn, which the player will notice as a jitter. The right approach for turn-based games is a simpler system with a small number of discrete states rather than a continuous intensity value.
The second situation is a game where the music is a compositional statement rather than a dynamic accompaniment. A narrative game with a curated score, for example, uses the music as part of the storytelling. In that case, a continuous intensity system produces music that is always reacting rather than always saying something. The right approach is a state-machine system with a few distinct tracks that the designers place deliberately.
The third situation is a game where the intensity value cannot be computed cheaply. If the signals that drive the intensity require a full scan of the enemy list or a complex spatial query every frame, the cost of computing the intensity can become significant. The mitigation is to cache the signals and update them at a lower rate — two to four times per second is usually enough, because the smoothing filter handles the interpolation. The sound prioritization and voice limiting system covers the broader performance budget that the music intensity computation shares.
If the game fits the first two situations, the intensity system is the wrong tool, and a simpler state-machine approach will produce better results. If the game fits the third, the system can be made to work by computing the intensity at a lower rate. But for the many games where the player's state changes continuously and the music is meant to track those changes, the intensity system is the mechanism that makes the score feel like it is part of the game rather than layered on top of it.
The most common mistake in music intensity systems is to over- tune the thresholds. The threshold that triggers the transition from melody to percussion at intensity 0.55 is not a value that will be perfect for every combat encounter. It is a value that works well enough across the range of encounters the game produces, and its exact value matters less than the fact that the transitions between layers overlap. A system with reasonable thresholds and good overlap will feel better than a system with precisely-tuned thresholds and hard edges, because the ear is more sensitive to the smoothness of the transitions than to the exact point at which they happen.
Create Layered Music Sources for the Intensity System
Open the SfxMaker generator and create the individual musical layers that will be mixed by the intensity system. A bass drone, a percussion loop, and a melodic motif generated separately give the system the four-layer structure described above without requiring a full composition session for each intensity level.
Open SfxMaker Generator →