click-detector

just a random click detector for a goodie i got from bolt.new

2
0
2
TypeScript
public

bolt-click-detect

Minimal real-time mechanical keyboard click detector for macOS using Bun/Node.js and the built-in microphone.
When a click is detected, it opens https://bolt.new in Google Chrome.

Requirements

  • macOS with microphone access granted to your terminal.
  • SoX (Sound eXchange) command-line tools (provides the rec binary):
brew install sox
  • Bun (or Node.js) runtime.

Install

bun install

Run

bun start

This will:

  • Start streaming 16 kHz mono audio from the default input.
  • Run a simple DSP detector (RMS, RMS ratio, zero-crossing rate) on 20 ms frames.
  • Open https://bolt.new in Google Chrome when a click-like transient is detected.

Tuning

All detection parameters are defined near the top of click-listener.ts:

  • AMP_THRESHOLD: minimum RMS needed to be considered a candidate click.
  • RATIO_THRESHOLD: required RMS spike vs. previous frame.
  • ZCR_MIN / ZCR_MAX: expected zero-crossing-rate range for a click.
  • COOLDOWN_MS: minimum time between detections.
  • DEBUG: set to true to log sampled per-frame metrics.
v0.3.3[beta]