mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-22 11:08:35 +00:00
add arrange function
This commit is contained in:
parent
4bfeaa47bf
commit
487ccb90a1
@ -1284,6 +1284,20 @@ export function timeCat(...timepats) {
|
|||||||
return stack(...pats);
|
return stack(...pats);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows to arrange multiple patterns together over multiple cycles.
|
||||||
|
* Takes a variable number of arrays with two elements specifying the number of cycles and the pattern to use.
|
||||||
|
*
|
||||||
|
* @return {Pattern}
|
||||||
|
* @example
|
||||||
|
* arrange([4, "<c a f e>(3,8)"],[2, "<g a>(5,8)"]).note()
|
||||||
|
*/
|
||||||
|
export function arrange(...sections) {
|
||||||
|
const total = sections.reduce((sum, [cycles]) => sum + cycles, 0);
|
||||||
|
sections = sections.map(([cycles, section]) => [cycles, section.fast(cycles)]);
|
||||||
|
return timeCat(...sections).slow(total);
|
||||||
|
}
|
||||||
|
|
||||||
export function fastcat(...pats) {
|
export function fastcat(...pats) {
|
||||||
return slowcat(...pats)._fast(pats.length);
|
return slowcat(...pats)._fast(pats.length);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -49,6 +49,10 @@ As a chained function:
|
|||||||
|
|
||||||
<JsDoc client:idle name="timeCat" h={0} />
|
<JsDoc client:idle name="timeCat" h={0} />
|
||||||
|
|
||||||
|
## arrange
|
||||||
|
|
||||||
|
<JsDoc client:idle name="arrange" h={0} />
|
||||||
|
|
||||||
## polymeter
|
## polymeter
|
||||||
|
|
||||||
<JsDoc client:idle name="polymeter" h={0} />
|
<JsDoc client:idle name="polymeter" h={0} />
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user