theHarmonicAlgorithm-3.2.0: Real-time harmonic progression generation for TidalCycles live performance
Safe HaskellNone
LanguageGHC2021

Harmonic.Interface.Tidal.Recall

Description

A generated ProgressionContext lives only as long as the GHCi session that bound it. save prints it as a chart — one bar per line, the three layers side by side — shaped as a complete name = recall … statement. Paste that into the live file and evaluating it binds the identical context in any later session. The format is lossless for every family: each state carries its notes (root first, in the stored spelling), its stored chord name (the graph key), its approach movement and, where the notes alone cannot pin it, its enharmonic spelling; strata contexts carry per-bar provenance as a fourth column.

recall is pure, so the pasted binding can be re-evaluated at will, and lenient enough to hand-write: "C E G (pedal)" names itself through the corpus namer, and a bar with no movement reads as a pedal.

Synopsis

Documentation

save :: String -> ProgressionContext -> IO () Source #

Print a context as a complete, paste-ready name = recall … statement:

save "verse" s
-- saved 2026-10-17 · 4 bars · triad
verse = recall "triad"
  [ "D F A min (pedal)  | … | …"
  , …
  ]

Copy the block into the live file; evaluating it next session binds verse equal to s (every layer, name, movement, spelling and strata provenance). The text is parsed back and compared before printing, so a block that would not round-trip is reported instead of emitted.

recall :: String -> [String] -> ProgressionContext Source #

Bind a saved chart back to a context. The first argument is the family keyword save printed; each string is one bar, T | S | M states separated by bars, with an optional fourth tristrata strata column. Malformed text raises an error naming the bar and column.

verse = recall "triad"
  [ "D F A min (pedal)  | D F G A C minadd11 (pedal) | …"
  , "A C E min (desc 5) | …"
  ]

recallE :: String -> [String] -> Either String ProgressionContext Source #

Rebuild a context from its family keyword and chart lines; the total form of recall for callers that want the error rather than a crash.

renderChart :: ProgressionContext -> [String] Source #

One line per bar: T | S | M, plus | tristrata strata when the context carries provenance. Columns are padded so the separators line up.

renderState :: CadenceState -> String Source #

Render one state. Notes come root first; the remaining intervals are spelled with the stored enharmonic function. The spelling word is appended only when parsing the bare text would recover a different spelling (an all-natural chord whose stored spelling is the non-default one), so the common case stays a plain lead sheet.

parseState :: String -> Either String CadenceState Source #

Parse one state. Grammar: one or more note names (first = root), then in any order an optional chord name (- for an empty name; absent → the corpus namer), an optional (movement) in show form or the integer form of lead' (absent → pedal), and an optional flat / sharp.

familyWord :: Family -> String Source #

The family keyword save prints and recall expects.