When I use i.e. a pattern with dots like n "[0 .. 3]"
I receive something like this:
0>¼)|n: Note {unNote = 0.0}n
(¼>½)|n: Note {unNote = 1.0}n
(½>¾)|n: Note {unNote = 2.0}n
(¾>1)|n: Note {unNote = 3.0}n
I was wondering if there is an existing function for this shorthand with stack
and not cat
. I created something like this to achieve such a result:
stackFromList :: [a] -> Pattern a
stackFromList = stack . map pure
patternToList :: Pattern a -> [a]
patternToList pat = (map value (queryArc pat (Arc 0 1)))
cond pat = stackFromList $ patternToList pat
When I use it like n (cond "0 .. 3")
I receive the result I was looking for.
This is useful, for example, to be able to conditionally specify a note range for the function fix
which could be interesting with control functions like:
gitNote = pN "gitNote"
d1 $ (fix (# silence) (gitNote $ cond $ "[c5 .. d6]"))
$ s "808"
# gitNote (cN 0 "notes") -- incoming note from osc ctrl message
The Problem here is that I find it not very handsome to pattern the conditions (because it is not inside of the mini notation). That's why I need to use something like this:
d1 $ (fix (# cutoff 3000)
(cat [gitNote $ cond $ "[c6 .. d6]", gitNote $ cond $ "[c5 .. d6]"]))
$ s "supervibe" <| n "c a f e"
# gitNote (cN 0 "notes")
That's why my initial question, whether there is an existing function (or maybe a better solution) to get a stack of notes in a range?