The geek corner · engineering notes
The engineering behind SynkEngine
One song on every phone in the room at the same instant, with no server: the phones find each other on the Wi-Fi and agree on one party clock. The clock is the easy part. The hard part is that every phone's speaker runs late by a different amount, no API tells you how much, and it changes with the song. This page is where we write down what worked, with the numbers.
How it works, for engineers
No server, no account. The phones find each other on the Wi-Fi and agree on one party clock (a small NTP-style exchange with the host). Then the real work starts, because every phone's speaker runs late by a different amount, and the amount changes with the song. Five ideas carry the app:
- Measure the air, not the network. In short listening rounds, every phone records its own microphone over the same seconds of party time while the music plays, reduces it to a loudness curve (one value per 5 ms, about 1 kB) and sends the curve. The host cross-correlates the curves; the lag is the true gap between two speakers, with decoder, buffer, speaker and room included. The audio is discarded on the phone.
- The phantom peak. Two phones near each other hear both speakers. With crosstalk
g, the correlation is R(τ) = R_a(τ−d) + 2g·R_a(τ) + g²·R_a(τ+d): the truth, a phantom at zero that grows twice as fast as the crosstalk, and a mirror. Above g = 0.5 the phantom is the tallest peak. It is narrow and sits at zero, so it is recognised by shape and suppressed. At 60 % crosstalk: 14/120 correct before, 117/120 after.
- Never move on one reading. Three overlapping slices per recording, the median wins (mean error on the hard case 246 → 170 ms). Windows that opened up to 93 ms late gave a 36 ms median error; opening them on the recording's own timestamp (v6.54) gives 0.7 ms.
- Two quantities, two instruments. What a microphone hears is the sum of where each player is (changes every song) and how late the handset's speaker is (a property of the phone). Each phone timestamps its own playback position on the party clock and reports it; the report is timestamped, not measured on arrival, so a 300 ms doze in a Wi-Fi power-save queue costs nothing. Mean error 1.1–6.3 ms versus 94.8 ms for a microphone round. The microphone keeps the handset's own delay, remembered per phone as a median across songs.
- One maths, two languages. Android in Java, Windows in Go. A JVM oracle runs the unmodified Android classes and the Go port on the same cases and diffs the answers: identical. Every v6.54 fix is broken on purpose to prove a test catches it (234/234); a 180 s soak test runs 2,245 actions.
Karaoke over Wi-Fi: the singer's phone is the mic, every other phone is the speaker, 120–190 ms from voice to room (capture 20–40, frame 20, network 2–10, jitter buffer 60, output 20–60). The singer's own phone plays the song at 20 %, early by the party's voice delay, so the singer lands on the room's beat. Feedback is fixed at its root, a 0 dB start ceiling, not with an adaptive canceller: the listening phones' clocks drift, and 0.18 ms of creep turns the phase at 5.7 kHz through a whole cycle, so a canceller would chase its own model. On a bench of three model rooms: 38.1 / 8.4 / 32.4 seconds of howl per minute of singing without a guard, 0.0 / 0.0 / 0.0 with it.
The articles
- It learns your phones, not your habitsThe learning model inside SynkEngine: ten numbers that decide what to believe, three memories that never leave the party, and why that beat a neural network on the arithmetic. 15 minutes.
- Five ideas we measured before we believedThe short version of this page, with the phantom-peak picture, on our LinkedIn page.
- The geek corner on GitHubThe same notes as a README, with the pictures, next to our official links. The app's source stays private.
- How it works, in 57 secondsThe film, with the transcript and the key moments, for everyone else.
Where the geek corner lives
The long reads are here and on the blog. The posts are on LinkedIn, the README on GitHub, and the films on YouTube. Same name everywhere: synkengine. Anything else isn't us.
Made in Mauritius by one person working with two AI models. Alpha 11/11 at 11:11, launch 12/12 at 12:12.
Request early: the first 108 requests get lifetime access, free.
Get the app