Casting [Char] to Pattern Note

I want to pass different note patterns I'm using as chord progressions to a function to manipulate them in various ways. When I do so, it returns a [Char] which can't be read. Here is a simple example:

prog1 = "[g4,c5,d5,e3] [f4,as4,ds5,g3] [g4'sus2,b3] [fs4'sus2,as3]"
prog2 = "{"++prog1++"}%3" -- this works but creates a [Char]
d1 $ s "superpiano*4" # n prog2 -- expects a Note Pattern, not a [Char]

The console says this:

t> 
    • Couldn't match expected type ‘Pattern Note’
                  with actual type ‘[Char]’

I'm a Haskell newbie and have dug around a lot and experimented but am not able to get "{"++prog1++"}%3" to be a readable pattern for # n. Thanks for your help!

1 Like

Hey @sherwood! Tidalcycles needs to parse this list of chars. You can use the function parseBP_E (which stands for parse bol-processor \w exception). Btw this is how TidalCycles parses the mini-notation naturally.

This should work for you:

prog1 = "[g4,c5,d5,e3] [f4,as4,ds5,g3] [g4'sus2,b3] [fs4'sus2,as3]"
prog2 = "{"++prog1++"}%3" 

d1 $ s "superpiano" <| n (parseBP_E prog2)

Have fun :slight_smile:

6 Likes

Thanks, that works perfectly! Also, I use tidal looper A LOT, it's really great, thanks for that too.

1 Like

PS @mrreason Here is tidal looper in action, all sounds from my bansuri flute, projecting on giant dunes in the UAE desert with a dancer: Desert Improvisation Experiments on Vimeo

1 Like

I'm very happy to hear that you enjoy the tidal looper so much. I was blown away by your desert experiment. Another example that I didn't expect myself :slight_smile:

I plan to collect a few examples made with the looper and post them to the README on the GitHub page. If you don't mind, I'd link the video right along with it.

Please do, happy to hear that!