From 0a408e464a7c9b32f0ba2c56081d5d0d919787a3 Mon Sep 17 00:00:00 2001 From: Luke Heerman <43624284+heerman@users.noreply.github.com> Date: Thu, 10 Oct 2024 14:39:45 -0400 Subject: [PATCH] Make example more concise --- packages/core/signal.mjs | 4 +-- test/__snapshots__/examples.test.mjs.snap | 41 +++++++++++++++++++++++ 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/packages/core/signal.mjs b/packages/core/signal.mjs index 8d033499..8340bc9f 100644 --- a/packages/core/signal.mjs +++ b/packages/core/signal.mjs @@ -162,8 +162,8 @@ export const run = (n) => saw.range(0, n).floor().segment(n); /** * A discrete binary pattern using a decimal/hex number as input * @example - * "c a f e".struct(binary(0xA5B5)).note().piano() - * // "c a f e".struct("0 1 0 1 0 1 0 1 1 0 1 0 1").note().piano() + * "hh".s().struct(binary(55532)) + * // "hh".s().struct("1 1 0 1 1 0 0 0 1 1 1 0 1 1 0 0") */ export const binary = (n) => { const binLen = 16; diff --git a/test/__snapshots__/examples.test.mjs.snap b/test/__snapshots__/examples.test.mjs.snap index 3ad6ea01..fd7169c5 100644 --- a/test/__snapshots__/examples.test.mjs.snap +++ b/test/__snapshots__/examples.test.mjs.snap @@ -967,6 +967,47 @@ exports[`runs examples > example "begin" example index 0 1`] = ` ] `; +exports[`runs examples > example "binary" example index 0 1`] = ` +[ + "[ 0/1 → 1/16 | s:hh ]", + "[ 1/16 → 1/8 | s:hh ]", + "[ 3/16 → 1/4 | s:hh ]", + "[ 1/4 → 5/16 | s:hh ]", + "[ 1/2 → 9/16 | s:hh ]", + "[ 9/16 → 5/8 | s:hh ]", + "[ 5/8 → 11/16 | s:hh ]", + "[ 3/4 → 13/16 | s:hh ]", + "[ 13/16 → 7/8 | s:hh ]", + "[ 1/1 → 17/16 | s:hh ]", + "[ 17/16 → 9/8 | s:hh ]", + "[ 19/16 → 5/4 | s:hh ]", + "[ 5/4 → 21/16 | s:hh ]", + "[ 3/2 → 25/16 | s:hh ]", + "[ 25/16 → 13/8 | s:hh ]", + "[ 13/8 → 27/16 | s:hh ]", + "[ 7/4 → 29/16 | s:hh ]", + "[ 29/16 → 15/8 | s:hh ]", + "[ 2/1 → 33/16 | s:hh ]", + "[ 33/16 → 17/8 | s:hh ]", + "[ 35/16 → 9/4 | s:hh ]", + "[ 9/4 → 37/16 | s:hh ]", + "[ 5/2 → 41/16 | s:hh ]", + "[ 41/16 → 21/8 | s:hh ]", + "[ 21/8 → 43/16 | s:hh ]", + "[ 11/4 → 45/16 | s:hh ]", + "[ 45/16 → 23/8 | s:hh ]", + "[ 3/1 → 49/16 | s:hh ]", + "[ 49/16 → 25/8 | s:hh ]", + "[ 51/16 → 13/4 | s:hh ]", + "[ 13/4 → 53/16 | s:hh ]", + "[ 7/2 → 57/16 | s:hh ]", + "[ 57/16 → 29/8 | s:hh ]", + "[ 29/8 → 59/16 | s:hh ]", + "[ 15/4 → 61/16 | s:hh ]", + "[ 61/16 → 31/8 | s:hh ]", +] +`; + exports[`runs examples > example "bite" example index 0 1`] = ` [ "[ 0/1 → 1/8 | note:Bb3 ]",