Another approach is using inhabit
, you pass it a list of names and patterns, like this:
let drum pat = sound (inhabit [("bd", "231"), ("sd", "232")] pat)
d1 $ drum "bd sd" # midichan 9
You could also hide the midi channel in there so you don't have to type it each time
let drum pat = sound (inhabit [("bd", "231"), ("sd", "232")] pat) # midichan 9
d1 $ drum "bd sd"
d2 $ drum "bd*3 sd*2"
Note that the "232"
bit is a pattern, so you could have one name trigger more than one event e.g.
let drum pat = sound (inhabit [("bd", "231"), ("rush", "232*8"), ("sd", "232")] pat) # midichan 9
d1 $ drum "bd sd rush"