Files
renato97 014e636889 feat: professional reggaeton production engine — 7 SDD changes, 302 tests
- section-energy: track activity matrix + volume/velocity multipliers per section
- smart-chords: ChordEngine with voice leading, inversions, 4 emotion modes
- hook-melody: melody engine with hook/stabs/smooth styles, call-and-response
- mix-calibration: Calibrator module (LUFS volumes, HPF/LPF, stereo, sends, master)
- transitions-fx: FX track with risers/impacts/sweeps at section boundaries
- sidechain: MIDI CC11 bass ducking on kick hits via DrumLoopAnalyzer
- presets-pack: role-aware plugin presets (Serum/Decapitator/Omnisphere per role)

Full SDD pipeline (propose→spec→design→tasks→apply→verify) for all 7 changes.
302/302 tests passing.
2026-05-03 23:54:29 -03:00

3.1 KiB

Proposal: Smart Chord Engine

Intent

Current chord generation (build_chords_track) produces static root-position block chords with zero voice leading — every chord jump resets all 3 voices, producing audible jumps and amateur-sounding progressions. Add a ChordEngine class with voice leading, inversion selection, emotion modes, and genre-specific reggaeton progressions.

Scope

In Scope

  • New src/composer/chords.py with ChordEngine class
  • Voice leading: minimize semitone movement, max 4 semitone jump per voice
  • Inversion selection: root, first, second inversion
  • 4 emotion modes: romantic, dark, club, classic
  • Genre-specific reggaeton chord progressions per emotion
  • Deterministic: seed-based reproducibility
  • Modify build_chords_track() in scripts/compose.py to use ChordEngine

Out of Scope

  • Seventh/suspended/diminished chord types (use existing CHORD_TYPES)
  • Real-time chord generation (only batch/offline)
  • Other genres beyond reggaeton
  • Chord rhythm/pattern generation (only chord selection + voicing)

Capabilities

New Capabilities

  • chord-engine: ChordEngine class with seed-based deterministic progression generation, voice leading, and inversion selection

Modified Capabilities

  • chords-track-generation: build_chords_track() delegates to ChordEngine instead of hardcoded i-VI-III-VII

Approach

Pure Python, zero new dependencies — all chord logic runs on MIDI note numbers using existing NOTE_NAMES, SCALE_INTERVALS, and CHORD_TYPES from composer/__init__.py.

Voice leading: score candidate voicings by total semitone distance from previous chord; select lowest-score candidate within the 4-semitone max-jump constraint.

Emotions → progression profiles:

Emotion Degrees Quality flavor
romantic i-VI-III-VII softer, wider voicings
dark i-iv-V-v minor-focused
club i-VII-VI-V driving, ascending
classic i-VI-III-VII tight block chords

Affected Areas

Area Impact Description
src/composer/chords.py New ChordEngine class
scripts/compose.py Modify build_chords_track() uses ChordEngine
tests/test_chords.py New Unit tests for voice leading, emotion modes, inversions

Risks

Risk Likelihood Mitigation
Voice leading sounds worse than static Low 4-semitone cap prevents unnatural jumps; inversions smooth transitions
Emotion modes too similar Med Each has distinct degree set and quality bias

Rollback Plan

Revert build_chords_track() to hardcoded progression. Delete src/composer/chords.py. One commit.

Dependencies

None. Uses existing composer/__init__.py constants only.

Success Criteria

  • ChordEngine(seed=42).progression(8) returns identical output on repeated calls
  • No voice leap exceeds 4 semitones
  • All 4 emotion modes produce distinct chord sequences
  • build_chords_track() produces MIDI notes with <4 semitone jumps between consecutive chords
  • Existing tests pass unchanged