| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Harmonic.Framework.Builder.Diagnostics
Description
Functions for printing generation diagnostics at various verbosity levels, computing chord traces during generation, and rendering chord names.
Synopsis
- printDiagnostics :: Int -> GenerationDiagnostics -> IO ()
- printHeader :: Text -> Double -> HarmonicContext -> IO ()
- printStrataDiagnostics :: (Int -> String) -> Int -> GenerationDiagnostics -> IO ()
- printPolyDiagnostics :: (Int -> String) -> Int -> GenerationDiagnostics -> IO ()
- computeChordTrace :: Int -> CadenceState -> (Maybe String, Maybe TransformTrace)
- showChord :: Chord -> String
- parseCadenceFromString :: String -> Int -> Maybe String
- printAttemptScoreboard :: Double -> [AttemptDiagnostic] -> IO ()
Diagnostic Printing
printDiagnostics :: Int -> GenerationDiagnostics -> IO () Source #
Print diagnostics collected during generation.
Selects output level based on verbosity parameter:
- 0 - Silent
- No output
- 1 - Standard
- Per-step candidate pools, selections, rendered chords
- 2 - Verbose
- Standard plus transform and advance traces
Useful for manually reprinting diagnostics after extraction from tuple, or batch processing multiple results at different verbosity levels.
printHeader :: Text -> Double -> HarmonicContext -> IO () Source #
Print generation header based on composer selection Takes raw Text instead of parsed ComposerWeights, plus entropy
printStrataDiagnostics :: (Int -> String) -> Int -> GenerationDiagnostics -> IO () Source #
Per-bar rendering for genP'genP'''genP'''. Shows the triad
(3 notes), the strata chroma (5 notes), the mode chroma (7 notes), the
active tristrata, and — at verbosity 2 — the soft-boost applied.
Noop when sdStrataLabel is Nothing for every step, so it's safe to
call unconditionally on any diagnostics value.
The first argument maps a trace position (1 = starter/seed row) to its
displayed bar number — show for fresh walks; regen callers map
positions onto source bar numbers (see emitFinalised).
printPolyDiagnostics :: (Int -> String) -> Int -> GenerationDiagnostics -> IO () Source #
Per-bar trace for the polytonal genE family. Verbosity 1 prints the
musical table (partner chords, pair structures, pentad, pivot tones);
verbosity 2 adds the selection facts (geometry, pool tier and size,
own-list ranks). Noop when no step carries sdPoly, so it's safe to
call unconditionally on any diagnostics value.
Chord Tracing
computeChordTrace :: Int -> CadenceState -> (Maybe String, Maybe TransformTrace) Source #
Compute chord rendering and transform trace based on verbosity level. Note: Reads raw DB data from the cadence within the state (which is the selected cadence after advance).
Candidate Rendering
parseCadenceFromString :: String -> Int -> Maybe String Source #
Parse candidate name like "( pedal -> min )" and render with posterior root Returns "C min" for "( pedal -> min )" when posterior root is C
Multi-attempt scoreboard (Verbose only)
printAttemptScoreboard :: Double -> [AttemptDiagnostic] -> IO () Source #
Render the multi-attempt rank-and-select scoreboard. Called from
generateBest when _gcVerbosity == Verbose
and _gcMaxAttempts > 1. Silent and Standard verbosity print nothing
(the caller suppresses the call).
Rows sorted by adTotal descending; the picked attempt is marked
with ← PICK. The chord-name sequence is truncated to the first 8
chords with an ellipsis if longer.