🔢

Frequency Counter

A precision lab-style frequency counter running on your microphone. Sub-bin parabolic interpolation gives ~0.01 Hz precision on a clean tone at FFT 8192. Switch between Hz, RPM and period modes; track min, max, average and standard deviation over a rolling window; freeze a reading at any time.

Awaiting signal…
— — — — Hz
peak — dBFS n = 0

Input & gate

Narrow the search window if the strongest spectral peak is not the tone you want to measure.
Idle — press Start mic.

Rolling statistics

Minimum
Maximum
Average
Std dev (jitter)
How the measurement works
fest = (k + δ) · sr / N
δ = ½(α − γ) / (α − 2β + γ)
Parabolic interpolation across the three dB magnitudes around the peak bin k. Stats accumulate across the most-recent ~60 estimates.
Recent estimates — last ~10 s

Share or embed this tool

Free to use on your own website — WordPress, Wix, or any platform. Paste one line and it works instantly, resizing to fit.


How a Frequency Counter Works

A hardware frequency counter opens a "gate" of fixed duration T (typically 0.1 s, 1 s, or 10 s), counts how many full cycles N pass during T, and reports f = N / T. Longer gates give more precision but slower updates. This tool is the software equivalent: each FFT frame is the gate, the peak bin is the "cycle count", and parabolic interpolation extracts sub-bin precision. Used as a mic frequency meter, it works for any periodic acoustic signal — musical tones, mains hum, motor vibration, tuning forks, and electronic oscillators played through a speaker.

Why FFT + parabolic interpolation (not zero-crossing)?

A clean sine wave can be measured beautifully by counting zero crossings, but real microphone signals have harmonics, noise, and DC offset that fool zero-crossing detectors. The FFT separates the signal into frequency bins using a Hann window to control spectral leakage, the peak bin tells you which frequency dominates, and parabolic interpolation fits a curve through the three magnitudes around the peak (in dB) to find the true frequency between the bins. For a Hann-windowed clean tone, this method is accurate to about 0.01 Hz at FFT 8192 — far better than the natural bin spacing of 5.86 Hz. If you want to visualize the full spectrum that the counter is reading from, the FFT frequency analyzer renders a live spectrogram alongside its peak measurement.

The gate-time / FFT-size trade

Frequency resolution = sample rate ÷ FFT size. At 48 kHz, FFT 4096 gives 11.7 Hz bins; FFT 32768 gives 1.46 Hz bins. More bins = better resolution, but longer frame duration before the result is available. Pick the smallest FFT that gives you the resolution you need; for vocals or instruments, FFT 8192 is the sweet spot. For lab-grade sub-Hz precision on a stable oscillator tone, use FFT 32768 at the cost of a ~0.7 s update interval.

Search window — narrow it if there are spurious peaks

By default the tool searches 20 Hz – 20 kHz. If you're measuring a low fundamental but the strongest spectral peak is a harmonic (or room noise at 60 Hz / 50 Hz mains hum), narrow the search range to bracket the expected fundamental. A 200 Hz tone with a strong second harmonic at 400 Hz: set max = 300, peak detection lands on 200 Hz cleanly. This search-window gating is analogous to the bandpass filter used in hardware benchtop frequency counters.

RPM mode

For tachometer applications: RPM = fHz · 60 / pulses-per-rev. A 4-stroke 4-cylinder engine with one ignition pulse per cylinder per crank revolution produces 2 pulses/rev (firing order = 2 cylinders per rev). Set pulses-per-rev to match your sensor: 1 (1×/rev sensor), 2 (4-cyl 4-stroke), 4 (some 4-pulse encoders), etc. The reading then directly shows shaft RPM. This is useful for contactless speed measurement using an acoustic pickup near a rotating component.

Period mode

Period = 1 / frequency. Useful when working with timing rather than frequency directly — for example, measuring the cycle time of a PLC pulse or the repetition period of a click train. The tool auto-scales the units between s, ms, µs and ns depending on the period magnitude. To compare two different periodic signals in the frequency domain, use the frequency comparison tool for an A/B spectral overlay.

Frequently Asked Questions

