# Adaptive music

Adaptive music is music which changes in response to real-time events or user interactions, found most commonly in video games. It may change in volume, arrangement, tempo, and more. Adaptive music is a staple within the role-playing game genre, often being used to change the tone and intensity of music when the player enters and leaves combat. Music video games, in which a core gameplay element involves player interaction with music, also have fundamentally adaptive soundtracks.

## History

The first example of adaptive music is generally said to have been in Space Invaders by Taito in 1978. The game's simple background music, a four-note ostinato which repeats continuously throughout gameplay, increases in tempo as time goes on and the aliens descend upon the player. However, this music could also be considered sound effects for the aliens' movement, so some argue this is not an example of adaptive music.
Other early examples of adaptive music include Frogger by Konami from 1981, where the music abruptly switches once the player reaches a safe point in the game, and Sheriff by Nintendo from 1979, where different pieces of music play in response to events such as a condor flying overhead or bandits approaching the player.
George Lucas' video game development group LucasArts (before becoming Lucasfilm Games) created and patented the iMUSE interactive music system in the early 1990s, which was used to synchronise video game music with game events. The first game to make use of this system was Monkey Island 2: LeChuck's Revenge in 1991.

## Techniques
### Vertical orchestration

Vertical orchestration is the technique in which the music's arrangement is changed. Musical layers are added and removed in response to game events to affect the music’s texture, intensity, and emotional feel without interrupting the flow of music. Layers are generally faded in and out for smoother transitions.
In video games, this technique may be used for more subtle game events than horizontal re-sequencing, such as an increase or decrease in intensity during a battle.
In Dead Space 2, the background music appears to be arranged into four layers, each a stereo track corresponding with a specific level of "fear". Each of these layers is then either individually or collectively mixed during gameplay depending on a variety of game variables, such as the distance the player is from enemies.

### Horizontal re-sequencing

Horizontal re-sequencing is the technique in which different pieces of music are transitioned between. Musical pieces in a “branching” sequence are transitioned between in response to game events. The most simple kind of transition is a crossfade; when triggered by an event, the old piece is faded out while the new piece fades in. Another kind is phrase branching; in this case, the change to the next segment starts when the current musical phrase has ended. Another kind involves using dedicated "bridge" transitions, which are sections of music composed to join the two pieces of music together.
In video games, this technique may be used for more significant game events, such as a change in location, beginning of a battle, or opening of a menu, as it generally draws more attention and makes a greater impact than vertical orchestration.

### Algorithmic generation

Some video games generate musical content live using algorithms instead of relying solely on pre-made musical pieces (such as in horizontal re-sequencing and vertical orchestration).
Spore uses an embedded version of the music software Pure Data to generate music according to certain game events such as the phase of gameplay, the player's actions in the "creature editor", and the duration of the gameplay session. In addition, Ape Out features a procedurally generated jazz soundtrack which changes based on the intensity of gameplay and the players inputs.

## Blending music and sound effects

Some video games, such as Rez and Extase, synchronise their sound effects with the background music to blend them together. This is done by delaying playback of the sound effects after they're triggered by the player.

## Uses
### As goal or reward

The music game Sound Shapes uses an adaptive soundtrack to reward the player. As the player improves at the game and collects more "coins", the soundtrack, which is entirely composed of the melodies and beats created by these "coins", intensifies.