← All models

pitch-estimation Β· audio Β· WASM (onnxruntime-web) Β· ~2 MB

CREPE β€” trace the pitch of any sound

Pitch is the note you'd hum back. CREPE answers one focused question, many times a second: what is the fundamental frequency right now? It's a small (~2 MB) convolutional network that reads audio in 1024-sample windows and returns a 360-bin pitch salience β€” the confidence-weighted peak is the frequency, in Hz and as a musical note. It's the engine behind tuners, vocal-pitch monitors, auto-tune, and melody transcription. Here it runs entirely on your device.

At a glance

Modelniobures/CREPE β€” an ONNX conversion of CREPE "tiny" (Kim et al., ICASSP 2018)
Taskpitch-estimation β€” a per-frame fundamental frequency (f0) + voicing confidence
Runtimeonnxruntime-web directly β€” transformers.js has no pitch/CREPE pipeline, so this page drives ONNX Runtime Web itself (isolated to this model's worker)
Architecture6-layer CNN. Input frames [NΓ—1024] (per-frame-normalised 16 kHz windows) β†’ output probabilities [NΓ—360] pitch-salience bins (C1…B7, 20 cents apart)
f0 read-outconfidence-weighted average of cents around the peak bin, then 10Β·2^(cents/1200) Hz; the peak height is the voicing confidence
Quantizationfp32 ONNX (the "tiny" model is ~1.9 MB β€” no quantisation needed)
BackendWebAssembly via onnxruntime-web (single-threaded; runs anywhere)
Download~2 MB, cached in Cache Storage after first load (auto-inits next visit)
LicenseModel weights MIT (marl/crepe). Bundled sample clips are self-authored (CC0).
Web APIsWebAssembly, Web Workers, Web Audio, MediaRecorder, Cache Storage, Canvas β€” all Baseline widely available

Run it

Pick a sample, drop an audio file, or record yourself humming/singing, then hit Trace pitch. CREPE walks the clip window-by-window and reads the fundamental out of each one.

Drop an audio file here, or click to choose
0.50
16

See inside

CREPE never outputs "the note is A4". For every window it outputs a 360-bin salience curve β€” how much energy sits at each of 360 pitch candidates from C1 to B7. The top map is that raw salience over time (brighter = higher activation); the white line is the f0 we read out of it, and the peak brightness at each moment is the confidence. Below it, the same f0 drawn on a note grid β€” voiced frames only, opacity following confidence.

Extracted f0 on a musical-note grid (C and A lines labelled):

Trace a clip to see its pitch curve and note histogram.

Why it matters

Pitch tracking is small, fast infrastructure that a surprising amount of music and voice tech is built on β€” and it belongs on-device, because it's cheap and nobody needs to upload their singing to a server to get a note back.

Use cases

Basics

Play or hum a single note and read the pitch back β€” Hz, the nearest note, and how many cents off.

Practical

A live chromatic tuner: sing or play into your mic and watch the needle settle on the note.

Wild

Hum a melody and CREPE traces the contour, then snaps it to notes β€” query-by-humming.

Multi-model

CREPE + Whisper: transcribe the words and track the pitch of speech β€” prosody, side by side.

How the API works

There's no pipeline() for pitch β€” you drive onnxruntime-web directly. Frame the audio into per-frame-normalised 1024-sample windows, run the CNN, and read the fundamental out of the 360-bin salience.

import * as ort from "onnxruntime-web";

const session = await ort.InferenceSession.create(
  "https://huggingface.co/niobures/CREPE/resolve/main/models/onnx/crepe_onnx_tiny.onnx",
  { executionProviders: ["wasm"] },
);

// One 1024-sample window @16 kHz, normalised (subtract mean, divide by std):
const frame = normalise(win1024);
const out = await session.run({ frames: new ort.Tensor("float32", frame, [1, 1024]) });
const act = out.probabilities.data;                 // 360 salience bins, C1…B7, 20 cents apart

// f0 = confidence-weighted centre of the peak, in cents β†’ Hz:
const peak = argmax(act);
const cents = weightedCents(act, peak);             // avg over Β±4 bins around the peak
const f0 = 10 * 2 ** (cents / 1200);                // Hz
const confidence = act[peak];                       // 0…1 voicing confidence

This page decodes files / mic recordings to 16 kHz mono with an OfflineAudioContext, batches the windows and runs them inside a Web Worker (so the UI never janks), caches the ~2 MB model in Cache Storage (return visits auto-initialise with no download), and converts each f0 to the nearest equal-tempered note plus a cents deviation.

References