This commit is contained in:
Jade (Rose) Rowland 2025-01-02 22:33:04 -05:00
parent 1e3bbc57cc
commit 7b914e7f22

View File

@ -3100,3 +3100,23 @@ export let xfade = (a, pos, b) => {
Pattern.prototype.xfade = function (pos, b) {
return xfade(this, pos, b);
};
/**
* creates a structure pattern from divisions of a cycle
* especially useful for creating rhythms
* @name onSubCycle
* @synonyms onSub, os
* @example
* s("bd").os("0:7:10", 16)
* @example
* s("sd").os("4:12", 16)
*/
export const {onSubCycle, onSub, os} = register(['onSubCycle', 'onSub', 'os'], (times, div, pat) => {
if (typeof times === 'number') {
times = [times]
}
return stack(
...times.map(t => pat.pressBy(_mod(t, div)/div).duration(1/div))
)}
)