//click-detectorbyTahul

click-detector

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

0
0
0
TypeScript

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

  • undefinedmacOS with microphone access granted to your terminal.
  • undefinedSoX (Sound eXchange) command-line tools (provides the rec binary):
brew install sox
  • undefinedBun (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:

  • undefinedAMP_THRESHOLD: minimum RMS needed to be considered a candidate click.
  • undefinedRATIO_THRESHOLD: required RMS spike vs. previous frame.
  • undefinedZCR_MIN / ZCR_MAX: expected zero-crossing-rate range for a click.
  • undefinedCOOLDOWN_MS: minimum time between detections.
  • undefinedDEBUG: set to true to log sampled per-frame metrics.
[beta]v0.14.0