A Linux program that plays sound based on intensity of the selected input device. The program monitors input events and plays corresponding sound files based on the movement's intensity level.
Original program called nubmoan from wttdotm
Linux variant from shasherazi
All credit goes to these developers, I just made it SuperMoan🤠
- Real-time input movement tracking
- Logarithmic scaling of movement intensity
- Configurable movement thresholds and scaling parameters
- Sound playback based on movement intensity (10 different levels)
- Debug mode with detailed statistics
- Device listing functionality
- Test mode without sound playback
Building requirements:
- GCC compiler
- ALSA sound system (for sound playback)
- pthread library
- math library
- Clone or download the source code
- Compile the program using:
gcc -Wall -g -lm -pthread -o supermoan supermoan.c
Basic usage:
./supermoan -i <device_path>
Option | Long Option | Description |
---|---|---|
-l | --list-devices | List all available input devices |
-i | --input | Specify input device path (required) |
-d | --debug | Enable debug output |
-m | --min-threshold N | Set minimum movement threshold (default: 1.0) |
-M | --max-threshold N | Set maximum movement threshold (default: 100.0) |
-b | --log-base N | Set logarithm base for scaling (default: 2.0) |
-n | --no-sound | Don't play sound files (for testing) |
-s | --sound-dir | Specify custom folder containing wav files |
-h | --help | Display help message |
- List available input devices:
./supermoan --list-devices
- Run with a specific input device:
./supermoan -i /dev/input/event2
- Run with debug output:
./supermoan -i /dev/input/event2 --debug
- Run with custom thresholds:
./supermoan -i /dev/input/event2 --min-threshold 2.0 --max-threshold 150.0
- Test mode (no sound):
./supermoan -i /dev/input/event2 --no-sound
- Test mode with debug (no sound):
./supermoan -i /dev/input/event2 --no-sound --debug
The program expects, by default, sound files to be present in the moans
directory, named from 1.wav to 10.wav.
Each file corresponds to a different intensity level:
- 1.wav: lowest intensity
- 10.wav: highest intensity
The program calculates movement intensity using the following approach:
- Calculates Euclidean distance of input movement (dx, dy)
- Applies configurable thresholds:
- Movements below min_threshold return intensity level 1
- Movements above max_threshold return intensity level 10
- Uses logarithmic scaling for values between thresholds
- Maps the scaled value to intensity levels 1-10
When running in debug mode (-d), the program provides:
- Distribution of intensity levels
- Total movement count
- Visual histogram of intensity distribution
- Real-time movement and scaling values
The program includes error handling for:
- Invalid device paths
- Device access permissions
- Sound file playback issues
- Invalid command line arguments
- Configuration parameter validation
The program handles SIGINT (Ctrl+C) gracefully:
- Stops input monitoring
- Terminates sound playback
- Prints debug statistics (if enabled)
- Cleans up resources
- Requires appropriate permissions to access input devices (typically root or input group membership)
- Sound files must be compatible with ALSA's aplay command