# 1. Horizontal vs Vertical Adaptive Music
Part of [[Music Mood Mixer]]. Next: [[2. Mood Definitions and Stats Signals]].
> [!note] Verification status
> Concepts below are design practice mapped onto APIs verified in the 6000.5 reference on 2026-11-08 (`AudioMixerSnapshot.TransitionTo`, `AudioMixer.TransitionToSnapshots`, `AudioSource.PlayScheduled`, `AudioSettings.dspTime`). **No code in this part; no compilation.**
Adaptive music is not "play a different playlist when the player draws a weapon." It is a contract between game state and the mix: as the player's situation changes, the score should change *with intention and with hysteresis*, the same way a good animator does not snap between idle and sprint on a single frame (see [[Animation]] / [[2.States Transitions and Parameters]] for the visual analogue).
Scott Rogers, Level 16 of [[Level Up! (Review)]], treats music as something that should outrun the on-screen action and that can be layered or re-sequenced as play develops ("And the Beat Goes On"). The two industry names for those ideas are **vertical remixing** and **horizontal resequencing**. You almost always want both, but they are not interchangeable.
## 1.1 Vertical remixing (stems on mixer groups)
You author one piece of music as **layers** that share tempo, key and arrangement, then ride their levels (and maybe filters) as intensity changes.
| Stem | Role | Typical snapshot behaviour |
|---|---|---|
| Bed | Harmony, pad, light pulse | Audible in every mood; maybe darker EQ in `LowHealth` |
| Tension | Ostinato, rising strings, ticking | Silent in `Explore`, half up in `Tension`, full in `Combat` |
| Percussion | Drums, hits | Silent until combat; stays a beat or two after the last enemy dies (hysteresis) |
| Stingers | One-shot accents | Routed separately so a victory stab is not ducked by the bed |
Implementation in Unity's built-in mixer:
1. Four looping `AudioSource`s (or one source per stem), `loop = true`, `spatialBlend = 0` (the score is not a point in the world unless you are writing diegetic source music; contrast [[Spatial Audio and Reverb Zones]] and the radio in [[In-Game Radio Stations]]).
2. Each source's `outputAudioMixerGroup` points at `Music/Bed`, `Music/Tension`, etc.
3. Snapshots store the child-group faders and any filters (low-pass on the bed when health is low). You change mood with `snapshot.TransitionTo(fadeSeconds)` or a weighted `mixer.TransitionToSnapshots(...)`.
4. You do **not** stop and start stems every mood change. Stopping a looping bed to "save a voice" is how you get a pop and a bar that no longer lines up.
Why this is the default for a stats-driven mood mixer: health, alertness and wanted level are **continuous**. Weighted snapshot blends were designed for exactly that. The 6000.5 `TransitionToSnapshots` docs say the API is "for games that specify the game state as a continuum between states or for interpolating snapshots from a triangulated map location." A 0..1 combat-intensity value *is* that continuum.
The work you already did in [[2. Audio Mixer Snapshots and Exposed Parameters]] (Gameplay vs LowHealth blend) is a two-snapshot version of this. This tutorial just names more moods and gives the stems something to ride.
## 1.2 Horizontal resequencing (sections on a timeline)
You author **different sections** - an exploration groove, a combat cue, a victory outro - and you *switch which section is playing*, ideally on a musical boundary.
Implementation in Unity:
- Two (or more) `AudioSource`s used as a flip-flop, the pattern Unity shows in the `PlayScheduled` scripting example.
- You schedule the next section at an absolute `AudioSettings.dspTime` a short way in the future (the 6000.5 docs recommend ~100-200 ms of prep time, and the official example schedules about a second ahead so streamed files can buffer).
- `PlayScheduled` is independent of frame rate, which `Play()` inside `Update` is not. That is why you use it for music, not `yield return new WaitForSeconds`.
- `SetScheduledEndTime` can silence the tail of the outgoing section so the incoming one meets it cleanly. Unity's `SetScheduledEndTime` page is explicit that this exists to fight discontinuities from frame-based lossy codecs, and it recommends overlapping tails plus a scheduled end (optionally with a short crossfade) rather than a hard cut.
Horizontal changes feel like a *decision*. They are perfect for Explore -> Combat -> Victory, and awkward for "health dropped from 41% to 39%." Do not horizontally resequence on a health threshold. Vertically remix that.
## 1.3 Combining them
A practical hybrid for a class project or a small game:
- **Vertical** for intensity inside a scene (explore / tension / combat / low-health). The bed never stops.
- **Horizontal** for section changes that deserve a downbeat: entering a new biome, a boss intro, a victory outro, a stinger that does not loop.
- **Radio / diegetic sources** are a third layer and should live on `Music/Radio` so the score can duck them. That is [[In-Game Radio Stations]].
Think of vertical as a mixer automation pass and horizontal as an arrangement pass. The director in Part 3 can do both: snapshot blends run continuously; section changes fire only when the mood state machine actually *enters* Combat or Victory.
## 1.4 What not to do
- **One shot of "combat music" on a trigger, then silence.** That is a playlist, not adaptive music, and it fails Rogers' "more exciting than the action" test the moment the player kites an enemy for thirty seconds.
- **Swap `audioSource.clip` on a playing source** to change mood. You will hear a pop. Stop, assign, `PlayScheduled`, or fade the group out first.
- **Drive stem volumes with `AudioMixer.SetFloat` every frame.** After `SetFloat`, snapshots no longer own that parameter until `ClearFloat` (this is documented on `AudioMixer.SetFloat` and already covered in [[2. Audio Mixer Snapshots and Exposed Parameters]]). Let snapshots and `TransitionToSnapshots` interpolate; reserve exposed parameters for the player's volume sliders.
- **Ignore musical time entirely.** A 400 ms snapshot fade can hide a lot, but a drum stem that starts on beat 3 of a 4/4 bed will always feel drunk. If you introduce percussion as a stem, start it playing (silent, at -80 dB) with the bed so it shares a downbeat, then raise it with the snapshot.
## 1.5 Why this sits on top of Audio 1
[[Audio Mixers and Character Audio]] already built `Master/Music`, Duck Volume from dialogue, and a `LowHealth` snapshot. Adaptive music reuses that plumbing:
- Player `MusicVol` stays an exposed parent fader.
- Mood snapshots only move `Music/Bed`, `Music/Tension`, `Music/Percussion` and any filters.
- Dialogue and radio continue to duck `Music` via the existing Duck Volume send, so a briefed NPC or a DJ break still wins the conversation.
If your mixer does not yet have those child groups, add them before writing director code. The code in Parts 2 and 3 assumes the snapshots exist and are named exactly as the mood assets request (`FindSnapshot` is an exact name match in the 6000.5 reference).