Skip to main content

Command Usage

spank [flags]
Spank reads the Apple Silicon accelerometer directly via IOKit HID and plays audio responses when a slap or hit is detected.
Requires sudo for IOKit HID access to the accelerometer.

Flags

Mode Flags

These flags are mutually exclusive—you can only use one mode at a time.
--sexy
boolean
default:"false"
Enable sexy mode. Tracks slaps within a rolling window and escalates audio intensity based on frequency. The more you slap within a minute, the more intense the sounds become. Uses 60 levels of escalation.Short flag: -s
--halo
boolean
default:"false"
Enable Halo mode. Plays random audio clips from Halo soundtracks on each slap.Short flag: -H
--custom
string
default:""
Path to custom MP3 audio directory. Spank will randomly play MP3 files from this directory when slaps are detected. All files must be MP3 format.Short flag: -cExample:
sudo spank --custom /path/to/my/sounds

Detection Flags

--min-amplitude
float64
default:"0.3"
Minimum amplitude threshold for slap detection (range: 0.0-1.0). Lower values make the detector more sensitive to lighter taps; higher values require stronger impacts.The value represents the minimum acceleration amplitude in g-force required to trigger a sound.Recommended values:
  • 0.05-0.10: Very sensitive, detects light taps
  • 0.15-0.30: Balanced sensitivity (default: 0.3)
  • 0.30-0.50: Only strong impacts trigger sounds
Example:
sudo spank --min-amplitude 0.1  # More sensitive
sudo spank --sexy --min-amplitude 0.2

Standard Flags

--version
boolean
Display the version number and exit.
--help
boolean
Display help information and exit.Short flag: -h

Examples

Basic Usage

# Normal mode — says "ow!" when slapped
sudo spank

# Sexy mode — escalating responses based on slap frequency
sudo spank --sexy

# Halo mode — plays Halo death sounds when slapped
sudo spank --halo

Custom Audio

# Use your own MP3 files from a directory
sudo spank --custom /path/to/mp3s

Adjusting Sensitivity

# More sensitive (detects lighter taps)
sudo spank --min-amplitude 0.1

# Less sensitive (requires harder hits)
sudo spank --min-amplitude 0.5

# Combine with mode flags
sudo spank --sexy --min-amplitude 0.2

Exit Codes

  • 0: Successful execution (typically via Ctrl+C)
  • 1: Error occurred (missing sudo, invalid flags, sensor failure, etc.)

Behavior Details

Cooldown Period

Spank enforces a 750ms cooldown between audio responses to prevent rapid-fire playback. If multiple slaps are detected within this window, only the first triggers audio. See slapCooldown constant in main.go:69.

Mode Restrictions

The --sexy, --halo, and --custom flags cannot be combined. Attempting to use multiple mode flags will result in an error:
--sexy, --halo, and --custom are mutually exclusive; pick one

Default Mode

When no mode flag is specified, Spank runs in pain mode (default), which randomly plays from 10 embedded pain/protest audio clips.

Build docs developers (and LLMs) love