-- Based on Parov's Psychedelic jazz
setcps 0.46

d1 -- beat
$ whenmod 16 16 (|+ gain 0.2)
$ whenmod 16 15 (|+ gain 0.2)
$ whenmod 16 14 (|+ gain 0.2)
$ whenmod 16 12 (|- gain 0.2)
$ whenmod 16 10 (|- gain 0.2)
$ whenmod 16 8 (|- gain 0.2)
$ s "tech:5*4" # note (-4)
# gain 1.3

d2
$ s "[~ hh ~ <hh [hh ~ hh]>]*2"
$ every 4 (const $ "[~ [hh,hh:8] ~ [hh ~ hh]]*2" # gain 1.2)
# gain 1.2

d3
$ s "bd sn bd <cp cp cp cp*2>"

d4 -- main gauche
-- $ whenmod 32 24 (|+ note 7)
$ s "superpiano"
# note "<-20 [-19,-15] [-20,-16] ~>"
# velocity "<0.7 0.5 0.6>"
# sustain 3
# gain 1.2

d5 -- main droite
$ whenmod 64 48 (
  const
  $ slow 4
  $ sometimesBy 0.3 (off 0.125 (|+ 0))
  $ "[p p p ~] [~ p p p] [~ ~ [p p?] ~] [p p? p? p] [p]"
  # s "superpiano"
  # n "[7 5 4 ~] [~ 4 2 0] [~ ~ 0 ~] [-1 -1 -1 0] [-1]"
  # gain 0.7
  # velocity 1
  # sustain 2
)
$ whenmod 32 16 (# gain 0.8)
$ whenmod 32 0 (# gain 0)
$ every 4 ((>| s "superpiano*16") . (# note "6 <2 5> <2 1>"))
$ someCycles (# sustain 3)
$ s "[p?*3] . ~ . [p*2] . ~ [p? p] . ~"
# s "superpiano"
# note "<1 [2,6] [1,5] ~>"
# velocity 0.8

d5 -- white noise
$ someCycles (# silence)
$ sometimes (jux rev)
$ (# speed (rand / 2))
$ s "glitch:2" -- # n (run 8)
# cut 1
# gain 1.2

d6
$ someCyclesBy 0.2 (# gain 1)
$ slow 2
$ s "[~ jazz:2]*8"
# gain 0
