diff --git a/packages/xen/xen.mjs b/packages/xen/xen.mjs index 1e9ea8251..4e6f75d0c 100644 --- a/packages/xen/xen.mjs +++ b/packages/xen/xen.mjs @@ -127,13 +127,13 @@ export const xen = register('xen', function (scaleNameOrRatios, pat) { * @name withBase * @param {number} base * @param {number} (optional) originalBase - * + * * @example * "[0 1 2 3] [3 4] [4 3 2 1]".xen("hexany23").withBase("<220 [300 200]>") - * @example + * @example * mini([1 / 1, 16 / 15, 9 / 8, 6 / 5, 5 / 4].join(' ')).withBase("220:1") * // mini([1 / 1, 16 / 15, 9 / 8, 6 / 5, 5 / 4].join(' ')).mul(220).freq() - * + * * @returns Pattern */ export const withBase = register('withBase', (b, pat) => { diff --git a/test/__snapshots__/examples.test.mjs.snap b/test/__snapshots__/examples.test.mjs.snap index 0bf39ad3f..be58df2c7 100644 --- a/test/__snapshots__/examples.test.mjs.snap +++ b/test/__snapshots__/examples.test.mjs.snap @@ -14151,6 +14151,76 @@ exports[`runs examples > example "when" example index 0 1`] = ` exports[`runs examples > example "whenKey" example index 0 1`] = `[]`; +exports[`runs examples > example "withBase" example index 0 1`] = ` +[ + "[ 0/1 → 1/12 | freq:220 ]", + "[ 1/12 → 1/6 | freq:293.3333333 ]", + "[ 1/6 → 1/4 | freq:302.5 ]", + "[ 1/4 → 1/3 | freq:320 ]", + "[ 1/3 → 1/2 | freq:320 ]", + "[ 1/2 → 2/3 | freq:330 ]", + "[ 2/3 → 3/4 | freq:330 ]", + "[ 3/4 → 5/6 | freq:320 ]", + "[ 5/6 → 11/12 | freq:302.5 ]", + "[ 11/12 → 1/1 | freq:293.3333333 ]", + "[ 1/1 → 13/12 | freq:300 ]", + "[ 13/12 → 7/6 | freq:399.99999995454544 ]", + "[ 7/6 → 5/4 | freq:412.5 ]", + "[ 5/4 → 4/3 | freq:436.3636363636364 ]", + "[ 4/3 → 3/2 | freq:436.3636363636364 ]", + "[ 3/2 → 5/3 | freq:300 ]", + "[ 5/3 → 7/4 | freq:300 ]", + "[ 7/4 → 11/6 | freq:290.90909090909093 ]", + "[ 11/6 → 23/12 | freq:275 ]", + "[ 23/12 → 2/1 | freq:266.66666663636363 ]", + "[ 2/1 → 25/12 | freq:220 ]", + "[ 25/12 → 13/6 | freq:293.3333333 ]", + "[ 13/6 → 9/4 | freq:302.5 ]", + "[ 9/4 → 7/3 | freq:320 ]", + "[ 7/3 → 5/2 | freq:320 ]", + "[ 5/2 → 8/3 | freq:330 ]", + "[ 8/3 → 11/4 | freq:330 ]", + "[ 11/4 → 17/6 | freq:320 ]", + "[ 17/6 → 35/12 | freq:302.5 ]", + "[ 35/12 → 3/1 | freq:293.3333333 ]", + "[ 3/1 → 37/12 | freq:300 ]", + "[ 37/12 → 19/6 | freq:399.99999995454544 ]", + "[ 19/6 → 13/4 | freq:412.5 ]", + "[ 13/4 → 10/3 | freq:436.3636363636364 ]", + "[ 10/3 → 7/2 | freq:436.3636363636364 ]", + "[ 7/2 → 11/3 | freq:300 ]", + "[ 11/3 → 15/4 | freq:300 ]", + "[ 15/4 → 23/6 | freq:290.90909090909093 ]", + "[ 23/6 → 47/12 | freq:275 ]", + "[ 47/12 → 4/1 | freq:266.66666663636363 ]", +] +`; + +exports[`runs examples > example "withBase" example index 1 1`] = ` +[ + "[ 0/1 → 1/5 | freq:220 ]", + "[ 1/5 → 2/5 | freq:234.66666666666666 ]", + "[ 2/5 → 3/5 | freq:247.5 ]", + "[ 3/5 → 4/5 | freq:264 ]", + "[ 4/5 → 1/1 | freq:275 ]", + "[ 1/1 → 6/5 | freq:220 ]", + "[ 6/5 → 7/5 | freq:234.66666666666666 ]", + "[ 7/5 → 8/5 | freq:247.5 ]", + "[ 8/5 → 9/5 | freq:264 ]", + "[ 9/5 → 2/1 | freq:275 ]", + "[ 2/1 → 11/5 | freq:220 ]", + "[ 11/5 → 12/5 | freq:234.66666666666666 ]", + "[ 12/5 → 13/5 | freq:247.5 ]", + "[ 13/5 → 14/5 | freq:264 ]", + "[ 14/5 → 3/1 | freq:275 ]", + "[ 3/1 → 16/5 | freq:220 ]", + "[ 16/5 → 17/5 | freq:234.66666666666666 ]", + "[ 17/5 → 18/5 | freq:247.5 ]", + "[ 18/5 → 19/5 | freq:264 ]", + "[ 19/5 → 4/1 | freq:275 ]", +] +`; + exports[`runs examples > example "withValue" example index 0 1`] = ` [ "[ 0/1 → 1/3 | 10 ]",