Difference between revisions of "stitch"

From TidalCycles userbase
Jump to: navigation, search
(Created page with "<source> stitch :: Pattern Bool -> Pattern a -> Pattern a -> Pattern a stitch pb a b = overlay (struct pb a) (struct (inv pb) b) </source> '''stitch''' uses the first (binar...")
 
Line 1: Line 1:
<source>
+
[[Type signature|Type]]: <source inline>Pattern Bool -> Pattern a -> Pattern a -> Pattern a</source>
stitch :: Pattern Bool -> Pattern a -> Pattern a -> Pattern a
 
stitch pb a b = overlay (struct pb a)  (struct (inv pb) b)
 
</source>
 
  
 
'''stitch''' uses the first (binary) pattern to switch between the following two patterns. The resulting structure comes from the binary pattern, not the source patterns. This differs from '''sew''' where the resulting structure comes from the source patterns.
 
'''stitch''' uses the first (binary) pattern to switch between the following two patterns. The resulting structure comes from the binary pattern, not the source patterns. This differs from '''sew''' where the resulting structure comes from the source patterns.
  
 
Example:
 
Example:
<source>
+
<source>d1 $ stitch "1(8,16)" (cc "0:64") $ sound "midi"</source>
d1 $ stitch "1(8,16)" (cc "0:64") $ sound "midi"
 
<source>
 
  
 
This will use the boolean pattern to send CC0 with a value of 64 to midi.
 
This will use the boolean pattern to send CC0 with a value of 64 to midi.
 +
 +
[[Category:Functions]]

Revision as of 01:37, 10 May 2020

Type: Pattern Bool -> Pattern a -> Pattern a -> Pattern a

stitch uses the first (binary) pattern to switch between the following two patterns. The resulting structure comes from the binary pattern, not the source patterns. This differs from sew where the resulting structure comes from the source patterns.

Example:

d1 $ stitch "1(8,16)" (cc "0:64") $ sound "midi"

This will use the boolean pattern to send CC0 with a value of 64 to midi.