import Sound.Tidal.ParVagues.Control
-- Accompagnement Midi techno piano

do
let pontH = (someCyclesBy "<0!32 1!8 0!24>" (# hpf (slow 8 $ range 0 500 saw)))
let pontL = (whenmod 16 12 (# lpf 2000))
let toPontL = (every' 16 11 (# lpf 5000))
let chords = "<c'min'2!4 c'maj'2!4>"
let prog = ("<cs5!4 a4 a4 b4 gs4>")
let chorus = pF "chorus"
let mix = pF "mix"
let modIndex = pF "modIndex" -- 0.2
let gG a = (gain (1.2 * "^77" * a)) -- gain Global
let gM' l h a = (gG (range l h a)) -- gain Modéré
let gM a = (gM' 0.2 0.8 a) -- gain Modéré doux
let gDJF = midiDJF "^49" 0 10000 0 7500
let gFreqL = (# lpq (range 0 0.25 "^29"))
let gFreqH = (# hpq (range 0 0.25 "^30"))
let gFreqs = (gFreqH . gFreqL)
let g = (gDJF . gFreqs)
setcps 0.5
d1 $ g
  $ "[jazz,hh27:5]*4"
  # gM' 0 1.4 "^78"
d2
  $ g
  $ midiOn "^41" (fast 2)
  $ "hh27*8" # n "[1|4]*8"
  # room 0.6 # sz 0.7 # dry (slow 20 $ range 0 2 perlin)
  # gM' 0.5 1.5 "^79"
d3 -- Runny Maracas
  $ g
  $ whenmod 16 8 (often $ fast 2)
  $ someCyclesBy "<1!16 0!16>" (often $ slow "2!3 1")
  $ fix ((|* gain 0.9) . (# release 0.8)) (n 9)
  $ "hh27*8"
  # n "2 <2 <[2|9] [9 <9 ~> <~ 9> 2]>>"
  # gM' 0.5 1.75 "^80"


-- TODO: Below not ready

d6 $ g -- Guitar riffs
  $ whenmod 16 12 (off "h" (
    chop 4
  . (# cut 61)
  ))
  $ slice 4 (
    whenmod 16 8 (+| "0 <0!6 ~ ~>")
    "<0!4 1 1 2 3>"
  )
  $ note 2 -- correction
  # "punk"
  # cut 6
  # lpq (range 0 0.125 "^17")
  # attack (range 0.5 1 "^33")
  # crush (range 12 1.75 "^53")
  # pan 0.9
  # room 0.3
  # sz 0.9
  # gM' 0.4 1.5 "^81"
d4 -- Rhodes base + chords
  $ g
  $ midiOn "^58" (superimpose ( -- ARPS <3
    (|+ note 12)
    . sometimesBy "0 0.5!7" rev
    . fast "1 2"
    . arp "pinkyup"
    . (|+ pan 0.1)
    . (|* gain 1.2)
  ))
  $ note ((
    "<0 ~> 0"
    + prog
    + "0 -12"
    - "12" -- Octave
  ))
  # "FMRhodes1"
  # modIndex "[0,5,10]"
  # pan 0.6
  # crush (range 10 4 "^54")
  # gM' 0.3 1.9 "^82"
d5 $ g -- Choirs + arps
  $ juxBy "-0.7" (
    arp "<up <up down>>"
    . (|+| note "[0,7,12]*2")
    . (|* gain 0.85)
    . (# lpf 2000)
  )
  $ "moogBass"
  # note (prog + "[0,24]")
  # octave 3
  # gM' 0.3 1.5 "^56"
  # pan 0.2
  # chorus 0.6
d8 $ g -- Electrified laggy moog
  $ midiOn "^91" (ply 2)
  $ midiOn "^59" (
    (# lpf 2000)
    . (# lpq (slow 16 $ range 0 0.15 perlin))
  )
  $ midiOn "^91" (segment "4 <4 <8 [8 16]>>")
  $ note (prog + "0 12")
  # "moog"
  # cut 8
  # crush (range 16 4 "^55")
  # gM' 0 1.8 "^83"
  # release 100
d9 $ g
  $ midiOn "^60" (fast 2 . ply "1 <1 <2!3 1>>")
  $ midiOn "^92" (fast 4)
  $ "~ clap"
  # note (-8)
  # gM' 0 1.5 "^84"
