Browser-based transcription · Basic Pitch model, piano roll, MusicXML, MIDI, PDF

Piano Transcription to Sheet Music

Turn a recording of solo piano or guitar into notes you can fix on a piano roll, then into a two-staff score with MIDI, MusicXML and PDF downloads.

Recording

Audio or video with a soundtrack, up to 5 minutes. The model is a 225 KB file and the runtime a 14 MB WebAssembly file, both served from this site and cached after the first run.

Drop a piano recording here or click to choose

MP3, WAV, M4A, FLAC, OGG, MP4 and more

Accuracy: Basic Pitch works on any single instrument and does best on one at a time. Dense chords, pedalled passages, reverb and mixed bands cost notes and add octave or harmonic errors, so treat the result as a first draft to correct on the piano roll.

Piano Transcription to Sheet Music

Operator: Abdulla Al Fahad. How tools are built and checked

Working out a piece by ear means replaying four bars forty times. An automatic transcription will not give you a finished score, but it can give you the draft: which notes sound when, in a form you can correct instead of hearing again. This page runs Spotify's open Basic Pitch model on a recording and shows what it heard as a piano roll.

From the roll you can delete notes that are really overtones, add the ones it missed, and play the result back. Then the page fits a beat grid to the notes, quantises them, splits them between a treble and a bass staff and draws the score, with MIDI, MusicXML and PDF downloads.

Key features

  • Polyphonic note detection with Basic Pitch (Apache-2.0), run on a 225 KB ONNX model through a WebAssembly runtime served from this site
  • Piano roll with click-to-select, drag-to-add, delete, undo (50 steps), numeric editing of start, end, pitch and velocity, and playback
  • Tempo and key estimated from the audio, with the tempo, beats per bar (2, 3 or 4), grid (sixteenths, eighths or eighth triplets), rest beats before the first note, hand split and key signature all editable
  • Two-staff score drawn with OpenSheetMusicDisplay, with MusicXML, a Standard MIDI File and a PDF of the drawn pages as downloads
  • A tuning estimate in cents from the model's contour output, so a recording that sits flat or sharp of A=440 is not mistaken for wrong notes
  • Detection thresholds, shortest note and pitch range that can be changed and re-run without decoding the audio again

How the notes are found and written as a score

Basic Pitch takes mono audio at 22,050 Hz in windows of 43,844 samples, a little under 2 seconds, that overlap by 30 frames (7,680 samples). For each window it returns three matrices: a note activation and an onset probability for each of the 88 piano keys (MIDI 21 to 108), and a contour with three bins per semitone. Each frame is 256 samples, 11.6 ms. Half of the overlap is trimmed from each end of every window and the pieces are joined, so a note that crosses a window edge is not cut in two.

Notes are decoded the way the model's authors do it. An onset counts where the onset probability is a local peak of at least 0.5. The note then lasts until its activation stays under 0.3 for 11 frames, and it must be longer than 11 frames (127.7 ms) to be kept. Neighbouring semitones are cleared while a note is being claimed, so one pitch does not produce a ghost note beside it. A second pass finds the strongest activation that is left and follows it forwards and backwards, which catches notes whose onset was weak. Where the activation rises sharply without a predicted onset, one is inferred. These thresholds are the defaults of the Basic Pitch code and are the sliders on this page.

The recording can be up to 5 minutes. A file is checked for its length before it is decoded, then decoded to 22,050 Hz mono. The result is returned as notes with start and end in seconds, a MIDI pitch and a velocity that is 127 times the mean activation, never below 20.

How it works

The beat grid is fitted to the notes, not to the audio's beats. For the chosen tempo the page tries 120 offsets inside one grid cell and keeps the one where the note onsets, weighted by velocity, sit best on the cell boundaries. Bar 1 then starts on the cell nearest the first onset, so the first note falls on beat 1; 'rest beats before the first note' moves it later when the music starts on a pick-up.

Each note is rounded to the nearest cell for its start and end, and is at least one cell long. Notes at or above the split pitch (60, middle C, by default) go to the treble staff and the rest to the bass staff. Within a staff the notes become one line of chords: every chord lasts until the next attack in that hand, or until its own longest note, whichever is shorter. Gaps are rests.

The score uses 12 divisions per quarter note, which holds sixteenths, eighths and eighth triplets as whole numbers. A length is split into the largest values that fit and that begin on a beat boundary they belong to, so a half note starting on beat 2 of 4/4 is written as two tied quarters. A chord that runs across a bar line is tied to its continuation. Pitches are spelled from the key signature: the key's own notes get their proper letters (E sharp in F sharp major, not F), and other notes use flats in flat keys and sharps in the rest.

Common use cases

  • A teacher records a student's two-minute piano piece on a phone, deletes the overtones that appear an octave and a twelfth above held bass notes, and prints the PDF as a reference for the next lesson.
  • A guitarist loads a slow fingerpicked riff, lowers the shortest note to 80 ms so quick pull-offs survive, and exports the MIDI to see the harmony in a DAW.
  • An arranger needs the chords of a hymn played once on a piano: the MusicXML opens in a notation editor, where voices are split and the pedal is added by hand.

