Skip to content

Instantly share code, notes, and snippets.

@dazld
Last active March 5, 2017 17:09
Show Gist options
  • Save dazld/efd5b4996d14d5977c03ee59fbf12b48 to your computer and use it in GitHub Desktop.
Save dazld/efd5b4996d14d5977c03ee59fbf12b48 to your computer and use it in GitHub Desktop.
let am7c = "[a4, c4, e4, g5]"
d1 $ density 5 $ rarely (iter 3) $ every 2 ( # n am7c) $ struct "[x(5,8,2) x(3,8)]/5" $ n gm7
--
import Data.Maybe
let inhabit :: [(String, Pattern a)] -> Pattern String -> Pattern a
inhabit ps p = unwrap' $ (\s -> fromMaybe silence $ lookup s ps) <$> p
let chords = [("am7c", "[a6, c6, e6, g7]"),
("gm7", "[g6, bf6, d7, f7]")
]
in
m1 $ n (inhabit chords "am7c ~ gm7")
--
let chords = [("am7c", "[a6, c6, e6, g7]"),
("gm7", "[g6, bf6, d7, f7]")
]
in
d1 $ n (every 2 ((+ 12) <$>) $ inhabit chords "am7c ~ gm7") # s "rash"
--
let arps = [("am7c", "[a6 c6 e6 g7*2]"),
("gm7", "[g6 bf6 d7 f7]")
]
in
d1 $ n (every 2 ((+ 12) <$>) $ inhabit arps "am7c [gm7 ~] gm7 [~ am7c]") # s "rash"
--
let funcs = [("id", pure $ id),
("chipmunk", pure $ (|*| speed "2") . density 2),
("slurp", pure $ rev . chop 8)
]
tx ps p = unwrap $ (\f -> f p) <$> (inhabit funcs ps)
tx' ps p = unwrap' $ (\f -> f p) <$> (inhabit funcs ps)
d1 $ tx "{id chipmunk slurp}%4" $ sound "bd ~ mt*2 ht:2"
d1 $ slow 2 $ tx' "{id chipmunk slurp}%4" $ sound "bd ~ mt*2 ht:2"
let chords = [("am7", "[a4 c4 e4 g5]"),
("gm7", "[g4 bf4 d4 f5]"),
("cmaj7","[c4 e4 g4 bf4]"),
("d7b5", "[d4 gf4 af4 c5]"),
("dm7", "[d4 f4 a4 c5]"),
("gmaj7", "[g4 b4 d5 f5]"),
("cmaj6", "[c4 e4 g4 a4]")
]
in
m1 $ slow 4 $ rarely ((within (0.25, 0.75) (density 1.5))) $ struct "x(7,12,4)" $ n (inhabit chords "cmaj7 d7b5 dm7 gmaj7 cmaj6")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment