Skip to content

feat/time-signature-foundation - #117

Merged
TwDover merged 1 commit into
mainfrom
feat/time-signature-foundation
Jul 28, 2026
Merged

feat/time-signature-foundation#117
TwDover merged 1 commit into
mainfrom
feat/time-signature-foundation

Conversation

@TwDover

@TwDover TwDover commented Jul 28, 2026

Copy link
Copy Markdown
Owner

Non-4/4 time signatures: Meter model + generation-core threading (milestone 1)

Foundation for 3/4, 6/8, 7/8 (and other meters). This milestone makes the
whole pipeline meter-aware while keeping 4/4 byte-identical; the per-generator
within-bar feel for non-4/4 is milestone 2 (see docs/roadmap.md).

  • core/meter.py: a Meter model centralizing the math — bar_beats (bar length
    in quarter-beats: 4/4->4.0, 3/4->3.0, 6/8->3.0, 7/8->3.5), compound/odd
    detection, and pulse positions. All positions stay in quarter-beats, so the
    one thing that varies is bar_beats and every bars * 4 becomes
    bars * bar_beats (== 4.0 for 4/4, hence unchanged).
  • schemas: time_signature ("N/D", default "4/4") on GenerateRequest,
    BuildSongRequest, and RegeneratePartRequest; bad input falls back to 4/4.
  • midi_writer: emits the correct time_signature meta for every meter
    (compound meters click on the dotted quarter); 4/4 meta unchanged.
  • Threaded the meter through the generation core: all 7 generators (which
    already used a local beats_per_bar), _plan_sections, and the section loop.

4/4 stays byte-identical — 135 backend tests green, ruff clean. Non-4/4 runs
end-to-end with correctly-sized bars and MIDI meta.

Known limitation (milestone 2): generators still place some notes at fixed
within-bar offsets that overflow shorter bars (walking-bass beat 4, the drum
16-step grid), so non-4/4 output is structurally correct but not yet
rhythmically finished. No UI selector yet, so 4/4 is the only reachable meter
from the app — this milestone is safe to ship.

@TwDover
TwDover merged commit bdf40a3 into main Jul 28, 2026
3 checks passed
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.

1 participant