Tune-AL · technical details
Under
the hood
How a plucked string becomes a note on the screen, in five steps.
Overview
One C++ codebase built with JUCE in Xcode, compiled for macOS, iPadOS and iOS.
- 01Microphonelive input
- 02Noise gate−62 dB
- 03YIN detector+ octave check
- 04Stabilisermedian of 5
- 05Ring display60 Hz
Signal path
Each step only passes on what the next one can trust.
It hears the low E right, even through a laptop mic.
The low E string vibrates at 82 Hz. Laptop microphones barely pick up a sound that low, so the strongest repeating pattern in the signal is the one at double the period. A plain detector then reads E2 as E3, a full octave too high. This is the most common mistake tuners make.
The fix is an octave check: when the dip at twice the period is nearly as deep as the dip at the period itself, the detector takes the lower note.
accept 2τ when d′(2τ) < 0.4 · d′(τ)Both dips are measured at their interpolated bottoms, not at the nearest sample. Comparing raw samples made clean reference tones jump an octave, because rounding made one dip look deeper than it was.
The low E problem
The hardest bug in the project, found by testing on real recordings.
- Noise gate
- −62 dB
- Minimum confidence
- 0.85
- Median filter
- 5 frames
- Frames to lock a new note
- 3 agreeing
- Frames to change note
- 10
- Hold after the string fades
- 16 frames
- Cents smoothing
- one-pole, τ = 0.15 s
Stabiliser
A raw detector flickers between notes. These settings keep the needle calm without making it slow.
- Ring rotation
- 30° per semitone
- In-tune zone
- ±3 cents
- A4 reference
- 432–444 Hz440 by default
- Refresh rate
- 60 Hz
Display
The ring shows which note, the fine bar shows how far. One turn of the ring is one octave.
In Manual mode the app plays the note you tap. The sound is synthesised with the Karplus-Strong plucked-string algorithm, so it sounds like a string rather than a beep.
A plain Karplus-Strong delay line can only be a whole number of samples long, which puts high notes out of tune. An allpass filter adds the missing fraction of a sample.
measured error < 0.1 centReference tones
A tuner's own reference should be more accurate than what it measures.
Every string was recorded on the laptop mic at 44.1 kHz, several plucks each, and played back at four volume levels. Each change to the detector or the stabiliser had to pass the same recordings before it went into the app.
Testing
Measured on real guitar recordings, not only on clean test tones.