flatpat

From TidalCycles userbase
Revision as of 16:24, 26 December 2020 by Left adjoint (talk | contribs) (Created page with "{{DISPLAYTITLE:inv}} Type: <syntaxhighlight lang="haskell" inline>flatpat :: Pattern [a] -> Pattern a</syntaxhighlight> '''flatpat''' takes a pattern of l...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Type: flatpat :: Pattern [a] -> Pattern a

flatpat takes a pattern of lists and flattens it into a pattern where all the events in each list happen simultaneously.

For example, the following code uses flatpat in combination with listToPat to create an alternating pattern of chords.

d1 $ n (flatpat $ listToPat [[0,4,7],[(-12),(-8),(-5)]]) # s "superpiano" # sustain 2

This code is equivalent to

d1 $ n ("[0,4,7] [-12,-8,-5]") # s "superpiano" # sustain 2