-- Based on Parov's Psychedelic jazz
setcps 0.46

d1 -- beat
$ someCycles (0.125 ~>)
$ s "tech:5*4" # note (-4)
# gain (slow 16 $ range 0.7 0.9 sine)

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

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] ~>"
# note "-16"
# velocity "<0.7 0.6 0.7>"
# sustain 3

d5 -- main droite
$ whenmod 128 64 rev
$ whenmod 64 48 (
  const
  $ slow 4
  $ sometimesBy 0.3 (off 0.125 id)
  $ "[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.45
  # sustain 2
)
$ 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.5

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

d7 -- ??? TODO: What is that supposed to be?
$ someCyclesBy 0.2 (# gain 1)
$ slow 2
$ s "[~ jazz:2]*8"
# gain 0
