How does the background music in the game made in unity called "Florence" work ?

In Act 2 chapter 5 “First Date” the background music progresses as we progress through the scenes like by adding more instruments such as chello without disrupting the flow. You have to play it to understand as it is difficult to explain. I really want to implement that kind of immersive experience in my games. Thank you in advance.

I believe you can do as follow. First of all, you need one AudioClip and one AudioSource component per instrument (each audiosource has its own audioclip). Then, you just have to change the volume of each track according to the progress of the user.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[System.Serializable]
public struct ProgressionMusicTrack
{
    [SerializeField] private AudioClip audioClip;
    [SerializeField] private AudioSource audioSource;
    [SerializeField] private AnimationCurve volume;

    public void Init()
    {
        audioSource.clip = audioClip;
        audioSource.Play();
    }

    public void SetVolumeFromProgress( float progress )
    {
        audioSource.volume = volume.Evaluate( progress );
    }
}

public class ProgressionMusic : MonoBehaviour
{
    public ProgressionMusicTrack[] ProgressionMusicTracks;

    public Transform Player;

    private void Awake()
    {
        for ( int i = 0 ; i < ProgressionMusicTracks.Length ; i++ )
        {
            ProgressionMusicTracks*.Init();*

ProgressionMusicTracks*.SetVolumeFromProgress( GetProgress() );*
}
}

private void Update()
{
for ( int i = 0 ; i < ProgressionMusicTracks.Length ; i++ )
ProgressionMusicTracks*.SetVolumeFromProgress( GetProgress() );*
}

private float GetProgress()
{
// Change the content of this function according to your needs
return Player.position.x;
}
}
With the script above:
1. Create a new empty gameObject and attach this script
2. Attach N audiosource components to it, where N is the number of instruments
3. In the inspector of the ProgressionMusic, set the size of the array to N, and drag & drop the N audioSource component you have created.
4. Drag & drop the N individual tracks of each instrument
5. For each element of the array, set the curve according to your needs. The X axis represents the progress and the Y axis represents the volume (clamped between 0 and 1).
I’ve tried with some free tracks I found here : Cambridge MT MTK and it works great !

The song is probably just edited that way, otherwise it would be pretty hard to implement that through script.
@nitinkipa098