| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Harmonic.Framework.Builder.StrataGen
Description
Walks a (strata, tristrata) sequence and builds a
ProgressionContext with distinct triad/strata/mode layers
(runStrataGen), and regenerates a contiguous range of such a context
in place with a walk-valid e→e+1 seam (runStrataGenFrom). Pure
adjacency rules live in Harmonic.Framework.Builder.Strata; this
module is the IO runner the facade dispatches to.
Synopsis
- runStrataGen :: StrataLabel -> GenConfig -> IO (ProgressionContext, GenerationDiagnostics)
- strataStartCue :: StrataLabel -> GenConfig -> IO CadenceState
- runStrataGenFrom :: ProgressionContext -> Int -> Int -> GenConfig -> IO (ProgressionContext, GenerationDiagnostics)
- printInvalidCueError :: CadenceState -> StrataLabel -> IO ()
- viableTriadLines :: StrataLabel -> (PitchClass -> NoteName) -> [String]
- mkStarterDiag :: CadenceState -> StepDiagnostic
Documentation
runStrataGen :: StrataLabel -> GenConfig -> IO (ProgressionContext, GenerationDiagnostics) Source #
Walk the (strata, tristrata) sequence for a StrataMode run and build a
ProgressionContext with distinct triad/strata/mode layers.
The triad layer is generated by the full R→E→T pipeline: at each bar, the
active context's _hcOvertones is narrowed to the current strata's 5-PC
chroma (prime-notation), parseContextOnce is rerun, and stepChainBody
is invoked with a pcSoftBoost multiplier computed from strata /
tristrata continuity against prior bars. Graph candidates (Neo4j) and
consonance-fallback candidates both flow through the usual filter →
score → gamma-select pipeline, with the soft-boost applied to badness
at computeFallbackScoreWithBoost (fallback) and inversely to
confidence in scoreByConfidence-output (graph). Single-strata
containment is guaranteed by construction: the narrowed overtone set
precludes any triad whose chroma escapes s_i.
Strata and mode layer bars are representative 3-PC slices of 'strataChroma s_i' and 'modeChroma m_i' respectively, rooted on the generated triad's root so they transpose with the progression.
strataStartCue :: StrataLabel -> GenConfig -> IO CadenceState Source #
A starting chord drawn from inside the stratum a label resolves to under this config's tonal context.
Shared with generateBest so a K-attempt loop freezes ONE valid chord:
without it the loop's frozen cue is ignored (genP draws its own) and every
attempt starts somewhere different, which is exactly what freezing the cue
exists to prevent.
Arguments
| :: ProgressionContext | |
| -> Int | 1-indexed start of regen range (inclusive) |
| -> Int | 1-indexed end of regen range (inclusive); wraps when |
| -> GenConfig | |
| -> IO (ProgressionContext, GenerationDiagnostics) |
Regenerate a contiguous range of bars within an existing strata-aware
ProgressionContext. Mirrors runStrataGen but seeded from the
source context's provenance instead of via initialPlacement, with a
one-step lookahead on the final regenerated bar so the e → e+1 seam
preserves walk-graph validity under allowedNext.
By the Phase 1 invariant, any spliced sequence whose every edge satisfies
allowedNext automatically produces only ModeOk bars. Maintaining
adjacency at both seams (the s-1 → s seam is automatic via seeding;
the e → e+1 seam is the lookahead's job) is sufficient.
printInvalidCueError :: CadenceState -> StrataLabel -> IO () Source #
Report an invalid starting cue for genP. Prints a warning naming
the cue's escape pitches alongside a grid of viable triads in the
starting strata. Returns silently — the caller emits an empty
ProgressionContext after this.
viableTriadLines :: StrataLabel -> (PitchClass -> NoteName) -> [String] Source #
Produce one display line per root PC in the strata, listing every
distinct-by-name triad enumerated by possibleTriads starting from
that root. Uses showTriad for chord naming to match the grid
footer convention. Triads are padded to a uniform column width so
they align vertically across rows.
mkStarterDiag :: CadenceState -> StepDiagnostic Source #
Build a synthetic starter diagnostic for a genP bar 0 (the cue).
The cue isn't selected from a candidate pool, so sdSelectedFrom =
"starter" signals the renderer to omit the motion/γ cells.