once $ "gfunk_lead"

do
setcps (120/60/4)
-- resetCycles
let width = pF "width"
let dMask = (whenmod 8 7 (mask "t t <t [f t]> f"))
d1 $ gF1 $ gM1 
  $ midiOn "^41" (<| "k k k <k [<~!3 k> k]>")
  $ midiOff "^41" (<| "k . <[~ k] k(<3 5>,8)>")
  $ "[techno:0,808bd:2,909,kick:4]"
  -- $ "kick:5" 
  # gain 1.5
  # lpf 400
d2 $ gF1 $ gM2 $ dMask                   -- E2 (^42) was dead: the clap had no gate at all
  $ midiOn "^42" ((# "vec1_claps:10") . (<| "~ cp ~ [cp ~ cp*<1 2>]"))  -- HANDCLAP ROLL
  $ midiOff "^42" (<| "~ cp ~ cp*<1!3 2>")
  $ "cp" # "h2ogmcp" # gain 1.3
d3 $ gF1 $ gM2 $ dMask 
  $ midiOn "^43" ((# "vec1_snare") -- Mechant drum-snare!!
  . (struct "~ t ~ t ~ t*<1 2 1 1> ~ t*<1!3 2>")
  )
  $ midiOff "^43"(<| "~ h ~ h ~ h*2 ~ h*<1!15 2>" )
  $ "h2ogmhh:19" 
  # hpf (slow 32 $ range 200 8000 sine)
  # gain 1.5
d4 $ gF2 $ gM3 -- La Funky Bass 
  $ midiOn "^76" (ply 2)   -- F4: a GESTURE row, per button_roles
  $ midiOn "^44" (slice 8 "<6>*<2 2 2 4 2 2 4 8 2 8 8 16 8 16 16 16>")  -- E4, was dead
  $ chop (8 * 8) -- 8 chops times 8 loops 
  $ loopAt 8 
  $ "gfunk_bass:1"
  # cut 4
  # room 0.8 # sz 0.5 # dry 1.2
  -- ORDER IS LOAD-BEARING: migrate-columns assigns an orbit's knobs in order of
  -- DECLARATION — first to row B, second to row C. PLN asked for "d4 52 a crush?
  -- 32 a octersub maybe?", i.e. octersub on B4 and crush on C4, so octersub is
  -- declared first. Swap these two lines and the tool will swap the CCs back.
  # octersubbus 42 (range 0 1.5 "^32")   -- B4, PLN's ask: "32 a octersub maybe?"
  # crushbus 41 (range 16 3.5 "^52")     -- C4, PLN's ask: "d4 52 a crush?"
  # gain 1.3
d9 $ gF3 $ gM3 
  $ midiOn "^20" (superimpose (
    (# n "2") . (# cut 91) . (# room 0) . (|* gain 0.9))
  )
  $ note ("<b b b g>@7 <cs6!3 fs6>" - 12) 
  # "moog" # cut 9
  # crushbus 91 (range 16 1.5 "^19")
  # pan 0.8 
d5 $ gF3 $ gM3 
  $ midiOn "^89" (superimpose (("s" ~>) . (|+ note 12)))
  $ note ("b4!4 . <[b4 b4 <b4 a4 g4 g4> <b4!7 fs4>] [b4 b4 d5 cs5]>")
  # "acidOto3092" 
  # width (range 0.05 0.5 "^33")
  # crushbus 51 (range 16 3.5 "^53")
  # room 0.3
d7 $ gF1 $ gM3 $ dMask -- Tracey Trancey's loop art
  $ midiOff "^59" (mask "t(4,8,1)" . chop 16) -- TECHNO MASK
  $ midiOn "^35" (# n 2) -- UPDOWN
  $ chop 8 
  $ loopAt 4 
  $ "trance_loops:0"
  # cut 7
  # gain 1.7
d8 $ gF1 $ gM2 $ dMask -- BYOB: Bring your own Breaks
  $ midiOn "^92" ( -- Bouton Nassim <3
    slice 16 "[0 .. 7]"
    . loopAt 0.5 . (# "breaks165")
    -- . (# octer 0.4) . ( octersubsub 4)
    . (# lpf 2500)
    . (# room 0)
  )
  $ midiOff "^60" (mask "t([4!3 8],8,1)" . chop 16) -- TECHNO MASK
  $ midiOn "^36" (loopAt 2 . (# n 23))
  $ midiOn "^56" (loopAt 2 . (# n 19))
  $ midiOff "^56" (slice 4 "0 <~ 1> 2*<1 2 4 <4 [8 <8 4>]>> 3*<1 2>")
  $ chop 4 
  $ loopAt 1 $ "jungle_breaks:78"
  # gain 1.4
d10 $ gF3 $ gM3 -- SynMenace  -- #33: was `gF3 $ gF3`, so NOTHING could mute d10.
  -- PLN 2026-08-02: "d10 scale up is shitty... the scale climb is irritating".
  -- It was `iter "1 4"` over a stepwise run 0 1 2 3 3 4 5 6 — a SCALE, and a
  -- scale played straight is an exercise, not a hook. Rewritten as a MOTIF:
  -- leaps and rests instead of steps, so the ear hears a phrase repeat with
  -- variation rather than a ladder.
  -- SAFE AGAINST d4/d5 by construction: degrees 0/2/3/4/6 of A mixolydian are
  -- A C# D E G — the notes of A7 plus the fourth. d5's acid line (b4 a4 g4 fs4
  -- d5 cs5) and d11's arpeggio already live there, so nothing can clash.
  $ whenmod 16 12 (fast 2 . (|+ note 12))   -- last 4 of every 16: an octave up, doubled
  $ note ((scale "mixolydian"
      "[~ 4] <6 4> [~ 0] <2 [3 2]> . [~ 4] <6 [4 6]> [~ 2] <0 ~>"
      ) + "a4")
  # s "giorgio_syn:5"
  # cut 10
  # gain 1.4
  # room 0.4 # sz 0.3 # dry 0.8
-- TODO: FIND FRIENDS 10-12
  -- was `range 16 3.5` and pinned at a5 half the time — PLN: "too high-ish on
  -- the crush". Floor raised to 6 bits (audible grit, no aliasing scream) and
  -- the constant a5 doubling is now the occasional whenmod lift above.
  # crushbus 101 (range 16 6 "^18")
d11 $ gF3 $ gM3
  $ struct "t(3,8) t(<3 5>,8)"
  $ arp (slow 4 "<up down updown converge>" )
  $ note ((scale "mixolydian" "[0,2,4] [1,3,5] [2,4,6]") + "a")
  # s "giorgio_syn:14" -- 13 
  # cut 11
  # gain 1.1
  # room 0.6 # sz 0.4

  -- 
  -- -- Pinky up arpeggio with faster movement
  -- d11 $ every 4 (fast 2) 
  --   $ arp "pinkyup thumbupdown" 
  --   $ note ((scale "mixolydian" "[0,2,4,6] [3,5,0]") + "a")
  --   # s "giorgio_syn:8" 
  --   # cut 11
  --   # lpf 1200 # gain 1.0
  -- 
  -- -- Diverging arpeggio pattern
  -- d11 $ arp "diverge disconverge" 
  --   $ note ((scale "mixolydian" "[0,2,4] [5,3,1] [6,4,2]") + "a")
  --   # s "giorgio_syn:17" 
  --   # cut 11 # octave 5
