--custom flag. This allows you to personalize your laptop’s responses with any sounds you want.
Usage
How It Works
When you specify a custom directory:- Spank scans the directory for all files (non-directories)
- Files are sorted alphabetically and loaded into memory
- When a slap is detected, a random MP3 file is selected and played
- Custom mode uses random playback (not escalation mode)
main.go:91-119:
File Requirements
Use MP3 format
All audio files must be in MP3 format. Spank uses the
beep library’s mp3.Decode() function to decode audio files.Other formats (WAV, FLAC, OGG, etc.) are not supported and will cause decode errors.Directory Structure
Your custom audio directory should look like this:- Files are read from the top level of the directory only (subdirectories are ignored)
- File names don’t matter; they’re just sorted alphabetically internally
- You need at least one MP3 file in the directory, or you’ll get an error: “no audio files found”
Examples
Basic Custom Audio
Custom Audio with Sensitivity Adjustment
Creating Your Own Sound Pack
Playback Behavior
Custom mode uses random playback:- Each slap randomly selects one of your MP3 files
- All files have equal probability of being played
- No escalation (unlike
--sexymode)
main.go:161-164:
Technical Details
Audio Decoding
Spank uses the beep library for audio playback. Custom files are decoded using:Embedded vs. Custom Audio
The built-in modes (pain, sexy, halo) usego:embed to bundle MP3s directly into the binary:
os.Open(), so your files stay on disk and aren’t compiled into the binary.
Troubleshooting
Error: no audio files found
Error: no audio files found
This means the directory is empty or contains only subdirectories.Solution: Ensure you have at least one
.mp3 file in the top level of the directory.Error: decode failed
Error: decode failed
The file may be corrupted or not a valid MP3.Solution: Re-encode your audio files to MP3:
No sound plays
No sound plays
The audio may be decoding but speaker initialization failed.Solution: Check that:
- Your system audio is not muted
- The MP3 files are valid
- You have proper permissions to access audio devices
Next Steps
Troubleshooting
Common issues and solutions
Sensitivity Tuning
Adjust detection sensitivity