Skip to content

Commit

Permalink
working
Browse files Browse the repository at this point in the history
  • Loading branch information
daslyfe committed Jan 3, 2025
1 parent 1e3bbc5 commit 7b914e7
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions packages/core/pattern.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
)}
)

0 comments on commit 7b914e7

Please sign in to comment.