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

Harmonic.Interface.Tidal.Score

Description

The literal, linear way of writing for the orchestra: a piece is a list of blocks addressed by bar number, each a stack of lines that read scale degrees against a layer of the progression the form carries (T the chord, S its pentatonic, M its mode), played by a primed instrument that takes its dynamic as a mark. It is the counterpart of the kinetics workflow and shares its slot: the progression in k is a one-bar key from inKey, a generated or recalled context, or anything else that feeds iK.

key  = inKey D "major"                      -- one bar: D F# A | D E F# A B | D major
form = [rh 1 1 0.4 key, rh 9 1 0.8 key]     -- the dynamic arc, in score bars

tune k = stack [silence
  ,flute'   M "[1,2]" "p"  k "[5 [2 4 . 5] [4 3 2 4 . 5] [4 5] ~!3]/28"
  ,violin1' M 1       "mp" k "[12 [9 11 . 12] …]/28"
  ]

andante f k d = p "score" $ f $ score pre [bars 3 9 $ tune k, …] |* vel d

do let k = preroll pre $ iK tempo form (rep key 1)
   mapM_ id [hush, setbpm tempo, resetCycles, display k, andante id k $ (*1) 0.8]

Time is the session's: one cycle is one beat, four cycles a bar, bar 1 the first bar of the piece. A block runs on its own clock (seqP starts each pattern from its cycle 0 at the block's first beat), so an ostinato written "[a b c]/12" starts on a wherever the block is placed and a "x x" alternation counts its passes from the entry.

Synopsis

Blocks

bars :: Time -> Time -> Pattern a -> (Time, Time, Pattern a) Source #

A block of a score: bars b1 to b2 inclusive, 1-indexed, four cycles per bar, as a seqP triple. seqP starts each block's pattern from its own cycle 0, so the same mininotation reads the same at bar 1 and at bar 17.

score :: Int -> [(Time, Time, Pattern a)] -> Pattern a Source #

Sequence a list of blocks with pre bars of pre-roll, so the count-in, the clock start and any controller resets land before bar 1 begins at cycle pre * 4. Pair it with preroll on the form, so the two clocks agree.

Pitch

inKey :: NoteName -> String -> ProgressionContext Source #

A one-bar progression context for a key: the tonic triad on T (the mode's degrees 1 3 5, so a minor key gives a minor triad and Lydian a major one), the key's pentatonic on S (its parent major key's, rooted on the tonic where the tonic belongs to it — A minor gives A C D E G — and the mode's degrees 1 2 3 5 6 for the melodic and harmonic families) and the mode itself on M. It feeds iK like any generated or recalled context, and round-trips through save.

Names, case-insensitive: major / ionian, minor / aeolian, dorian, phrygian, lydian, mixolydian, locrian, melodic minor, harmonic minor, harmonic major, any ModeQuality constructor (LydDom, AltDom …), and chromatic (all twelve on every layer, so a degree is a semitone). An unknown name is an error at declaration: a typo must not become a silent scale.

degrees :: Layer -> Pattern Int -> IK -> Pattern Int -> Pattern Note Source #

Scale degrees against a layer of the progression in k, at an octave. Each degree reads the chord selected at its onset (the same rule as arrange); degree 0 is that bar's root at the lattice's bass register (the root in [-12,-1]) and n indexes the bar's closed position above it, wrapping by octave — on a one-bar D major context the M layer gives 0 → D3, 7 → D4, −7 → D2. The octave pattern shifts the result by twelves and may carry a chord ("[1,2]" sounds both octaves, "[[1] [~]]/16" drops the notes under its rest).

Dynamics

dyn :: Pattern String -> Pattern Double Source #

Dynamic marks as amplitude, dynTable looked up per event. A mark the table does not know yields no event, so under # the note it would have carried is dropped: a misspelt mark is heard as a missing note.

dynTable :: [(String, Double)] Source #

The amplitude of each dynamic mark, ffff down to pppp.

ramp :: Pattern Double -> Pattern Double -> Pattern Double Source #

A straight line from lo to hi across one cycle in 64 steps; slow n stretches it over n cycles. Multiply a line by it (|* vel (slow 8 $ ramp 0.9 1.3)) for a crescendo over two bars; the form's dynamic nodes do the same for the whole arc.