Spank-windows

command module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 4, 2026 License: MIT Imports: 20 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

spank-windows

Slap your laptop, it yells back. Windows port of taigrr/spank.

Uses the Windows Sensor API (COM ISensorManager) to detect physical hits on your laptop and plays audio responses. Single binary, no dependencies.

Requirements

  • Windows 10/11 on a laptop with a built-in accelerometer (Surface, Lenovo, HP, Dell, and others with motion sensors)
  • The Windows Sensor Service must be running (services.msc → Sensor Service → Start)

Install

Download from the latest release.

Or build from source:

go install github.com/usivagna/Spank-windows@latest

Usage

# Normal mode — says "ow!" when slapped
spank.exe

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

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

# Custom mode — plays your own MP3 files from a directory
spank.exe --custom C:\path\to\mp3s

# Adjust sensitivity (lower = more sensitive)
spank.exe --min-amplitude 0.1
spank.exe --min-amplitude 0.25
spank.exe --sexy --min-amplitude 0.2
Modes

Pain mode (default): Randomly plays from 10 pain/protest audio clips when a slap is detected.

Sexy mode (--sexy): Tracks slaps within a rolling window. The more you slap, the more intense the audio response. 60 levels of escalation.

Halo mode (--halo): Randomly plays death sound effects from the Halo video game series when a slap is detected.

Custom mode (--custom): Randomly plays MP3 files from a custom directory you specify.

Sensitivity

Control detection sensitivity with --min-amplitude (default: 0.3):

  • Lower values (e.g., 0.05–0.10): Very sensitive, detects light taps
  • Medium values (e.g., 0.15–0.30): Balanced sensitivity
  • Higher values (e.g., 0.30–0.50): Only strong impacts trigger sounds

The value represents the minimum acceleration amplitude (in g-force) required to trigger a sound.

Building from Source

Prerequisites
  • Go 1.23+
  • Python 3 (for generating placeholder audio, or supply your own MP3s)
Steps
# Clone
git clone https://github.com/usivagna/Spank-windows.git
cd Spank-windows

# Generate placeholder audio files (or copy real ones from the original repo)
python scripts\generate_audio.py

# Build
go build -o spank.exe .
Cross-compiling from Linux/macOS
./setup.sh
GOOS=windows GOARCH=amd64 go build -o spank.exe .

Running as a Service

To have spank start automatically at login, create a scheduled task:

schtasks /create /tn "Spank" /tr "C:\path\to\spank.exe" /sc onlogon /rl highest

To remove:

schtasks /delete /tn "Spank" /f

How it works

  1. Reads accelerometer data via the Windows Sensor API (ISensorManager COM interface)
  2. Runs vibration detection (STA/LTA, CUSUM, kurtosis, peak/MAD) — same algorithms as the original
  3. When a significant impact is detected, plays an embedded MP3 response
  4. 750ms cooldown between responses to prevent rapid-fire
Differences from the macOS version
macOS (original) Windows (this port)
Sensor API IOKit HID (Apple SPU) Windows Sensor API (COM)
Data transport POSIX shared memory ring buffer Direct COM polling
Privilege Requires sudo No elevation needed
Architecture Apple Silicon only x86_64 and ARM64
Accelerometer Bosch BMI286 IMU Any Windows-compatible accelerometer

Credits

This is a Windows port of spank by Tai Groot.

The vibration detection algorithms (STA/LTA, CUSUM, kurtosis, peak/MAD) are ported from taigrr/apple-silicon-accelerometer, which itself was ported from olvvier/apple-silicon-accelerometer.

License

MIT — see LICENSE for details.

Documentation

Overview

It reads the accelerometer via the Windows Sensor API — no separate sensor daemon required. Windows port of github.com/taigrr/spank.

Directories

Path Synopsis
Package detector implements vibration detection from accelerometer data.
Package detector implements vibration detection from accelerometer data.
Package sensor provides an accelerometer reader interface and a Windows implementation using the Windows Sensor API (COM).
Package sensor provides an accelerometer reader interface and a Windows implementation using the Windows Sensor API (COM).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址