Difference between revisions of "chunk"

From TidalCycles userbase
Jump to: navigation, search
m (Yaxu moved page Chunk to chunk)
Line 1: Line 1:
 
{{DISPLAYTITLE:chunk}}  
 
{{DISPLAYTITLE:chunk}}  
[[Type signature|Type]]: <syntaxhighlight lang="haskell" inline>Chunk :: Int -> (Pattern b -> Pattern b) -> Pattern b -> Pattern b</syntaxhighlight>
+
[[Type signature|Type]]: <syntaxhighlight lang="haskell" inline>chunk :: Int -> (Pattern b -> Pattern b) -> Pattern b -> Pattern b</syntaxhighlight>
  
 
'''chunk''' divides a pattern into a given number of parts, then cycles through those parts in turn, applying the given function to each part in turn (one part per cycle).
 
'''chunk''' divides a pattern into a given number of parts, then cycles through those parts in turn, applying the given function to each part in turn (one part per cycle).

Revision as of 12:26, 23 March 2019

Type: chunk :: Int -> (Pattern b -> Pattern b) -> Pattern b -> Pattern b

chunk divides a pattern into a given number of parts, then cycles through those parts in turn, applying the given function to each part in turn (one part per cycle).

Example:

d1 $ chunk 4 (# speed 2) $ sound "bd hh sn cp"

The below highlights in bold which part of the above pattern has the (# speed 2) function applied to it over four cycles:

bd hh sn cp
bd hh sn cp
bd hh sn cp
bd hh sn cp

Another example:

d1 $ chunk 4 (hurry 2) $ sound "bd sn:2 [~ bd] sn:2"

chunk'

chunk' does the same as chunk but cycles through the parts in the reverse direction.