Skip to content

bubiche/pitch_correction

Repository files navigation

pitch_correction

Browser-side vocal pitch correction for home audio recordings. Drop in an audio file (voice over a backing track, or a solo vocal), pick a key — or let it detect one — and download a pitch-corrected WAV. Runs entirely in the browser. No server, no uploads, no account.

pitch_correction UI — file dropzone, mode toggle, key selector, parameter sliders, A/B playback, and a pitch-contour visualization showing detected vs corrected pitch over time

Live

https://bubiche.github.io/pitch_correction/

Tested on desktop Chrome and Firefox. Mobile and Safari are best-effort — OfflineAudioContext quirks and memory limits make them unreliable for full-mode separation.

What it does

Two modes:

  • Direct — runs YIN pitch detection plus a WSOLA pitch shifter (soundtouchjs) on the whole signal. Best for solo vocal recordings. Will produce artifacts on polyphonic input.
  • Full — separates the vocal from the accompaniment with an MDX-Net ONNX model running in the browser, pitch-corrects the vocal stem only, then mixes the corrected vocal back over the untouched accompaniment. Best for full songs with one singer over a backing track.

Both modes snap detected pitch to the nearest scale tone in the selected key. The retune speed slider blends between passthrough and hard-snap (the classic Auto-Tune sound).

Other niceties:

  • Auto key detection runs on drop (Krumhansl–Kessler) and pre-fills the key selector; override it if you disagree.
  • A/B playback — listen to the original and the corrected output back-to-back without re-downloading.
  • Pitch contour visualization — overlays detected pitch, snap target, and corrected pitch over time.
  • WebGPU when available, threaded WASM otherwise. A 2:30 song separates in ~60–90 s on an M4 Max GPU, ~5 minutes on threaded WASM.

Local development

Pinned to pnpm 11 and Node 24 via .tool-versions.

pnpm install
pnpm dev          # local dev server
pnpm typecheck    # tsc -b
pnpm test         # tsx --test on src/lib/**/*.test.ts
pnpm build        # production bundle to dist/
pnpm preview      # serve dist/ at the /pitch_correction/ base
pnpm fixtures     # regenerate diagnostic WAV fixtures for the pitch shifter

The separation model (~64 MB) is committed under public/models/ so it ships with the Pages deploy. First load fetches it once and caches it in IndexedDB; subsequent runs read from cache.

Architecture & decisions

See ARCHITECTURE.md for the threading model, audio pipeline, library choices, and the click-suppression chain on the pitch shifter.

Credits

See CREDITS.md for library, model, and dataset attributions.

License

AGPL-3.0. The project bundles pitchfinder (GPL-3.0) for pitch detection, which forces strong copyleft on derivatives anyway — AGPL extends that to the hosted-app case so users of the public site have the same rights as users of the source.

About

vocal pitch correction for audio recordings on the browser

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors