The idea
When you learn a song, you keep switching between two things: the recording, which is the reference, and a score or tab found online, which is often wrong, in another key, or simply out of step with what you hear. I wanted both in one place: the score of the song as it is played on that very recording, scrolling along with it.
The starting point is SheetSage2, a music transcription model published by m-a-p. From an audio file it produces time-stamped annotations: beats and downbeats, key, chords, sections (intro, verse, chorus…) and melody. Everything else in OpenTab is about turning those annotations into something you can play.
What OpenTab does
- A library: drop a file anywhere on the page (mp3, wav, m4a or flac, up to 10 minutes), and a progress bar follows the processing as a percentage
- A player: staff and tablature side by side, playback of the original mp3 with the cursor locked to it, jump by section, loop, slow-down, full screen
- Several ways to listen: the recording, or the generated notes (vocal line, instrumental part, chords) played by a synthesiser, to check the transcription by ear
- Three instruments: guitar, ukulele (G-C-E-A, high G) and low-G ukulele, at the same bar and without reloading the audio
- Exports: one Guitar Pro file per instrument, and an archive with all the annotations
From sound to tablature
- Model Listening MERT encoder, 300 s per pass
- Model Transcription decoder, time-stamped events
- Python Tablature placement on the fretboard
- Python Guitar Pro one .gp5 per instrument
- Browser alphaTab one sync point per bar
The model returns melody lines and chords, not finger positions. The same note can be played at several places on the neck, and that's where a tab becomes readable or not. Placement is a Viterbi algorithm: among all possible (string, fret) combinations, it keeps the sequence that minimises hand shifts, string jumps and fret height. Chords aren't picked from a dictionary but searched on the neck, root in the bass and spanning four frets at most, so rare chords work too.
The ukulele needed its own rules. Its strings are “re-entrant”: the G string sounds above the C string, so string order no longer matches pitch order. It only has two octaves of range: notes that fall off the neck are folded to the nearest playable octave, and the score says how many. And the usual chord shapes take priority over the automatic search, because a ukulele player expects a C as 0003, not a clever voicing.
A score that doesn't drift
A Guitar Pro file carries a single tempo. A recording breathes: the drummer speeds up in the chorus, the singer holds back the end of a line. A cursor driven by the written tempo drifts over the song, until it's a bar ahead or behind.
The fix is to flip the reference. The model gives the exact time of every downbeat; OpenTab turns that into one sync point per bar, handed to the alphaTab player. The model's grid is the source of truth, and the written tempo is only used for display. Measured on a 2:22 song: 26 checkpoints, zero drift, including right in the middle. The same principle lets you hear the generated notes on the synthesiser: each bar gets a tempo derived from its real duration, so the synth lands on the same instants as the recording.
One trap along the way: alphaTab adds its cursors to the page but ships no stylesheet for them. Without a few CSS rules, playback runs, the sound is there, and nothing moves on the score.
A progress bar that tells the truth
Processing a song takes from tens of seconds to several minutes. My first progress bar moved one notch per stage: it jumped to 50% as soon as analysis started, sat there for 99% of the time, then jumped to 100%. It needed a real progress signal.
Counting the tokens the model generates doesn't work: their density varies by a factor of two from one song to another. But the decoder writes events in chronological order, interleaved with time tokens. So the last time token emitted says exactly where the model is in the song. OpenTab watches it without touching the model's code, by wrapping its decode method on the loaded instance.
Real measurements revealed a second phase. Before generating anything, the encoder always listens to a full 300-second window, padding included, in one block, with nothing to report. So the bar has two parts: a listening phase that advances at the pace measured on the previous job, then the real transcription percentage.
That listening phase depends heavily on the hardware: about 18 seconds on a recent Mac, versus nearly 230 seconds on my OVH server, a 2012 Xeon without AVX2 instructions. Hence a per-machine initial listening duration, until the first measurement takes over.
Private by design
Users mostly import commercial recordings. The service stays within the private-copy exception as long as every space is private: no open sign-up, no public sharing, no catalogue, no indexing. Accounts are created by the administrator, every song belongs to an account, and another user's resource simply answers “not found”. Before the first import, you accept dated, versioned terms.
Sign-in goes through Keycloak, with a login page styled like the app that doubles as the landing page and explains the concept with a short animation. The browser only gets an opaque session cookie: no token leaves the server, which lets the audio player, the progress stream and alphaTab work without an authentication header.
Stack & hosting
- SheetSage2 (PyTorch, Transformers) for transcription, on CPU in production and on the Mac's Metal GPU in development
- FastAPI and a separate worker process that keeps the model in memory, handles one song at a time and streams progress over Server-Sent Events
- A memory guard: the worker is killed and restarted if its footprint exceeds its limit or free system memory runs low, so it never freezes the machine
- Next.js for the interface and alphaTab for the score, the tablature and synced playback
- Keycloak and PostgreSQL for accounts, SQLite for the library
- Docker Compose behind Traefik on my OVH server, Keycloak served under the same domain and its admin console reachable only through an SSH tunnel
What I take away from it
- The model is only the beginning. The value comes from everything that turns its annotations into something playable: fretboard placement, sync, the player.
- When two clocks coexist, pick one. As soon as the model's grid became the reference, the drift disappeared.
- An honest progress bar means measuring before estimating. The listening phase wasn't in any documentation; it showed up in the first real measurement.
- Hardware matters as much as code: the same model takes 18 seconds or nearly 4 minutes to listen to a song depending on the CPU.
What's next
On my current server, each song takes about four minutes, almost all of it in the encoder. Next ideas: a newer machine or a GPU for that phase, letting the encoder listen only to the song's real length when it's short, and new instruments such as bass.
Discover OpenTab
The app is live, by invitation: the landing page shows the concept in a few seconds. The code is private, but I'm happy to talk about the architecture or the technical choices.