Tech

How GroovePilot keeps time

For the engineers in the band. Many metronome apps keep time with software timers. GroovePilot keeps time with the audio hardware clock, down to the single sample.

One beat timeline, driven by the audio clock

Only the audio clock decides when a beat happens. One timeline counts audio samples, 48 000 per second on iPhone. The screen, flash, pendulum, beat dots and phone haptics read that timeline. They never decide a beat.

What this means when you playNo timer, animation loop or sleep call can move a click.

Integer sample positions, exact maths

Each click’s position is worked out as an exact fraction and placed on the nearest whole sample. At 109 BPM a beat is 26 422.0183 samples long. GroovePilot alternates 26 422 and 26 423 sample intervals so the long-term average is exact.

  • 26 422
  • 26 423
  • 26 422
  • 26 422
  • …
samples between clicks, 109 BPM

What this means when you playMeasured drift: 0.0006 ms over 10 minutes at 109 BPM.

A real-time-safe audio thread

While it plays, the audio thread avoids the classic causes of dropouts.

  • No memory allocation
  • No locks
  • No logging or file access
  • No waiting on another thread

Click sounds, normal and accent, are synthesised once before playback. Nothing is loaded, decoded or created per beat.

What this means when you playNo timer, animation loop or sleep call can move a click.

Measurements

iPhone 15 · iOS 26.7.1 · 48 000 Hz · 10 minutes per test
Measure109 BPM300 BPM
Clicks on the exact correct sample1 090 of 1 0903 000 of 3 000
Worst timing error0.0103 ms0.000 ms
Average timing error0.0052 ms0.000 ms
Drift over 10 minutes0.0006 ms0
Missed / doubled clicks0 / 00 / 0

Microphone tempo detection

Measured on generated test audio, not yet blind-tested in real rooms
MeasureResultIn practice
Precision when the octave is rightwithin 0.1 BPMWithin 0.1 BPM when it locks.
Time to a stable readingabout 5.5 sTap or listen once, then start.
Silence, noise, a held tone, random clicksno tempo shownIt never invents a tempo from silence or noise.
Known weaknesshalf or double tempoThat is why ×2 and ÷2 exist.