Could this approach be extended to allow "variant n in a group of MIDI sounds"?
Goal: Send a sequence of numbers like "bd" or "sn" usually allow, picking sounds in MIDI instead of samples from a folder, like this (here):
d1 $ n "0 1 2 3" # s "numbers"
Background: I'm sequencing an Elektron Analog Four, with a set of drum sounds by Kimura Taro (link). There are 128 sounds in the "Sound Pool" available; e.g., 12 different kickdrum sounds.
My current definition was made by imitating the posts in this topic (af
for "Analog Four"):
let
drum :: Pattern String -> ControlPattern
drum = n . (subtract 60 . drumN <$>)
drumN :: Num a => String -> a
drumN "bd1" = 1 -- BD C01 (Kick)
drumN "bd2" = 2 -- BD C02 (Kick)
drumN "bd3" = 3 -- BD C03 (Kick)
drumN "bd4" = 4 -- BD C04 (Kick)
drumN "bd5" = 5 -- BD C05 (Kick) .... (etc. etc. up to sound 128)
drumN _ = 0
afmidi = s "midi"
af x = drum x # afmidi
-- usage
d1 $ af "bd1 bd4"
This works really well, but doesn't allow sending a sequence of numbers to select between the kick sounds. Any hints as to how the let
could be altered? To allow:
d1 $ n "1 4" # af "bd"