Make example more concise

This commit is contained in:
Luke Heerman 2024-10-10 14:39:45 -04:00
parent 0d660277f6
commit 0a408e464a
2 changed files with 43 additions and 2 deletions

View File

@ -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;

View File

@ -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 ]",