Skip to content

Time signatures beyond 4/4 (3/4, 5/4, 6/8, 7/8) #10

Description

@philoking

Summary

Support time signatures beyond 4/4. The bar length is hard-coded in two places: STEPS_PER_BAR = 16 (js/generator.js) and CLOCKS_PER_BAR = 24 * 4 (js/scheduler.js). Make the meter a per-song setting (start with 3/4, 5/4, 6/8, 7/8) so jams aren't locked to common time.

Why it fits

Already flagged in the README's "Other ideas." Odd and compound meters are a big, distinctive feel — waltzes, 5/4 vamps, 6/8 lilts — and they pair naturally with the drone/pedal and per-part-divide work for unusual modular grooves. The whole engine is bar-relative, so meter is mostly a matter of parametrising the two constants and the things that assume 16.

Proposed scope

Core constants → per-song meter

  • Replace the two hard-coded constants with stepsPerBar / clocksPerBar derived from state.meter = { num, den }.
  • js/scheduler.js: clock-per-bar maths, the bar/beat callbacks, and the beat-LED row.
  • js/generator.js: every place that assumes 16 steps — bass/arp/melody rhythm grids, the metric accent contour (downbeat emphasis must follow the new meter), and swing (the offbeat-16th delay needs a meter-aware notion of "offbeat").

Library + UI

  • Blueprints/motifs are bar-counted, so most transpose cleanly; audit any motif rhythm authored against a 16-grid (js/library.js).
  • js/timeline.js: bar widths and beat ticks read from the meter.
  • New-song modal (js/app.js): a meter picker; persist in state / presets / export.

Where

js/scheduler.js, js/generator.js (grid + accent + swing), js/timeline.js (rendering), js/library.js (motif audit), js/app.js (picker + state).

Done when

  • Meter is selectable per song and persists.
  • Clock, bar counter, beat LEDs, and timeline reflect the meter.
  • Accent contour and swing make sense in 3/4, 5/4, 6/8.
  • Existing 4/4 songs are unchanged at the default.

Open questions

  • Treat compound meters (6/8, 7/8) as grouped 8ths vs straight subdivisions for swing/accent?
  • Per-section meter changes, or one meter per song for v1 (recommend per-song first)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions