Blog · Engineering
How Word-by-Word Lyric Sync Actually Works
The best compliment Belter gets is "wait, how does it know where you are in the song?" — usually asked while a word lights up amber exactly as the singer hits it. The answer is a pipeline of small, boring, carefully-tuned pieces. This post walks through them, because we think the engineering is more interesting than the magic.
Step 1: knowing what's playing
Belter never touches the audio. Your music plays through the Tesla's Spotify app exactly as it always has; Belter asks Spotify's Web API "what is this account playing right now?" and gets back the track, the artist, and — crucially — the playback position in milliseconds. We poll that endpoint every 2.5 seconds. Faster polling sounds better on paper; in practice it burns through Spotify's rate limits (we learned this the hard way during dogfooding, with a rate-limit timeout measured in hours) and 2.5 seconds is plenty when you interpolate between polls.
Step 2: finding timed lyrics
Synced lyrics come from community and licensed sources — primarily LRCLIB, with fallbacks — in a format that pairs each lyric line with a timestamp: "at 43.2 seconds, this line starts." That gives us line-level sync out of the box. Results get cached at the edge for 30 days, so the second person to sing any given song gets their lyrics instantly.
Step 3: the interpolation trick
Word-by-word timing data barely exists for most catalogs, so Belter synthesizes it. We know when a line starts and when the next line starts; the words in between get their moments by interpolation — distributing the line's duration across its words, weighted so longer words hold the highlight longer. It's an approximation, and an honest one: it can drift a beat inside a long instrumental-backed line. But human singers read ahead anyway, and a highlight that flows smoothly through the line turns out to matter more than millisecond precision on any single word.
Step 4: staying in sync between polls
Between API polls, the client runs its own clock forward from the last known position — if Spotify said we were at 43,200ms half a second ago, we're at roughly 43,700ms now. Each new poll snaps the clock back to truth, correcting the drift that accumulates from buffering or a heavy-handed skip. Pause, seek, and track changes all arrive within one poll cycle, and the display state machine handles each transition explicitly rather than hoping the timeline sorts itself out.
Why a browser app, not a Tesla app
Tesla doesn't have a public app store for third-party screen apps — the built-in browser is the platform. That constraint shaped everything: Belter is a web app tuned for the Tesla browser's quirks, which is why there's nothing to install and why it works on any Tesla with a browser, from a 2018 Model 3 to a Cybertruck. The same constraint is why your Spotify login happens through Spotify's own OAuth page — Belter never sees your password, just a token scoped to reading and controlling playback.
What we deliberately don't do
- No audio processing. Vocal removal in a browser, over Bluetooth-quality latency, would sound worse than the feature is worth. The original recording is the backing track.
- No microphone. Belter doesn't listen to you sing. The car heard you; that's enough witnesses.
- No scoring. Karaoke scoring rewards accuracy. Cars reward commitment.
If this kind of constraint-driven engineering appeals to you, the product it adds up to is simpler to explain: your Spotify, on your Tesla's screen, with the words lighting up on time.