
-- https://www.youtube.com/watch?v=2xwUq7KL908
-- Proper Trap Beat Structure

-- /12:
-- 2m rtm - 2m full - 2m -guit - 2m -flute - 2m full -- 2m rtm

-- Hh / oh: ff tt tt ff tt ff
-- Melody: up and down octave

-- Take out all drums when instrument comes back.
-- or at the end of some bars with e.g. only guitar

-- cp: Remove last of 4th bar
d3
  $ whenmod 8 6 (fast "<1 [1 2]> . 2")
  $ "dr*[8!3 <16!3 [16 8]>]"
  # gain 0.5


-- https://www.edmprod.com/how-to-make-trap-music/
-- 7 Steps To Beats That Hit Hard
-- TODO: Step 4: Sprinkle the FX
do
-- resetCycles
setcps (160/60/4)
let g = (# djfbus 1 0.5)
d1 $ g -- Kick
  -- Add some extra kicks here and there (e.g. double kick on beat 1)
  $ "<[k*<1!4 2 1!2 2> ~] [~ k]> . ~ ~ <~!3 k> ~"
  # "[bd:1,kick:5]"
  # gain 0.9
  # att 0
  # rel 0.7
d2 $ g
  $ mask "<t!32 [t!3 f]!8 t!24>"
  $ fix ((# legato 0.5) . (|* gain 0.9)) "cp"
  -- Adding a clap or snap sample to layer with certain snare hits
  $ "<~!4 s*<1 1 2 1> ~!3> ~ s*<1!3 <2 1 2 2>> [~ ~ ~ <~ s>]"
  # "[snare:15,sn:3,house:7,cp]"
  # legato 0.65
  # pan 0.65
  # gain 0.85
d3 $ g -- High hats!
  $ whenmod 4 3 (sometimes (fast 2))
  $ mask "t . <t [t <t?!16 t!16> <t?!24 t!8> t]>" -- Elaguage
  $ mask "<t!6 t? t?*4 t!6 f [f t]>" -- Remove some of the hits to create tension at different points
  $ sometimesBy (slow 32 $ range 0 0.5 ("<0!3 1>" * sine)) (ply "1!7 <2 4>") -- Add some 16th note fills on the hi-hat towards the end of a bar
  $ fix (|* gain 0.85) "h2ogmhh"
  $ "d*8"
  # "[dr,house:3]"
  # gain (slow 16 $ range 0.6 0.95 saw)
d4 $ g -- Bouncy beat FIXME
  $ mask "<f!3 t f t f t t!24 f!8 t!24>" -- Mask for beat
  $ someCyclesBy (slow 8 $ range 0 0.5 saw) (iter "1 <2!8 4!8 8!8 16!8>")
  $ slice 8 (run "<8!4 16!4 8!8 16!16> <8 8 <8 16> <16!3 [16 32]>>")
  $ "noir_beats:2"
  # speed "<1!24 2!8>"
  # cut 4
  # hpf 250
  # pan (slow 8 $ range 0.2 0.8 cosine)
  # gain (slow 16 $ range 0.65 0.9 saw)
d5 $ g -- SUB MELODY
  $ slow 2
  $ note ("<as4 g4 d4 g4>@5 c@2 bf4@1")
  # "808bd:1"
  # gain 1.7
  # legato 2
  # pan 0.45
  # crush "<16!7 15 13!8>"
  # room 0.8 # sz 0.9
  # dry 1
d6 $ g -- Ambient keys layer
  $ mask "<f!24 t!8>"
  $ note ("<as4 g4 <d4 d4 d d4> g4>")
  # "pad:2" # cut 6
  # room 0.83
  # sz 0.64
  # att 0
  # rel 1.3
  # gain 0.7
d7 $ g -- BURNT Horizon bass
  $ mask "<<f!8 t!8> t!7 f t!3 f t!4 t!6 f f>"
  $ whenmod 32 24 (# djfbus 71 (slow 8 $ range 0.5 0.9 saw))
  $ whenmod 32 16 (# squiz (range 2.5 10.5 perlin))
  $ slow 2
  $ note ("<g4 g4 d4 g4>@5 c@2 <d!3 as4>@1" - 12)
  # "superchip"
  # voice 0
  # lpf 5000
  # room 0.8 # sz 0.9
  # delay (slow 16 $ range 0.4 0.8 saw)
  # delayfb (slow 8 $ range 0 0.75 saw)
  # delayt (slow 24 "<q e s>")
  # pitch2 "<2!3 4>"
  # cut 7
  # pan "<0.2 0.8> <0.8!3 0.2>"
  # gain 0.65
d8 $ g -- Stab side bassline
  $ ply "2 <1!3 4>"
  $ iter 4
  $ mask "<f!4 t!24 f!3 t>"
  $ note ("[b*<1 4>,<~ [~ <a? [a <a b>]>]>] . <g c>")
  # "bass1:26"
  # cut 8
  # crushbus 81 (range 10 4 sine)
  # pan (slow 4 $ range 0.1 0.5 saw)
  # room 0.3 # sz 0.5
  # gain 0.6