Why does the readout jitter even on a "constant" tone?
Three sources: (1) the source isn't actually perfectly constant — function-generator analog drift is typically 10–100 ppm = 0.1 Hz at 1 kHz; (2) the FFT has finite resolution and the peak bin may flicker between adjacent indices when the true frequency sits near a bin boundary; (3) microphone and ADC contribute thermal noise that shifts the estimated peak slightly each frame. The standard-deviation cell quantifies the jitter — for a clean function-generator tone you should see less than 0.1 Hz at FFT 16384. If yours is much higher, check for harmonics confusing the peak detection or background noise mixing with the signal.
My RPM display is exactly half of what it should be — what's wrong?
Your pulses-per-rev setting is half the actual value. Common confusion: a 4-stroke engine fires each cylinder once per 2 crank revolutions, so a 4-cylinder produces 2 pulses per crank revolution, not 4. The general rule for a 4-stroke is pulses/rev = Ncyl ÷ 2, so: 2-cyl → 1, 4-cyl → 2, 6-cyl → 3, 8-cyl → 4. (2-stroke engines fire every revolution, so pulses/rev = Ncyl directly.) If you used twice the right value you'll see exactly half the expected RPM.
Why does precision improve with larger FFT?
FFT bin width = sample rate / FFT size. With 48 kHz audio: FFT 4096 → 11.7 Hz bins; FFT 32768 → 1.46 Hz bins. Parabolic interpolation gives roughly 0.01 of a bin precision for a Hann-windowed clean tone — so 0.01 Hz at FFT 16384, but 0.1 Hz at FFT 4096. The trade-off: larger FFT means each frame takes longer, so the display updates more slowly and tracks fast tempo changes less responsively.
Is the mic audio uploaded anywhere?
No. All processing happens in your browser via the Web Audio API. The audio stream goes microphone → AnalyserNode → FFT — never leaves the page, never goes to any server. The browser asks once for permission; you can revoke it any time via the address-bar permission icon.
Why is the displayed peak level in dBFS rather than dB SPL?
"dBFS" = decibels below the full-scale level of the digital sample (where 0 dBFS = the loudest the converter can represent). It's the only honest measurement we have access to without a calibrated reference mic. A typical phone or laptop mic, recording a casual conversation at arm's length, sits around −30 to −20 dBFS. The confidence dot turns green above −30 (strong signal), yellow −30 to −50 (acceptable), red below −50 (the FFT peak detector is fighting noise).
Can I measure ultrasonic / sub-audible frequencies?
The upper bound is the sample rate ÷ 2 (Nyquist). Most laptops and phones run at 44.1 or 48 kHz, giving a hard maximum of ~22 / 24 kHz. Many mics have terrible response above 12 kHz anyway. Below: the FFT has bins down to fundamental_freq = bin_width, so at FFT 32768 / 48 kHz you can measure down to about 1.5 Hz — but most mics filter out infrasound below 30 Hz, so you'll need a special mic to measure subsonic content.
Why is the search-window default 20 Hz – 20 kHz?
That's the standard audio band — covers all musically and acoustically interesting tones plus most mechanical-equipment vibration. Narrowing it makes peak detection more robust: if you're measuring a 50 Hz mains-frequency signal, set max = 100 Hz and the tool will lock to 50 Hz instead of getting distracted by a louder higher-frequency peak. If you're measuring a 5 kHz beep, set min = 3000 to skip the room HVAC.
The reading is wildly different from my function generator — why?
Most likely your function generator output is being saturated/distorted in the mic preamp, so the strongest spectral peak is a harmonic rather than the fundamental. Lower the function generator amplitude or move the mic further away. If the readout reports an exact multiple (2×, 3×, 5×) of the expected frequency, that's the giveaway. Also: PC line-in and mic-in have different impedance — using a 1 Vpp signal generator into a mic input meant for 5 mV will clip badly.
Can I use this as a tuner or musical pitch counter?
This tool measures the dominant spectral peak, which for a solo instrument or pure tone corresponds to the fundamental pitch. At FFT 8192 you get roughly 0.01 Hz precision, which is more than sufficient for tuning — the equal-tempered semitone at A4 (440 Hz) is only 26 Hz wide. However, for polyphonic sources (chords, ensembles), the FFT peak will lock to whichever note is loudest, not a specific one. For dedicated pitch reading with note-name display, see the pitch detector. For musical A/B spectrum comparison (timbre matching), use the frequency comparison tool instead.
What is standard deviation (std dev / jitter) telling me and why does it matter?
Standard deviation in this context quantifies measurement jitter — how much the frequency estimate varies from frame to frame. A low std dev (under 0.1 Hz for a clean tone at FFT 16384) means the source is stable and the SNR is good. A high std dev indicates instability in the source, background noise competing with the signal, or the FFT peak flickering between adjacent bins. The std dev cell is your quality-of-measurement indicator: if it is large, consider narrowing the search window, using a larger FFT, or improving the signal-to-noise ratio of your source.
How accurate is the microphone frequency counter compared to a hardware instrument?
For a clean, loud tone into a quality microphone, accuracy is primarily limited by the microphone itself rather than the FFT algorithm. Parabolic interpolation on a Hann-windowed 8192-point FFT gives roughly 0.01–0.05 Hz precision at 1 kHz, comparable to a bench-top frequency counter at a short gate time. However, consumer laptop mics introduce noise floors around −60 to −50 dBFS, which becomes the limiting factor for weak signals. For the highest accuracy, use an external USB microphone or audio interface with a low-noise preamp, and choose FFT 16384 or 32768.