"A JavaScript timer wakes the scheduler. The audio clock decides when sound actually happens."
The Symptom: Scheduler Drift
In a playback engine, the solo, chords, and metronome must meet at the same musical moments. If each voice advances from its own start time and JavaScript callbacks, callback delays can accumulate differently. A metronome edges forward, a chord lands late, and the groove becomes too loose to trust as a practice reference.
The Fix: One Anchored Audio Clock
Choose an anchor relating source time to AudioContext.currentTime, then calculate every voice's event time from that same mapping. A lookahead scheduler may wake frequently with setTimeout or setInterval. The important distinction is that the JavaScript timer does not define the audible deadline. It finds events in the next window and schedules them ahead on the Web Audio clock.
A shared timebase prevents independent schedulers from accumulating drift, but it does not make every path sample-perfect automatically. Asset start positions, decoding, signal paths, and output-device latency can leave fixed offsets. Measure those paths and calibrate each voice separately. The clock supplies a common coordinate system; calibration aligns the paths within it.
The One-Model Idea, Applied to Time
This echoes Track 3's single source of truth. There, several views derive from one music model. Here, several voices derive event times from one timebase. A single source is not magic that erases all observed differences; it gives those differences one frame in which they can be explained and corrected. When audio drifts, check the authoritative time source first, then measure path-specific latency.