-- TODO(pan): this track is very nearly MONO. Measured on the OPAL-26 master
-- (2026-08-08, 1:01:22-1:04:33): stereo width 0.05 (side/mid RMS) against a
-- set median of ~0.20 — the narrowest thing in the whole 1h20. It is also the
-- most bass-dominant (78% of power in 60-250 Hz, only 10% sub).
-- It landed hard on the floor anyway, so this is polish, not repair: spread the
-- non-bass voices (keep <120 Hz mono for the club subs, per MASTERING.md).
resetCycles

do
let width = pF "width"
let fundamental = slow 4 $ "<gb3'maj db3'maj bb2'min bb2'maj>"
setcps (160/60/4)
d1 $ gF1 $ gM1
  -- $ midiOff "^42"  (<| "<k [~!7 k*<1 2>]>")
  $ fix (# bandf 300) "clubkick"
  $ midiOff "^41" (<| "k . ~ k*<1 2> ~ <~ k k <~ k*4>>")
  $ midiOn "^41" (<| "k  k . k <k [~ k] k k*2>")
  $ "[jazz,clubkick]"
  # cut 1
  # gain 1.5
d2 $ gF1 $ gM2
  $ midiOn "^42" (<| "~ s ~ [s*<1 2> <~!7 [~ s]>]")
  $ midiOff "^42" (<| "~ s")
  $ "snare:45"
  # "jazz:4" # gain 1.3
d3 $ gF1 $ gM2 
  $ midiOff "^43"  (
    (<| "h(3,8)") . (# "jbk_kick:43")
    . (# room 0.2) . (# sz 0.4)
    )
  $ midiOn "^43" (<| "~ h ~ h ~ h*<1!3 2> ~ h*<1 [1|2]>")
  $ "h2ogmhh" # n "<0!4 1!3 2>"
  # gain (0.9 * (range 0.9 1.2 perlin))
d4 $ gF2 $ gM3
  $ midiOn "^76" (ply 4)
  $ slow 2 $ note ("<[e3@7 f3]!4 [b2@7 c2]!4>") 
  # "moog:2" 
  # cut 4
  # crushbus 41 (range 16 2.5 "^32")
  # octerbus 42 (range 0 2.5 "^52")
  # gain 1.1
d5 $ gF2 $ gM3  
  $ ((3/8) ~>)-- 
  $ midiOn "^57" ((# n ("<0>" + "<0 0 0 [0 0 1 0] 3 5 4 5>"))
  . (ply 4) . (slice 4 2))
  $ midiOn "^89" (
    slice 4 "0 1 2 3"
    . (>| n "<2 2 2 2 4 4 4 4>")
    )
  $ midiOff "^89" (slow 2)
  $ whenmod 16 12 (# n 8)
  $ "oil" 
  # n (
    slow 2 $ ply 2 $ "<0 1 2 3 4 5 6 7>/2"
  )
  # room 0.4 # sz 0.6 #dry 1.3
  # cut 5
  # gain 1.4
  # squizbus 51 (range 0 2.5 "^33")
d7 $ gF3 $ gM3 -- "FIXME ACID WEIRD NOT GOOD" — found it, 2026-08-02. THREE collisions
               -- with d4's moog bass, all invisible in the code and all audible:
               --   cut 4      -> every acid note truncated the bass and vice versa
               --   crushbus 41 -> ONE crush instance, ^35 and ^32 fighting over it
               --   octerbus 42 -> ONE octer instance, ^55 and ^52 fighting over it
               -- Found by the new PV011(error)/PV014(warning) pair PLN asked for
               -- after hearing the same shape in take_5_drops' d7. Now d7 owns
               -- cut 7 and slots 71/72. TODO @PLN verify — the acid should stop
               -- stuttering against the bass.
  $ midiOn "^91" (ply 4)
  $ fast 2
  $ note (
    "<e3!4 b2!4>"
    +  (arp "up" "c'majPent'4")
    )
  # "acidOto3091"
  # cut 7
  # crushbus 71 (range 16 2.5 "^35")
  # octerbus 72 (range 0 2.5 "^55")
  # gain 1.5
  -- FIXME(#54) d7 3rd+ effect: the grid gives d7 B7 + C7. Fold ^19 in via gSel rather than borrowing a column.
  -- FIXME(#54) d7 drives more controls than the grid gives it (B7 + C7). ^19 now belongs to another orbit, so the line(s) below are COMMENTED OUT rather than left firing across columns. Nothing is lost — restore by removing the dashes once gSel folds this onto d7's own control.
  -- # width (range 0 5 "^19")
d8 $ gF1 $ gM2
  $ midiOn ("^60" - "^92") (mask "f(4,8)")
  $ midiOn ("^36" - "^92") ((loopAt 2) . (# hpf 1500) . (# "jungle_breaks:45")) -- ORL RPZ
  $ midiOn ("^56" - "^92") ((loopAt 2) . (|* gain 1.1) . (# "jungle_breaks:30")) -- Clochettes?
  $ midiOn ("^92") ( -- Bouton Nassim <3
    slice 16 "[0 .. 7] . <[0 .. 7]!7 [0 1 . [2 3]]>"
    . loopAt 1 . (# "breaks165") . (# octersub 2)
    . (|* gain 0.9)
  )
  $ chop 16
  $ loopAt 1
  -- $ loopAt 2
  $ "jungle_breaks:28" -- BREAKS LOVER <3
  # room 0
  # gain 1
d10 $ gF1 $ gM3 $ mask "<t f!7>" $ "risers:8" -- safe riser (#33)

--   $ chop 8 
--   $ loopAt 4 
--   $ midiOn "^57" ( -- HIGHER
--     slow 2 . ply 2 . 
--     (# n "<1 1 2 2 6 6 6 1 16 16 17 18>" )
--   )
--   $ midiOff "^57" ( -- LOWER
--     (# n "<5 5 5 6>")
--     )
--   $ "perfect" 
--   # room 0.4 
--   # sz 0.4
--   # octersub 0.4
--   # crushbus 41 (range 16 4.5 "^53")
--   # octersubbus 42 (range 0 2.5 "^33")
--   # octersubbus 43 (range 0 5 "^17")
--   # cut 4 
--   # gain 1.4
-- d5 $ gF3 $ gM3 -- COUNT TO SUPERSTARDOM
--   $ midiOn "^29" (
--     slice 16 "<<[0 1 2 3] [<0 10> <1 11> 10 11]> <[8 9 10 11] [<12!3 15> <13!3 15> <14 12> <15 13>]>>" 
--     . (>| "perfect")
--     )
--   $ midiOn "^90" (ply "<2 4>")
--   $ midiOn ("^34" - "^18") ( -- THE HIPS THE FACE THE LIPS THE MICROPHONE 
--     slice 4 (fast 2 
--       . ply "<1!16 <2 1>!16>" 
--       . "<0 1 2 3>") 
--     . (# n 14) . (|* gain 0.8)
--     )
--   $ midiOn "^18" -- SUPERSTAR
--     (
--       -- mask "<t f!3>" 
--       loopAt 4
--       . (0.5 ~>)
--       . (# n 8)
--       . mask "<t!4 t f t t>"
--       . (# end "<0.18!3 0.45 1!4>")
--       . (# begin "<0!4 0.5!4>")
--       . (|* gain 1.3)
--       )
--   $ midiOn ("^58") ( -- Slice 1 2 3 4!
--     slice 8 "<[0 1] [0 1] [0 0 <0 1> <1 0>] [2 3]>" )
--   $ midiOff ("^58"+"^29") ( -- WATCH ME WORK IT
--     slice 8 "<[0 1] [2 3] [4 5] [6 <7 <6 6*2>>]>"
--     )
--   $ "perfect" 
--   # cut 5
--   # room 0.4 # sz 0.39
--   # pan "0.2 0.8 0.2 0.8"
--   # gain 1.8
--   # octersub 0.8  
-- d6 $ gF1 $ gM3 
--   $ mask "f t" 
--   $ midiOn "^89" (ply "<4 8>")
--   $ chop 16
--   $ "meth_bass:3/8" 
--   # room 0.4 
--   # sz "<0.7!3 1.1>"
--   # delay 0.8 # delayt 0.125 # delayfb 0.5
--   # gain 1.4
--   # cut 6
-- d7   -- $ gF3 $ gM3 
--   $ midiOn "^59" (off (1/16) (|+ note 7))
--   $ note (
--     fast 2 
--     "<[f3 <bf3!2 bf3!2 cs4!2 f4!2> <cs4!2 gs4!2> f4]>"
--      + "[0,<0!8 12!8>]"
--     )
--   # s "acidOto3092"
--   # gain 1.4
--   # width (range 0.5 0.98 "^35")
--   # crushbus 71  (range 16 3.5 "^55")
--   # cutoff (slow 3 $ range 300 3000 (sine * saw)) -- more erratic filter
--   # room 0.2 # sz 0.4 
-- d12 $ gF3 $ gM3 -- Acid techno arp with structured rhythms
--   $ note (slow 2 $ 
--         "<[bf2 . cs3 [ef3 bf3]] [cs3 ef3 . bf3] [ef3 . [bf3 cs4] ef3] [[bf3 gs3] . cs3 ef3]>")
--     # s "acidOto3091" 
--     # gain 1.3
--     # cutoff (slow 4 $ range 400 2500 saw)  -- classic acid filter sweep
--     # resonance 0.3
--     # accelerate (choose [0, 0.1, -0.1]) -- slight pitch drift
--     # room 0.2 # sz 0.3
-- d8 $ gF1 $ gM1 
--   $ midiOff "^60" (mask "t(<4 [<2 4> 8]>,8,1)" . chop 8)
--   $ midiOff "^56" (
--     slice 8 "0 1 <2!3 ~> <3!3 0> <4!3 1> 5 <6!12 ~!3 6*4> 7*<1 2 0 8>")
--   $ midiOn "^56" (loopAt 2 . (# "jungle_breaks:19"))
--   $ chop 8 
--   $ loopAt 1 
--   $ "breaks165" 
--   # cut 8
--   # gain 1.2 
-- d9 $ gF2 $ gM3-- slow arpeggiated synth, high register 
--   $ mask "t <f!8 t!8> <f!4 t!4> <f!8 t!8>"
--  $ fast 4
--  $ arp "up" 
--  $ note (slow 2 $ "<bf4'min cs4'maj ef4'min bf4'min>")
--  # "90s_synatm:3" |+ note 12  -- or "foo" 
--  # room 0.7 # sz 0.9
--  # delay 0.5 # delaytime (1/3) # delayfb 0.4
--  # lpf 1400
--  # cut 9
-- d10 -- Euclidian mid arps
--  $ struct "t(5,8,2)" 
--  $ note (slow 2 $ "<bf3 cs4 ef3 bf3>" + "<0 7 12>")
--  # s "moogBass"
--  # gain 1.2
--  # room 0.5 # sz 0.6
--  # lpf (slow 4 $ range 2000 3500 sine)
-- -- d11: sparse chord stabs, ambient pad
-- d11 
--  -- $ slow 8
--  $ note (slow 2 $ "<bf3'min'5 cs3'maj'5 ef3'min'5 bf3'min'5>")
--  # s "sine" |- note 12
--  # gain 1.4
--  # attack 0.5 # release 2
--  # room 0.9 # sz 0.95
--  # lpf 3000
--  # delay 0.7 
--  # delayt "e" 
--  # delayfb 0.8
