From 1d144faed71e65d240dae549ca1d5543344414d3 Mon Sep 17 00:00:00 2001 From: "Jade (Rose) Rowland" Date: Thu, 2 Jan 2025 22:39:56 -0500 Subject: [PATCH] update snapshot --- packages/core/pattern.mjs | 11 +++------ test/__snapshots__/examples.test.mjs.snap | 30 +++++++++++++++++++++++ 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/packages/core/pattern.mjs b/packages/core/pattern.mjs index db1d9d0b..170e1633 100644 --- a/packages/core/pattern.mjs +++ b/packages/core/pattern.mjs @@ -3101,7 +3101,6 @@ 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 @@ -3112,11 +3111,9 @@ Pattern.prototype.xfade = function (pos, b) { * @example * s("sd").os("4:12", 16) */ -export const {onSubCycle, onSub, os} = register(['onSubCycle', 'onSub', 'os'], (times, div, pat) => { +export const { onSubCycle, onSub, os } = register(['onSubCycle', 'onSub', 'os'], (times, div, pat) => { if (typeof times === 'number') { - times = [times] + times = [times]; } - return stack( - ...times.map(t => pat.pressBy(_mod(t, div)/div).duration(1/div)) - )} -) + return stack(...times.map((t) => pat.pressBy(_mod(t, div) / div).duration(1 / div))); +}); diff --git a/test/__snapshots__/examples.test.mjs.snap b/test/__snapshots__/examples.test.mjs.snap index 7c21d464..d258afe2 100644 --- a/test/__snapshots__/examples.test.mjs.snap +++ b/test/__snapshots__/examples.test.mjs.snap @@ -4902,6 +4902,36 @@ exports[`runs examples > example "often" example index 0 1`] = ` ] `; +exports[`runs examples > example "onSubCycle" example index 0 1`] = ` +[ + "[ 0/1 → 1/1 | s:bd duration:0.0625 ]", + "[ 7/16 → 1/1 | s:bd duration:0.0625 ]", + "[ 5/8 → 1/1 | s:bd duration:0.0625 ]", + "[ 1/1 → 2/1 | s:bd duration:0.0625 ]", + "[ 23/16 → 2/1 | s:bd duration:0.0625 ]", + "[ 13/8 → 2/1 | s:bd duration:0.0625 ]", + "[ 2/1 → 3/1 | s:bd duration:0.0625 ]", + "[ 39/16 → 3/1 | s:bd duration:0.0625 ]", + "[ 21/8 → 3/1 | s:bd duration:0.0625 ]", + "[ 3/1 → 4/1 | s:bd duration:0.0625 ]", + "[ 55/16 → 4/1 | s:bd duration:0.0625 ]", + "[ 29/8 → 4/1 | s:bd duration:0.0625 ]", +] +`; + +exports[`runs examples > example "onSubCycle" example index 1 1`] = ` +[ + "[ 1/4 → 1/1 | s:sd duration:0.0625 ]", + "[ 3/4 → 1/1 | s:sd duration:0.0625 ]", + "[ 5/4 → 2/1 | s:sd duration:0.0625 ]", + "[ 7/4 → 2/1 | s:sd duration:0.0625 ]", + "[ 9/4 → 3/1 | s:sd duration:0.0625 ]", + "[ 11/4 → 3/1 | s:sd duration:0.0625 ]", + "[ 13/4 → 4/1 | s:sd duration:0.0625 ]", + "[ 15/4 → 4/1 | s:sd duration:0.0625 ]", +] +`; + exports[`runs examples > example "orbit" example index 0 1`] = ` [ "[ 0/1 → 1/6 | s:hh delay:0.5 delaytime:0.25 orbit:1 ]",