Sub-3ms audio feedback daemon for the Spaceship.
Preloads sounds into memory via rodio and listens on a Unix socket. Events trigger mapped sounds based on the active profile. Target latency: sound playback begins within one frame at 180Hz (~5.5ms).
cargo install --path .# Daemon (run via systemd)
moo daemon
# Trigger events (<1ms socket send)
moo clipboard_copy
moo switch2_in
moo claude_fire
# Direct sound playback (bypasses profile)
moo raw tick
# Status and control
moo status
moo reload
# Profile management
moo profile # Show current
moo profile sparse # Switch profile
moo profile --list # List events in current profile
moo profiles # List all profiles
# Sound utilities
moo sounds # List available sounds
moo preview tick # Preview a sound (via pw-play)┌─────────────────────────────────────────────────────────┐
│ moo daemon │
│ │
│ ┌─────────────┐ channel ┌──────────────────┐ │
│ │ Socket Loop │──────────────▶│ Audio Thread │ │
│ │ (tokio) │ │ (std::thread) │ │
│ └─────────────┘ │ │ │
│ ▲ │ - SoundBank │ │
│ │ │ - AudioEngine │ │
│ Unix Datagram │ - rodio output │ │
│ $XDG_RUNTIME_DIR/moo.sock └──────────────────┘ │
└─────────────────────────────────────────────────────────┘
▲
│ <1ms
┌────┴────┐
│ Clients │ moo <event>
└─────────┘
Audio lives on a dedicated thread because rodio's OutputStream isn't Send. Commands flow through an unbounded channel for immediate processing.
Source of truth: ~/Workspace/sfx.toml
[meta]
default_profile = "rhythmic"
sounds_dir = "/path/to/sounds"
[sounds]
tick = "tick.wav"
confirm = "confirm.wav"
pulse_whisper = { file = "pulse-whisper.wav", volume = 0.9, pitch = "0.98~1.02" }
[profiles.rhythmic]
clipboard_copy = "tick"
yank = { sound = "tick_deep", pitch = "0.9~1.1" } # per-trigger override
claude_fire = "pulse_2"Volume and pitch support constants or random ranges:
volume = 0.9 # constant
pitch = "0.98~1.02" # random within range each play- sparse: Ritual punctuation - only major actions chirp
- rhythmic: Working rhythm - navigation + lifecycle events
- immersive: Full cockpit - the spaceship hums
# ~/.config/systemd/user/moo.service
[Unit]
Description=moo - Sub-3ms audio feedback daemon
After=graphical-session.target pipewire.socket
[Service]
Type=simple
ExecStart=%h/.cargo/bin/moo daemon
Restart=always
RestartSec=1
[Install]
WantedBy=graphical-session.targetsystemctl --user enable --now moo
systemctl --user status moo
journalctl --user -t moo -fConfig reload via signal:
pkill -HUP moo
# or
moo reloadBoth sfx config and logging levels (via spaceship-std) reload on SIGHUP.
Uses spaceship-std for centralized logging. Configure in ~/Workspace/logging.toml:
[levels]
moo = "debug" # trace, debug, info, warn, errorView logs:
journalctl --user -t moo -f- rodio - Audio playback
- tokio - Async socket handling
- spaceship-std - Logging infrastructure