Expand description
The bar-scale grid Layer 2 folds over (ADR-0109, Plan 0095 Phase 3).
beat_index counts onset events, not
musical beats — 1.73x / 1.35-2.10x / 1.76x of them per beat on three genres,
against a synthesized control that reads exactly 1.00. Folding an accent
history over beat_index % 4 therefore spans well under a bar at a ratio
that is not even a stable integer within one track, so a bar-locked accent
precesses across all four alignments instead of accumulating in one. This
module is the unit that repairs it: a beat clock driven by the tempo
estimate rather than by the transient stream.
Two things it deliberately is not:
- Not a second
beat_index. Nothing outside the analysis path reads it.beat,beat_indexandtime_since_beatkeep their present behaviour bit for bit, so no preset’s flash timing moves (ADR-0109’s Alternatives A and B record why that was chosen over repairing them in place). - Not a downbeat estimate. It says where the beat grid is, not which of
its beats is beat 1. Which one that is stays
downbeat’s job, and its four-alignment fold is what absorbs this grid’s arbitrary bar offset.
The phase is locked, not free-running, which is the design question the
plan flagged as most likely to need a second attempt. A free accumulator
walks off the music at any tempo error, and — worse than drifting — it can
settle with its beat boundary sitting on the music’s transients, which
splits every accent across two adjacent cells and smears the fold it exists
to sharpen. The lock is a phase-locked loop over the onset envelope, not
the beat flag: two exponentially-decayed quadrature accumulators give the
energy-weighted mean phase of the recent envelope relative to the grid, and
the grid is nudged toward it by a small per-hop gain. It corrects toward the
onset stream’s aggregate phase over a window rather than snapping to each
event, which is what keeps the over-firing detector from yanking the grid
the way it yanks tempo’s bar phase.
Pure and allocation-free after construction: state is five scalars, the only
clock is the hop counter, and the same (bpm, onset) sequence always yields
the same positions (NFR section 6).
Structs§
- BarGrid
- A beat clock driven by the tempo estimate, phase-locked to the onset envelope.
- Grid
Position - Where the grid stands this hop.