mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-11 13:48:34 +00:00
doc: chunk + chunkBack
This commit is contained in:
parent
e4f4fe81ae
commit
5d699496ca
@ -1189,6 +1189,14 @@ export class Pattern {
|
||||
return this.iter(times, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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).
|
||||
* @name chunk
|
||||
* @memberof Pattern
|
||||
* @returns Pattern
|
||||
* @example
|
||||
* "0 1 2 3".chunk(4, x=>x.add(7)).scale('A minor').note().out()
|
||||
*/
|
||||
_chunk(n, func, back = false) {
|
||||
const binary = Array(n - 1).fill(false);
|
||||
binary.unshift(true);
|
||||
@ -1196,6 +1204,14 @@ export class Pattern {
|
||||
return this.when(binary_pat, func);
|
||||
}
|
||||
|
||||
/**
|
||||
* Like `chunk`, but cycles through the parts in reverse order. Known as chunk' in tidalcycles
|
||||
* @name chunkBack
|
||||
* @memberof Pattern
|
||||
* @returns Pattern
|
||||
* @example
|
||||
* "0 1 2 3".chunkBack(4, x=>x.add(7)).scale('A minor').note().out()
|
||||
*/
|
||||
_chunkBack(n, func) {
|
||||
return this._chunk(n, func, true);
|
||||
}
|
||||
|
||||
@ -596,6 +596,10 @@ Like layer, but with a single function:
|
||||
|
||||
{{ 'Pattern.range' | jsdoc }}
|
||||
|
||||
{{ 'Pattern.chunk' | jsdoc }}
|
||||
|
||||
{{ 'Pattern.chunkBack' | jsdoc }}
|
||||
|
||||
## Continuous Signals
|
||||
|
||||
Signals are patterns with continuous values, meaning they have theoretically infinite steps.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user