mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-20 01:58:34 +00:00
update function
This commit is contained in:
parent
7410ac5cec
commit
7b6074ccef
@ -3110,9 +3110,12 @@ Pattern.prototype.xfade = function (pos, b) {
|
|||||||
* @example
|
* @example
|
||||||
* s("sd").beat("4:12", 16)
|
* s("sd").beat("4:12", 16)
|
||||||
*/
|
*/
|
||||||
export const { beat } = register(['beat'], (times, div, pat) => {
|
const __beat = join => (t, div, pat) => {
|
||||||
if (typeof times === 'number') {
|
t = Fraction(t).mod(div);
|
||||||
times = [times];
|
div = Fraction(div);
|
||||||
}
|
const b = t.div(div);
|
||||||
return stack(...times.map((t) => pat.pressBy(_mod(t, div) / div).duration(1 / div)));
|
const e = t.add(1).div(div);
|
||||||
});
|
return join(pat.fmap(x => pure(x)._compress(b,e)));
|
||||||
|
}
|
||||||
|
|
||||||
|
export const {beat, beatOut} = register(['beat', 'beatOut'], __beat(x => x.innerJoin()));
|
||||||
Loading…
x
Reference in New Issue
Block a user