Lost In A Melody
Turn a song clip into a play-along piano guide: the notes fall onto an 88-key keyboard, and you play each one as it lands.
I can't read sheet music, so I built this to learn songs on my piano by ear. It pulls the tune out of a recording and shows it the way a rhythm game would. Here are two clips it processed. What you see is its raw output, with nothing corrected by hand.
Reading the guide
- Each bar is a note. It sounds when it reaches the keyboard, and its length is how long to hold it.
- Colors follow the note name, so every C is the same color in every octave.
- Melody line is the tune alone, one note at a time. Full is everything the transcriber heard, chords included.
- Original plays the recording. Simplified plays the notes on a piano instead, so you can hear what the transcription got right and what it got wrong.
How it works
- Separate. Demucs splits the clip into six stems: vocals, drums, bass, guitar, piano and everything else.
- Pick the stem that carries the tune. That's the one with the most signal: the voice in Amazing Grace, the piano in Greensleeves.
- Transcribe. Basic Pitch turns that stem into notes. The melody line is the highest note sounding at each moment.
- Line up with the beat. The notes are gently snapped to the detected tempo and saved as a short text file of notes in beats, easy to fix by hand.
It runs locally on a Mac with Apple silicon and doesn't need a GPU: a 30-second clip takes about ten seconds. This page plays clips that were processed ahead of time, so nothing runs on a server.
What it gets wrong
It does best when one voice or instrument clearly leads. A concert band, or a piano recording that the separator splits across two stems, comes out muddled, so those aren't shown here. Even in these two you'll spot slips: a brief F before many of the F♯s in Amazing Grace, where the singer slides up into the note, and a few low notes from the left hand in Greensleeves.
Credits
- Amazing Grace: sung by Southern Aire of the United States Air Force Reserve Band, a public domain recording (Wikimedia Commons). The clip is 0:04–0:42.
- Greensleeves for solo piano: anonymous pianist, recorded by Dieter Leckschat, licensed CC BY-SA 4.0 (Wikimedia Commons). The clip is 0:00–0:41; the excerpt and its transcription are shared under the same license.
- Piano sound: the Salamander Grand Piano by Alexander Holm, CC BY 3.0. Playback runs on Tone.js.