๐ SpankUrLaptop
April 9, 2026 ยท View on GitHub
๐ SpankUrLaptop
Your laptop has senses now. Slap it. It screams back.
Harder slap = louder reaction. Calibrated to you. Works on every laptop ever made.
๐ค Why This Exists
SlapMac went viral. The concept was brilliant.
But every Mac slap tool โ SlapMac, spank, SmackMac, SlapMyMac โ is locked to Apple Silicon.
They all depend on the built-in accelerometer that only exists in M-series MacBooks.
No accelerometer? No tool.
Windows users, Linux users, older Mac users โ completely locked out.
So I re-engineered the entire detection layer from scratch using a completely different approach:
microphone-based real-time signal processing.
No accelerometer required. Works on any laptop ever made.
๐ฌ The Re-Engineering: How Detection Actually Works
Mac tools take the easy path โ read a G-force spike from hardware, play a sound.
That's a clean 1-sensor problem.
Microphone detection is a fundamentally harder problem.
A mic hears everything โ your voice, keyboard, music, phone buzzing, AC units, anything.
The tool has to figure out, in real time, with zero latency, which audio event was specifically a chassis slap.
Here's the 4-layer filter stack built to solve this:
Layer 1 โ Volume Spike Gate
$ \text{RMS} > 5 \times \text{rolling} \text{baseline} $
First pass. Filters out all ambient noise. Only events that are dramatically louder than the last 2 seconds of audio pass through. Typing, voice, background music โ all rejected here.
Layer 2 โ Crest Factor Analysis
Peak / RMS > 3.0
A physical impact (slap) is an impulse โ an extremely sharp, instantaneous spike followed by silence. Voice and music are sustained signals with low crest factors. This filter mathematically distinguishes a chassis thud from anything sustained, including loud voices or bass-heavy music.
Layer 3 โ FFT Frequency Fingerprinting + Cosine Similarity
Cosine Similarity โฅ 82% against your calibrated profile
This is the core re-engineering. Every laptop chassis has a unique resonance frequency when struck โ determined by its material, thickness, size, and internal structure. During calibration, the tool computes an FFT (Fast Fourier Transform) of each of your slaps and builds an averaged frequency fingerprint unique to your machine and your hitting style. At runtime, every spike that passes Layers 1 and 2 gets its FFT computed and compared against your profile using cosine similarity. Only a match โฅ 82% triggers a reaction.
Layer 4 โ Volume Gate Against Calibrated Baseline
RMS โฅ 40% of your calibrated average spank volume
Final pass. Filters out keyboard clicks and light taps that somehow passed the earlier layers. The reaction only fires if the hit is meaningfully loud relative to how hard you actually slap.
All 4 layers in 5.8ms. BLOCK_SIZE = 256 samples at 44,100Hz.
๐๏ธ Personal Calibration System
spankurlaptop calibrate # 100 spanks โ maximum precision
spankurlaptop calibrate --count 20 # 20 spanks โ quick start
The calibration system records N slaps from your specific laptop chassis and your specific hitting style, computes the average FFT spectrum across all samples, normalizes it into a unit vector, and saves it as a .npz profile in your home directory.
The result: the tool is tuned to your hands on your machine. Nobody else's slap pattern will trigger it.
๐ก More samples = tighter profile = fewer false positives. 100 is the gold standard. 20 gets you 80% of the way there.
๐ SpankUrLaptop vs Mac Slap Tools
| SpankUrLaptop | SlapMac / spank / SmackMac | |
|---|---|---|
| Windows | โ | โ |
| Linux | โ | โ |
| Older Macs | โ | โ |
| Detection Method | FFT + Cosine Similarity | Accelerometer (hardware) |
| Personalized to your chassis | โ Calibrated profile | โ Generic threshold |
| False positive filtering | 4-layer signal stack | Basic G-force threshold |
| Calibration control | --count flag, any N | Fixed sensitivity slider |
| Open Source | โ MIT | Some paid, some open |
| Control Panel | โ Ctrl+5 UI | Varies |
| PyPI installable | โ | โ |
๐ฆ Installation Guide
Method A โ Install directly from GitHub (Fastest)
pip install git+https://github.com/NithinVarma50/spankurlaptop.git
One command. audio.zip (59 reaction sounds) bundles automatically โ no manual file copying, no GitHub account needed.
Method B โ Install locally from source
git clone https://github.com/NithinVarma50/spankurlaptop.git
cd spankurlaptop
pip install .
โ ๏ธ Python 3.8+ required. On Windows, check "Add Python to PATH" during Python installation.
Step 2 โ Audio Files (Bundled Automatically โ )
audio.zip is bundled inside the package and loads automatically after install โ no manual file copying needed.
Step 3 โ Calibrate Your Laptop (Do This Once!)
This step teaches the tool the unique thud sound of your specific laptop chassis so it ignores all other sounds (typing, voice, music).
# Default: calibrate with 100 spanks (recommended)
spankurlaptop calibrate
# Quick calibration: choose any number
spankurlaptop calibrate --count 20
spankurlaptop calibrate --count 30
Spank your laptop the chosen number of times, pausing about a second between each slap. The tool records the frequency fingerprint and volume of each slap to build a precision profile unique to your machine.
When done, it saves a .spankurlaptop_profile.npz in your user home directory.
๐ก Slap the area around the trackpad or palm rest for the most consistent results.
๐ Usage
Since it's installed globally, run these commands from anywhere in your terminal.
โถ๏ธ Start (runs silently in the background)
spankurlaptop start
Launches in the background with no terminal window. Close the terminal โ it keeps running.
โน๏ธ Stop
spankurlaptop stop
Sends a termination signal and removes the PID file cleanly.
โ ๏ธ If
stopsays "Not running" but you think it's still active, runstatusto check.
๐ Check Status
spankurlaptop status
spankurlaptop is RUNNING (PID: 18472)
or
spankurlaptop is NOT running.
๐ Re-Calibrate Anytime
If you move to a different laptop or detection feels off:
spankurlaptop calibrate
spankurlaptop calibrate --count 20
๐ Test Audio
Play a random sound instantly to verify everything is working:
spankurlaptop test-audio
๐งช Run in Foreground (for debugging)
spankurlaptop run
Visible output in terminal. Ctrl+C to quit.
๐๏ธ Uninstall
spankurlaptop uninstall
pip uninstall spankurlaptop
Stops any running process and removes all config files cleanly.
๐๏ธ Control Panel
Press Ctrl + 5 anytime after starting to open the hidden settings UI.
- Toggle the tool On / Off
- Adjust Master Volume
- Adjust Slap Sensitivity
- Test Scream button
- See whether it's using Accelerometer or Microphone mode
Close the window โ tool keeps running invisibly in the background.
๐ต Audio Reactions
59 reactions pre-loaded into RAM at startup for zero-latency playback, mapped across 5 intensity buckets:
| Bucket | Slap Intensity | Sound Range |
|---|---|---|
| 1 | Very light (< 20%) | Sounds 01โ11 |
| 2 | Light (20โ40%) | Sounds 12โ23 |
| 3 | Medium (40โ60%) | Sounds 24โ35 |
| 4 | Hard (60โ80%) | Sounds 36โ47 |
| 5 | Very hard (80โ100%) | Sounds 48โ59 |
๐ Project Structure
spankurlaptop/
โโโ spankurlaptop/ # Package source
โ โโโ __init__.py # Main logic & listener
โ โโโ __main__.py # Entry point for background process
โ โโโ audio.zip # 59 audio reaction files
โโโ setup.py # Installation script
โโโ MANIFEST.in # Ensures audio.zip is bundled
โโโ requirements.txt # Python dependencies
โโโ README.md
๐ Requirements
- Python 3.8+
- A working microphone (built-in laptop mic works perfectly)
- A laptop you're willing to slap
โ Troubleshooting
Dependencies missing! error on launch
โ Run pip install -r requirements.txt and make sure your venv is activated.
audio.zip not found warning
โ Reinstall:
pip install --force-reinstall git+https://github.com/NithinVarma50/spankurlaptop.git
Tool doesn't react to slaps
โ Run calibrate again and slap more firmly during calibration.
stop says "Not running" but it is
# Windows
taskkill /F /IM python.exe
# macOS / Linux
pkill -f "python -m spankurlaptop"
sounddevice install fails on Linux
sudo apt install libportaudio2 portaudio19-dev
pip install sounddevice
๐ License
MIT โ slap freely.