Skip to main content

Module chord

Module chord 

Source
Expand description

Simple triad chord proposal from a single HPCP frame (major/minor/dim).

For each root (0..12) and each triad template — major {0,4,7}, minor {0,3,7}, diminished {0,3,6} — we score the fraction of HPCP energy captured by the three chord tones, and take the best. The result is a proposal.

§Abstention (hard epistemic rule)

Triad templates are 12-TET-specific, so an explicit assumes_12tet flag is required. The function returns Ok(None) (abstain) when 12-TET is not asserted, when the HPCP is not 12-bin, when the frame is flat/empty, or when the best triad captures less than min_score of the energy. It never forces a chord.

Zero-heap: fixed templates and scalar accumulation; no allocation.

Structs§

ChordEstimate
A proposed triad: root pitch class, quality, and the energy-coverage score.

Enums§

ChordQuality
Triad quality.

Functions§

estimate_chord
Propose a triad for a 12-bin HPCP frame.