Detecting pitch with the Web Audio API and autocorrelation

Mar 20, 2022 · 1936 words · 10 minutes read JavaScript

I’ve been playing with the Web Audio API recently, and I made a basic app that will detect the pitch of incoming tones using your microphone. You can try it by pressing “Start” (be sure to try both the sine wave and the frequency displays), and I’ll be walking through how it works below.

Press start to begin

Rounding options:

Smoothing options:

Display (click Start after you switch):