music transcription · audio · WASM · ~0.3 MB
The built pitch detection demo tracks one note at a time. Real music is polyphonic — many notes at once. Basic Pitch, Spotify's tiny (~0.3 MB) audio-to-MIDI model, listens to a whole mix and lights up every key it hears as a piano roll. Play a sample, drop in an audio clip, or record from your mic — the model runs entirely on your device; nothing is uploaded.
| Model | Spotify Basic Pitch (nmp) — a lightweight audio-to-MIDI network |
|---|---|
| Task | music-transcription / audio-to-MIDI (polyphonic note detection) — run via raw ONNX Runtime Web (see note below) |
| Runtime | onnxruntime-web 1.21 (transformers.js has no music-transcription task) |
| Input | [1, 43844, 1] float32 — one ~1.99 s window of mono audio at 22050 Hz (raw waveform; the harmonic-CQT frontend is inside the graph) |
| Output | per window: note [1, 172, 88] + onset [1, 172, 88] (MIDI 21–108) + fine contour [1, 172, 264] |
| Quantization | fp32 ONNX — runs on the plain WASM execution provider, no WebGPU needed |
| Backend | WebAssembly (single-threaded on GitHub Pages) — ~60 ms per ~2 s window |
| Download | ~0.3 MB, cached after first load (auto-inits on return) |
| License | Apache-2.0 (Spotify) — the weights stay Apache-2.0 wherever mirrored |
| Web APIs | WebAssembly, Web Workers, Web Audio (decode + mic), Canvas — all Baseline widely available |
Pick a sample, upload a clip, or record to transcribe.
A simple peak-pick over the model's note + onset heads (not Basic Pitch's full note-creation algorithm).
Transformers.js has no music-transcription task, so we run Basic Pitch's ONNX graph directly with onnxruntime-web: resample audio to 22050 Hz mono, feed it in ~2 s windows, and read the model's note, onset, and contour heads. The piano roll above is the model's raw note output — every lit cell is a pitch the network heard at that moment. It's polyphonic by design, so chords and two-hand playing show many keys at once. Everything runs on your device.
Tune onset/frame thresholds live over procedural presets, inspect exact MIDI note tables, and play back the transcribed notes via Web Audio.
Quantize hummed or played audio to 1/4, 1/8, or 1/16 beat grids, detect key & BPM, and download a real binary Standard MIDI File (.mid) for your DAW.
Map transcribed notes onto a 6-string guitar TAB with measure-by-measure chord detection, pitch accuracy metrics, and a live Piano / Chiptune / Pad remix engine.
Combine Basic Pitch polyphonic MIDI transcription (~0.3 MB) with DistilHuBERT 10-genre classification (~24 MB) in separate Web Workers on the same clip.