| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Harmonic.Interface.Tidal.Bridge
Description
Bridge between the harmonic generation engine and TidalCycles live coding.
Chord selection via mininotation patterns (Pattern Int).
Two arrangement strategies:
arrange— onset-join with kinetics range gating: each note maps through the chord active at its onset time, masked by kinetics signal.arrange'— squeeze with kinetics range gating: each chord slot gets the full input pattern compressed to fit.
Both take a progression modifier (P.Progression -> P.Progression)
and read the base progression from kProg k via innerJoin.
Synopsis
- type VoiceFunction = Progression -> [[Int]]
- voiceRange :: (Int, Int) -> Pattern Int -> Pattern Int
- layerForVoicing :: Layer -> ProgressionContext -> (Bool, Progression)
- warp :: String -> Pattern Int
- rep :: ProgressionContext -> Pattern Time -> Pattern Int
- arrange :: (Double, Double) -> IK -> (Int, Int) -> Layer -> VoiceFunction -> (Progression -> Progression) -> [Pattern Int] -> Pattern ValueMap
- arrange' :: (Double, Double) -> IK -> (Int, Int) -> Layer -> VoiceFunction -> (Progression -> Progression) -> [Pattern Int] -> Pattern ValueMap
- parallel :: Pattern Note -> ControlPattern -> ControlPattern
- lookupChordAt :: Time -> Pattern Int -> Int
- lookupChord :: ProgressionContext -> Int -> Chord
- lookupProgression :: ProgressionContext -> Pattern Int -> Pattern [Int]
- overlapF :: Int -> Progression -> Progression
- overlapB :: Int -> Progression -> Progression
- overlap :: Int -> Progression -> Progression
- forceAll :: [[Note]] -> ()
Voice Functions
type VoiceFunction = Progression -> [[Int]] Source #
Voice function type: extracts integer pitch sequences from progression
voiceRange :: (Int, Int) -> Pattern Int -> Pattern Int Source #
Filter pattern events by MIDI note range
layerForVoicing :: Layer -> ProgressionContext -> (Bool, Progression) Source #
Map notes through chords using onset-time lookup, with kinetics range gating.
The base progression and chord selection are read from IK.
The modifier function transforms the progression (e.g. overlapF 0, id).
Events are masked by the kinetics signal: only active when kSignal is
within the (lo, hi) range. Form-driven dynamics (kDynamic) are applied
automatically.
Parameter order: context first (kinetics range, IK, MIDI range), then
interactive (voice function, modifier, patterns).
|Project the requested layer from a context together with its voicing
route. Strict-context routing: the S/M layers of a genP-provenance
context are THE curated 5/7-PC chroma (uniform per layer) and are
always voiced by strataModeFlow — degree/"key-signature" semantics:
pattern index i plays the i-th scale degree of that bar's set. The T
layer always honours the user's VoiceFunction, as do S/M layers of
gen/gen4 contexts (ordinary-harmony duplicates of the triad layer).
Routing by provenance + layer replaces the old first-bar cardinality
sniff (isOctaSM), which mis-routed mixed-cardinality material in both
directions (triad-first-bar chroma escaped to the DP; 4-note-first-bar
harmony was captured by the chroma engine).
Chord Selection Helpers
warp :: String -> Pattern Int Source #
Parse a mininotation chord selection pattern (bar-relative).
The /N divisor specifies the number of bars the pattern spans.
let r = warp "[1 2 3 4]/4" -- 4 chords over 4 bars (1 per bar) let r = warp "[1 2]/8" -- 2 chords over 8 bars (4 bars each)
rep :: ProgressionContext -> Pattern Time -> Pattern Int Source #
Generate a sequential chord selection pattern from a progression. Auto-derives length from the progression. Timing is bar-relative.
let r = rep s4 1 -- 4 chords over 4 bars (1 bar each) let r = rep s4 0.5 -- 4 chords over 2 bars (half bar each)
Arrangement
Arguments
| :: (Double, Double) | Kinetics range |
| -> IK | Performance context (kinetics + chord selection) |
| -> (Int, Int) | Degree-index trim for the input patterns (scale degrees, not MIDI; instrument-range clipping happens later via clip) |
| -> Layer | Progression layer to voice (T | S | M) |
| -> VoiceFunction | Voice function (flow, root, etc.) |
| -> (Progression -> Progression) | Progression modifier (overlapF 0, id, etc.) |
| -> [Pattern Int] | Input patterns to harmonize |
| -> Pattern ValueMap |
Render scale-degree patterns into a playable ControlPattern, reading
pitches from the progression under the given voicing strategy.
The workhorse of the Tidal interface: every orchestral instrument in Harmonic.Interface.Tidal.Orchestra is a thin wrapper around it.
d1 $ arrange (0,1) k (-9,9) T flow id ["0 1 2 3"]
Arguments
| :: (Double, Double) | Kinetics range |
| -> IK | Performance context |
| -> (Int, Int) | Degree-index trim for the input patterns (scale degrees, not MIDI; instrument-range clipping happens later via clip) |
| -> Layer | Progression layer (T | S | M) |
| -> VoiceFunction | Voice function |
| -> (Progression -> Progression) | Progression modifier |
| -> [Pattern Int] | Input patterns to harmonize |
| -> Pattern ValueMap |
Map notes through chords using squeeze, with kinetics range gating.
Same kinetics/modifier pattern as arrange, but uses squeeze strategy:
each chord slot gets the full input pattern compressed to fit.
Parallelism Harmoniser
parallel :: Pattern Note -> ControlPattern -> ControlPattern Source #
Stack fixed-interval parallel voices over an arranged ControlPattern.
The offset pattern is the FULL voice spec in absolute semitones: each note
of pat is replaced by one copy per simultaneous offset, shifted by that
offset. Include 0 to retain the original note; omit it to drop the root.
Comma = simultaneous voices, space = time-sequenced offsets (standard
mininotation, natively evaluated). Applied post-voicing/post-range-filter,
so offsets are not gated by the arrange MIDI range.
parallel "0 7" $ arrange ... -- root + perfect fifth above parallel "7" $ arrange ... -- fifth only (root dropped) parallel "[0,-5,4]" $ arrange ... -- root, fourth below, major third above
Chord Lookup
lookupChordAt :: Time -> Pattern Int -> Int Source #
Point-query a chord selection pattern at a specific time.
Returns the chord index (0-indexed) active at time t.
Falls back to chord 0 if no events found.
lookupChord :: ProgressionContext -> Int -> Chord Source #
Lookup a chord from a progression context by index with modulo wrap. Operates on the triad layer (the harmonic content).
lookupProgression :: ProgressionContext -> Pattern Int -> Pattern [Int] Source #
Lookup progression (triad layer) as a pattern of voicings via flow.
Progression Overlap (Re-exports from Arranger)
overlapF :: Int -> Progression -> Progression Source #
Forward overlap: merge pitches from n bars ahead
overlapB :: Int -> Progression -> Progression Source #
Backward overlap: merge pitches from n bars behind
overlap :: Int -> Progression -> Progression Source #
Bidirectional overlap: merge pitches from n bars in both directions