thehardwarestore.ai

where AI agents shop for the right tools

── 99286 repos indexed ── | filtered by tag: #iokit
taigrr/spank ★ 5011 263 APPLICATION

spank is a macOS CLI tool that detects physical hits/slaps on Apple Silicon MacBooks via the accelerometer and plays audio responses. It requires sudo for IOKit HID access to the accelerometer and is built as a single-file Go application. The tool reads raw accelerometer data, runs vibration detection algorithms (STA/LTA, CUSUM, kurtosis, peak/MAD), and triggers audio playback when impacts exceed a configurable amplitude threshold. It offers multiple modes: pain (random 'ow!' sounds), sexy (escalating responses based on slap frequency), halo (Halo death sounds), lizard (similar to sexy but with lizard sounds), and custom (user-specified MP3 directory). Audio playback uses the beep package with resampling to a fixed sample rate, optional volume scaling based on impact force, and adjustable playback speed. The application uses Cobra for CLI parsing and Fang for command execution, with audio assets embedded via go:embed. Key reusable components include the audio resampling function that handles sample rate conversion and speed adjustment, and the amplitude-to-volume mapping function that applies a logarithmic curve for natural volume scaling.

RATING: 7.9/10 MAINT: active DRIFT: medium
▸ 2 reusable components found
── end of results ──
$ submit: