The Creating a metronome through the precise scheduling of sounds with dspTime recipe demonstrated how to create a metronome by scheduling when sounds play using the AudioSource.PlayScheduled(...) method and the AudioSettings.dspTime value. Another situation when we need to precisely schedule audio start times is to ensure a smooth transition from one music track to another, or to ensure simultaneous music tracks play in time together.
In this recipe, we'll create a simple 4-track 140 bpm music manager that starts playing a new sound after a fixed time – the result of which is that the tracks fit together perfectly, and those that overlap do so in synchronicity:
