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

Harmonic.Interface.Tidal.Groove

Description

Provides subKick (sub-bass and kick, held by note duration) and fund (fundamental bass note extraction) for rhythm-section integration with harmonically-generated progressions.

subKick tracks the harmony: it reads the fundamental of whichever bar the form is currently on, so the sub follows a modulation without being rewritten. In a launcher it is an ordinary block:

subk f k d = p "subk" $ f
  $ subKick d k fund (1/2, "1 ~ ~ ~", "~", "~ ~ 1 ~")

(dynamics, context, voice strategy, then (maxDur, sub-on, manual-off, kick) pattern strings). Dynamics discipline: the launcher d is the only dynamic applied — subKick deliberately ignores the form's kDynamic envelope, so the sub holds its level while the orchestra swells and ducks around it.

Each sub note rings from its onset to the next kill boundary by its own note length (holdToNext + legato 1) — see subKick for why the hold is by duration and not by a CC64 pedal.

Synopsis

Documentation

fund :: Progression -> [[Int]] Source #

Extract harmonic roots regardless of inversion — the harmonic FUNDAMENTAL uniformly, where root is uniformly the sounding bass. Triads go through inversion detection (a first-inversion bar reports its harmonic root, not its bass). Bars of more than three tones ask the jazz namer for the rotation: a slash structure (Bb7 over Ab) reports its true root (Bb), matching the chart-convention grid name; a root-position extended chord — and any set the namer cannot read — keeps its stored anchor. The walking bass is unaffected either way: it anchors on the stored root internally and reads a voice function only for beat-1 pitch choice.

subKick :: Pattern Double -> IK -> (Progression -> [[Int]]) -> (Time, String, String, String) -> Pattern ValueMap Source #

Groove interface: kick and sub bass locked to the harmony, with chord selection and kinetics gating from IK.

Sub on/off patterns and the kick pattern are bar-relative: "[1]/2" = one onset every 2 bars, "1*4" = 4 kicks per bar.

Each sub note is held by its own duration: from its onset to the next kill boundary — the manual offs (subOffPat) and, for maxDur < 1, each onset shifted by maxDur*4 — emitted with legato 1 so the note-off lands on the boundary. The hold is by note length, not by a CC64 pedal: the MPC sub program does not treat CC64 as a damper (a MIDI note-off arriving under a held pedal is stranded), so no CC64 is emitted here at all.

Chord selection uses innerJoin — we WANT new note-ons when the chord changes. Sub is gated at (0.1, 1) and kick at (0.2, 1) via ki. The launcher dynamic is the only dynamic applied — subKick deliberately ignores the form's kDynamic envelope, so the sub holds its level while the orchestra swells and ducks around it.

holdToNext :: Time -> Pattern Bool -> Pattern a -> Pattern a Source #

Hold each onset of pat until the next onset in bounds, rewriting the event whole to [onset, nextBoundary) (continuation fragments across cycles are preserved). A boundary is where the note must stop, so the note stops exactly there. Pair with # legato 1 so the emitted MIDI note-off lands on the boundary. Values are sampled once at the onset and held for the whole note (no mid-note re-sampling). look is the lookahead/lookback in cycles; note lengths must not exceed it.

noteoff :: Time -> Pattern Bool -> Pattern Bool Source #

Truncate each gate onset's note length to at most 1/n of a bar (bar = 4 cycles), else extend it to the next onset. Only True onsets sound; a truncated tail is a rest; onsets are not moved. Pair with # legato 1 on sustaining instruments to hear the length. Precondition: n > 0.

Bar patterns are written "/4" (1 cycle = 1 beat, 1 bar = 4 cycles), so e.g. noteoff 4 caps each hit at a quarter note (1 cycle):

noteoff 4 "[[1 0 0 0] [0 0 0 0] [1 0 0 0] [1 0 0 0]]\/4"  ==  "[1 0 1 1]\/4"

Clave and cascara grids

son32 :: Pattern Bool Source #

Explicit 16-step (2-bar) boolean grids, one stroke per position, for clave and cascara feels. Use with struct or mask on any instrument or drum part.

32 is the 3-2 orientation; 23 is the 2-3 rotation (2 <~ over the /4 two-bar span swaps the halves). Onset positions are 1-indexed.

son23 :: Pattern Bool Source #

Explicit 16-step (2-bar) boolean grids, one stroke per position, for clave and cascara feels. Use with struct or mask on any instrument or drum part.

32 is the 3-2 orientation; 23 is the 2-3 rotation (2 <~ over the /4 two-bar span swaps the halves). Onset positions are 1-indexed.

rumba32 :: Pattern Bool Source #

Explicit 16-step (2-bar) boolean grids, one stroke per position, for clave and cascara feels. Use with struct or mask on any instrument or drum part.

32 is the 3-2 orientation; 23 is the 2-3 rotation (2 <~ over the /4 two-bar span swaps the halves). Onset positions are 1-indexed.

rumba23 :: Pattern Bool Source #

Explicit 16-step (2-bar) boolean grids, one stroke per position, for clave and cascara feels. Use with struct or mask on any instrument or drum part.

32 is the 3-2 orientation; 23 is the 2-3 rotation (2 <~ over the /4 two-bar span swaps the halves). Onset positions are 1-indexed.

bossa32 :: Pattern Bool Source #

Explicit 16-step (2-bar) boolean grids, one stroke per position, for clave and cascara feels. Use with struct or mask on any instrument or drum part.

32 is the 3-2 orientation; 23 is the 2-3 rotation (2 <~ over the /4 two-bar span swaps the halves). Onset positions are 1-indexed.

bossa23 :: Pattern Bool Source #

Explicit 16-step (2-bar) boolean grids, one stroke per position, for clave and cascara feels. Use with struct or mask on any instrument or drum part.

32 is the 3-2 orientation; 23 is the 2-3 rotation (2 <~ over the /4 two-bar span swaps the halves). Onset positions are 1-indexed.

bellpat32 :: Pattern Bool Source #

Explicit 16-step (2-bar) boolean grids, one stroke per position, for clave and cascara feels. Use with struct or mask on any instrument or drum part.

32 is the 3-2 orientation; 23 is the 2-3 rotation (2 <~ over the /4 two-bar span swaps the halves). Onset positions are 1-indexed.

bellpat23 :: Pattern Bool Source #

Explicit 16-step (2-bar) boolean grids, one stroke per position, for clave and cascara feels. Use with struct or mask on any instrument or drum part.

32 is the 3-2 orientation; 23 is the 2-3 rotation (2 <~ over the /4 two-bar span swaps the halves). Onset positions are 1-indexed.