Skip to content

Refactor to dual-voice djembe drum mode with amplitude-based routing#67

Closed
od99-dev wants to merge 4 commits intotaigrr:masterfrom
od99-dev:claude/investigate-sound-features-YXBPG
Closed

Refactor to dual-voice djembe drum mode with amplitude-based routing#67
od99-dev wants to merge 4 commits intotaigrr:masterfrom
od99-dev:claude/investigate-sound-features-YXBPG

Conversation

@od99-dev
Copy link
Copy Markdown

Summary

Refactored spank from a multi-mode audio response system into a dedicated dual-voice djembe drum synthesizer. Hits are now routed to either bass or snare voices based on amplitude threshold, with independent per-voice cooldowns allowing both voices to play simultaneously.

Key Changes

  • Removed mode system: Eliminated --sexy, --halo, --lizard, and --custom flags along with their associated audio packs and playMode enum (random vs. escalation). Removed slapTracker escalation scoring logic entirely.

  • Introduced dual-voice routing: Added dualPack struct that holds bass and snare soundPacks. New selectVoice() method routes hits by comparing amplitude against --bass-threshold (default 0.25).

  • Per-voice cooldowns: Replaced single lastYell timestamp with lastBassYell and lastSnareYell, allowing bass and snare to play independently. Default cooldown reduced from 750ms to 300ms per voice.

  • New CLI flags:

    • --bass-threshold (default 0.25): amplitude threshold for routing to bass vs. snare
    • --bass-dir / --snare-dir: override embedded audio with custom directories
  • Embedded audio reorganization: Replaced painAudio, sexyAudio, haloAudio, lizardAudio with djembeBassAudio and djembeSnareAudio pointing to audio/djembe/bass/ and audio/djembe/snare/.

  • Updated stdio protocol: Added voice field to JSON events (identifies "bass" or "snare") and bassThreshold to settings updates.

  • Documentation: Added CLAUDE.md with architecture overview, command reference, and development guidance.

Implementation Details

  • Removed ~100 lines of escalation math and mode-selection logic
  • Simplified run() function: now unconditionally loads both bass and snare packs
  • listenForSlaps() now maintains separate cooldown timers per voice, enabling overlapping playback
  • soundPack.loadFiles() now filters for .mp3 extension explicitly
  • Fast mode tuning adjusted: cooldown reduced to 150ms (from 350ms) to match faster per-voice detection
  • Default cooldown reduced to 300ms (from 750ms) to account for per-voice rather than global cooldown

https://claude.ai/code/session_01DTW5RongQBNbFFq3KM9fyz

claude and others added 4 commits March 29, 2026 13:07
Adds repository guidance covering build/test commands, architecture
overview, data flow, mode selection, escalation scoring, and stdio
protocol. Defers to AGENTS.md for constants and gotchas.

https://claude.ai/code/session_019kCvM2eg87w4goqQLqNG6C
Covers single-file code organization, mutex patterns, goroutine safety,
adding new audio modes, testing strategy, amplitude scaling, and
private dependency setup.

https://claude.ai/code/session_019kCvM2eg87w4goqQLqNG6C
- Remove all old modes (pain, sexy, halo, lizard, custom/custom-files)
- Add dualPack routing: amplitude >= --bass-threshold (default 0.25) → bass,
  below → snare; each voice has its own cooldown timer so both can fire
  independently and overlap freely
- Add --bass-dir / --snare-dir flags for custom MP3 directories
- Add --bass-threshold flag, also settable live via stdin {"cmd":"set","bassThreshold":0.3}
- Default cooldown reduced to 300ms (was 750ms) to suit drum feel
- Add placeholder audio/djembe/bass/ and audio/djembe/snare/ dirs (replace
  with real djembe samples before building)
- Update stdin status/set responses to include bass_threshold field
- Update resetGlobals() in tests to initialise new globals

https://claude.ai/code/session_01DTW5RongQBNbFFq3KM9fyz
@taigrr taigrr closed this Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants