Usually, mobile game soundtracks consist of a background music loop, and a few sound effects. Sometimes, the music and the effects are produced by different content providers, and there is little, if any, coordination between them. If the sound effects are musical (such as a "ta-da" chord for bonus points), it is not uncommon for the music and the sounds to clash harmonically.
"The Secret Yanni Technique" can be used to avoid this problem, by creating background music in a specific musical mode, then producing sound effects to fit that mode. A simple example would be to compose music in the key of C Major, and then create bonus sounds using notes from a C pentatonic scale (C, D, E, G, A). Because a bonus sound can be played at any time during gameplay, harmonic movement in the music (i.e. key changes) must be limited; otherwise, the bonus sounds will clash.
BUT what if the game's audio engine kept track of what key was playing, and generated bonus sounds to match? This can be accomplished with FMOD's interactive music system, by using callbacks to determine which music segments are playing, and triggering bonus sounds modified accordingly.
The LandSeaAir game demonstrates this approach.
This level plays background music in six different keys: C, E, and Ab, Major and minor. The screen displays a bird controlled by accelerometer, which chases bugs and butterflies. When the bird catches a bug, one of ten bonus melodies is played, transposed to the key currently playing. When the bird catches a butterfly, an appropriately pitched bonus sound is played, and the key will be changed at the subsequent transition segment (blue butterfly = C, green = E, red = Ab). After catching six bugs, the background toggles between daytime (Major scales) and nighttime (minor scales).
The snake slithers through six terrains, each with its own music loop, which modulates down a whole step ||: Cmin => Bbmin => AbMaj => F#min => Emaqam => Dmin :|| with each transition. The music plays with the theme of "5, +5, 6, +5" (aka the James Bond chords) in six different styles. Rats make consonant interval oboe sounds in each key. Frogs play a bassoon motif appropriate for each music loop.
The music modulates up a minor third every four bars as follows ||: Gmin => Bbmin => C#min => Emin :|| Plankton movement takes a "drunkard's walk" (brownian motion) path. Plankton notes are determined by fractal (pink noise) algorithm.
The interactive music system controls key change transitions for all music loops. Music segment callbacks are used to keep track of what key is currently playing. Bonus sounds are generated using Simple events, triggered by gameplay variables, and transposed appropriately for the current key.
A detailed description of the soundtrack implementation, including links to source code, Eclipse project, and FMOD Designer files, can be found on my O'Reilly blog:
Comments, suggestions, and bug reports welcomed at firstname.lastname@example.org.