theHarmonicAlgorithm-3.0.0: Real-time harmonic progression generation for TidalCycles live performance
Safe HaskellSafe-Inferred
LanguageHaskell2010

Harmonic.Rules.Types.ProgressionContext

Description

A ProgressionContext bundles three bar-aligned Progression layers — triads, pentatonic strata, and diatonic modes — together with optional per-bar provenance tracking which tristrata and strata each bar was drawn from. The legacy gen paradigm produces contexts where all three layers duplicate the same triad progression and provenance is Nothing; the new genP paradigm (introduced by the octatripentatonic framework) produces contexts with distinct strata/mode layers and Just provenance.

Synopsis

Documentation

data Layer Source #

Layer tag selecting one of the three progression layers at a call site.

  • T — Triad layer (cadential harmony, the Rules.Types.Progression result).
  • S — Strata layer (5-note pentatonic chroma, one stratum per bar).
  • M — Mode layer (7-note diatonic chroma, the pair-union mode).

M replaces the plan's D to avoid clashing with NoteName (D natural), which is re-exported via Lib for live-coding use.

Constructors

T 
S 
M 

data ProgressionContext Source #

Three bar-aligned progression layers with optional per-bar provenance.

Invariant: progLength triadLayer == progLength strataLayer == progLength modeLayer, and when pcProvenance = Just seq, Seq.length seq == progLength triadLayer.

layer :: Layer -> ProgressionContext -> Progression Source #

Project a ProgressionContext to a single Progression by layer tag.

pcLength :: ProgressionContext -> Int Source #

Bar count — equal across all three layers by invariant.

fromProgression :: Progression -> ProgressionContext Source #

Wrap a single Progression as a ProgressionContext by duplicating it into all three layers with no provenance. Used by the legacy gen paradigm and by test fixtures migrating to the widened type.

liftPC :: (Progression -> Progression) -> ProgressionContext -> ProgressionContext Source #

Apply a Progression-transforming function pointwise across all three layers. Drops provenance — specific Class 1 combinators that preserve bar alignment should permute provenance directly rather than going through liftPC.

pcSplice :: ProgressionContext -> Int -> Int -> ProgressionContext -> ProgressionContext Source #

Splice a range of bars within a ProgressionContext, replacing the triad / strata / mode layers and the pcProvenance sequence in lockstep.

Range is 1-indexed and wrap-aware (mirrors spliceProgression):

  • Non-wrapping (start <= end): replaces positions start..end.
  • Wrapping (start > end): replaces start..N and 1..end.

The triad layer's movement seam is fixed via spliceProgression; strata / mode layers don't carry meaningful Movement state (their Cadence is built with Movement = Unison — see mkChromaCS in Builder) so they use a plain sequence splice.

Provenance follows the same geometry. When either side has pcProvenance = Nothing, the result is Nothing (the splice can't reconstruct provenance from a layer-only source).

Caller is responsible for ensuring the inserted ProgressionContext has length equal to the range size.