How to use this tool

  1. Choose a recording of up to 5 minutes. Wait for the model to load and the 2-second windows to be processed; Cancel stops it at any point.
  2. Listen to the piano roll with Play, then click wrong notes and delete them, or drag across empty space to add a missing one.
  3. If the roll is full of faint notes or missing quiet ones, change the onset and frame thresholds and press Detect again. This replaces any edits.
  4. Check the tempo, beats per bar, grid and key signature in the Score section. Halve or double the tempo if the estimate is an octave off.
  5. Press Build score and look at the drawn bars. If the first note should be a pick-up, change the rest beats and build again.
  6. Download the MIDI (with or without snapping to the grid), the MusicXML, or the PDF of the drawn score.

Example

A recording like this: a C major chord (C4, E4, G4) held for about a second, then a single C5 held for a second, at 120 BPM

Sixteenth-note grid, 4/4, hand split at 60, default thresholds

Piano roll, grid and score

Piano roll: C4, E4 and G4 from about 0.50 s to 1.52 s, and C5 from 2.00 s to 3.03 s.
Grid: bar 1 starts at 0.50 s. The chord begins on beat 1 and lasts 8 sixteenths, a half note, in the treble staff; C5 starts on beat 4 and lasts 8 sixteenths, so it is tied across the bar line into bar 2.
Score: 2 bars, 5 written notes (the tied C5 counts twice).

Tips for best results

  • Delete the faint notes that sit exactly an octave or a fifth plus an octave above a loud note first: they are the most common false detections, and removing them makes the left hand easier to read.
  • A recording with a steady note repeated quickly, such as a tremolo, needs a lower shortest-note setting; the default 127.7 ms drops anything shorter.
  • Set the tempo before pressing Build score, not afterwards: the grid fit depends on it, and half the true tempo gives a score with the right notes in clumsy values.
  • To transcribe one hand, set the lowest or highest note in Detection to cut off the other hand's range before detecting again.

Edge cases to watch

The score is a draft. A held note that overlaps a new attack in the same hand is shortened at that attack, so inner voices lose their length; the MIDI file keeps every note's real length.

Basic Pitch does not depend on one instrument, since it was trained on recordings of several instruments and voice, but it works best on one instrument at a time. A full band, reverb-heavy room recordings, heavy pedal and dense chords all cost notes and add wrong ones.

Only 2/4, 3/4 and 4/4 are written, always on a quarter-note beat, with one tempo for the whole piece. Rubato, tempo changes, triplets mixed with sixteenths, ornaments, dynamics and pedal marks are not notated.

Common errors and how to fix them

No notes were found
The recording may be too quiet or not a pitched instrument. Lower the onset and frame thresholds in Detection and press Detect again.
The transcription worker stopped unexpectedly
The model or the WebAssembly runtime did not load. Check the connection and reload; older browsers without WebAssembly cannot run the model.
The recording is longer than 5 minutes
Cut out the passage you need first. The model works on 2-second windows, so a longer file mainly costs time and memory.
Enter a tempo between 30 and 300 BPM
The tempo box holds a number outside that range or text. The score cannot be built until it is valid, and the MIDI export is held back too.

Best practices

  • Record close to the instrument in a dry room, with no accompaniment; the model is far better on a clean single instrument than on a polished mix.
  • Correct the piano roll before building the score, since the score is rebuilt from the notes every time and edits made afterwards need a rebuild.
  • Take the MusicXML to a notation editor for the last 10%: voices, pedal, fingering and dynamics are things this page does not write.

What the model hears and what it does not

Basic Pitch is a very small neural network (its model file is 225 KB), trained to say which pitches are sounding in each 11.6 ms frame and where notes begin. It does not know what instrument it is listening to and it has no model of harmony, so it cannot tell a real fifth from an overtone that happens to line up with one. That is why overtones are the usual false notes and why raising the onset threshold removes more of them than raising the frame threshold.

Everything after detection is deterministic code in your browser: the thresholds, the beat grid, the splitting into staves and the MusicXML are arithmetic, so the same notes and settings always give the same score.

Reading the tuning estimate

The contour output has three bins for each semitone, with the middle bin on the nominal pitch. For every detected note the page sums the contour over the note's frames across five bins (a semitone and a third either side of the nominal pitch), finds the peak of that profile by parabolic interpolation and converts its offset to cents. The median over all notes is shown next to the recording's details, and it needs at least 5 notes. On test tones detuned by -45, -30, +15, +30 and +45 cents the reading came out at about -43, -35, +7, +30 and +38 cents, so treat it as good to roughly 10 cents. A reading of about +30 means the recording sits a third of a semitone sharp; the notes are still written at their nearest semitone.

Frequently asked questions

How does this differ from Audio to MIDI on this site?

Audio to MIDI follows a single melody line. This page uses a polyphonic model, so chords and two hands come out as separate notes, at the price of a 14 MB runtime download on first use.

What is downloaded, and from where?

The 225 KB Basic Pitch model and the ONNX Runtime WebAssembly file (about 14 MB) are served from this site's own folders, then cached by the browser. Your recording is decoded and processed locally.

Why is the tempo wrong by a factor of two?

The tempo estimator can settle on half or double the felt pulse. Type the tempo you expect into the Score section; the notes are not affected, only how they are rounded onto the grid.

Why is a note shorter on the score than on the piano roll?

Within one hand the score cuts a chord at the next attack, so a held inner note that overlaps a new chord is shortened to fit a single line of chords. The piano roll and the MIDI file keep the note's real length.