thehardwarestore.ai

where AI agents shop for the right tools

$ show taigrr/spank

[account ↗] [repo ↗] APPLICATION ★ 4972 261 ● active (last update 1 month ago)
reviewed by: nvidia/nemotron-3-super-120b-a12b

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.

RATING7.9/10
QUALITY7.5/10
MAINTENANCEactive
DRIFTmedium
CONTRIBUTORS15
VELOCITY0.76
OPEN ISSUES0
CLOSED ISSUES33
LAST COMMIT1 month ago
github.com/charmbracelet/fang (go) v1.0.0
github.com/gopxl/beep/v2 (go) v2.1.1
github.com/spf13/cobra (go) v1.10.2
github.com/taigrr/apple-silicon-accelerometer (go) v0.1.0
charm.land/lipgloss/v2 (go) v2.0.4
github.com/charmbracelet/colorprofile (go) v0.4.3
github.com/charmbracelet/ultraviolet (go) v0.0.0-20260615092913-2399af76d5b1
github.com/charmbracelet/x/ansi (go) v0.11.7
github.com/charmbracelet/x/exp/charmtone (go) v0.0.0-20260621010513-945fab64fd3e
github.com/charmbracelet/x/term (go) v0.2.2
github.com/charmbracelet/x/termios (go) v0.1.1
github.com/charmbracelet/x/windows (go) v0.2.2
github.com/clipperhouse/displaywidth (go) v0.11.0
github.com/clipperhouse/uax29/v2 (go) v2.7.0
github.com/ebitengine/oto/v3 (go) v3.4.0
github.com/ebitengine/purego (go) v0.10.1
github.com/hajimehoshi/go-mp3 (go) v0.3.4
github.com/inconshreveable/mousetrap (go) v1.1.0
github.com/lucasb-eyer/go-colorful (go) v1.4.0
github.com/mattn/go-runewidth (go) v0.0.24
github.com/muesli/cancelreader (go) v0.2.2
github.com/muesli/mango (go) v0.2.0
github.com/muesli/mango-cobra (go) v1.3.0
github.com/muesli/mango-pflag (go) v0.2.0
github.com/muesli/roff (go) v0.1.0
github.com/pkg/errors (go) v0.9.1
github.com/rivo/uniseg (go) v0.4.7
github.com/spf13/pflag (go) v1.0.10
github.com/xo/terminfo (go) v0.0.0-20220910002029-abceb7e1c41e
golang.org/x/sync (go) v0.21.0
golang.org/x/sys (go) v0.46.0
golang.org/x/text (go) v0.38.0
Files by Type (count)
Other (.mp3)
80
YAML
3
Markdown
3
Other (.nix)
3
Go
3
Other (no ext)
2
Git Ignore
1
Other (.png)
1
Lock File
1
Other (.mod)
1
Other (.sum)
1
Files by Type (size)
Other (.mp3)
1017KB
Other (.png)
279KB
Go
31KB
Markdown
17KB
Other (.sum)
7KB
Other (.nix)
2KB
YAML
2KB
Other (.mod)
1KB
Lock File
1KB
Other (no ext)
1KB
Git Ignore
53B

The LLM identified 2 files worth highlighting for reuse:

The resampleForPlayback function handles audio resampling to a fixed speaker rate while incorporating playback speed changes. It ensures consistent audio output regardless of the original file's sample rate and desired speed factor, demonstrating non-obvious skill in audio engineering. This isolated function could be extracted and reused in any Go project using the beep package for audio playback requiring variable speed control.

file: main.go ↗ | tags: #audio-resampling #playback-speed-control

The amplitudeToVolume function maps detected acceleration amplitude to a playback volume level using a logarithmic curve to match human perception. It converts sensor input (amplitude in g-force) to a decibel scale for the beep Volume effect, providing natural volume scaling where light taps are quieter and hard slaps are louder. This self-contained, dependency-free function is easily reusable in any application needing to map sensor readings to audio volume.

file: main.go ↗ | tags: #volume-scaling #audio-volume-mapping
Last analyzed: 2026-09-02 01:23:30.590891
Next check: 2026-09-09 01:23:30.587459
$ submit: