Pick random notes from a list whitin a pattern?

Hi am trying to create some controlled randomness within a pattern/chord
How can I make this work:

d1 $ s “superpiano” >| note “{c4, choose[e4,f4], fs4, , e5}”

@scnils it’s not possible to do that in the ‘mini notation’ (the stuff in double quotes). This sort of thing will likely be possible one day but for now you have to think about the mini notation as a way to make sequences, where complicated things have to happen outside of that. E.g.:

d1 $ s "superpiano" >| note (cat [struct "t(3,8)" $ choose [7,0], "e"])

You also can’t use note names outside of the mini notation, so I’ve used numbers in the choose in the above…

Thank you so much for your answer and your help! In your example you pick a random tone, 0 and 7, but what if you want to define chords this way. Is there a way?

Here’s one way:

d1 $ s "superpiano" >| note (cat [struct "t(3,8)" $ innerJoin $ choose ["e'maj'", "f'min'4"], "e"])

In a simpler context:

d1 $ note (innerJoin $ choose ["e'maj(3,8)", "f'min'4", "c'min7"]) |< s "superpiano"

Here I’m using choose to choose between patterns of numbers, rather than single numbers. This ends up with a pattern of patterns of numbers! The innerJoin turns it back into a pattern of numbers.

1 Like

Thanks so much for the information very helpful!