Tidal
Tidal copied to clipboard
cannot parse arpeggiator pattern "up&down"
copied from https://club.tidalcycles.org/t/arpeggiator-patterns-up-down-down-up/3689
tidal> d1 $ n (arp "up&down" "c'maj7") # s "superpiano"
Error in pattern: Syntax error in sequence:
"up&down"
^
unexpected '&'
expecting charnum, rest, "[", "{", "<", "^", ".", "?" or end of input
looks like a bug to me, as the reference doc suggests that it should work http://tidalcycles.org/docs/patternlib/tour/harmony_melody/#arp
I don't have a fix, need to look up details of the mini-notation parser.
While we're at it, the implementation https://github.com/tidalcycles/Tidal/blob/main/src/Sound/Tidal/UI.hs#L1429 could be improved a bit
- replace list (
arps) by some map type that has more efficient lookup - float it out of function
_arp, to top level (else, the list might get built each time the function is used)
On the other hand, don't fix it if it ain't broken - the above points are probably not critical for performance. (strings as keys are bad in any case, and this can't be easily changed in Tidal)
Note that this works (with pure)
Prelude Sound.Tidal.Context> n (arp (pure "up&down") "c'maj7") # s "superpiano"
(0>⅛)|n: Note {unNote = 0.0}n, s: "superpiano"
(⅛>¼)|n: Note {unNote = 4.0}n, s: "superpiano"
(¼>⅜)|n: Note {unNote = 7.0}n, s: "superpiano"
...
mini notation parser won't accept & since
415 pString :: MyParser String
416 pString = do c <- pCharNum <?> "charnum"
417 cs <- many (letter <|> oneOf "0123456789:.-_") <?> "string"
418 return (c:cs)
Should & be added to the list of extra characters here?