Skip to content

Commit

Permalink
Merge pull request #801 from ilesinge/add_doc
Browse files Browse the repository at this point in the history
Add doc for euclidLegatoRot, wordfall and slider
  • Loading branch information
felixroos committed Nov 17, 2023
2 parents 08ebb52 + a3bf697 commit b73ea7f
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/codemirror/slider.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,15 @@ export const sliderPlugin = ViewPlugin.fromClass(
},
);

/**
* Displays a slider widget to allow the user manipulate a value
*
* @name slider
* @param {number} value Initial value
* @param {number} min Minimum value - optional, defaults to 0
* @param {number} max Maximum value - optional, defaults to 1
* @param {number} step Step size - optional
*/
export let slider = (value) => {
console.warn('slider will only work when the transpiler is used... passing value as is');
return pure(value);
Expand Down
14 changes: 14 additions & 0 deletions packages/core/euclid.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ export const { euclidrot, euclidRot } = register(['euclidrot', 'euclidRot'], fun
* so there will be no gaps.
* @name euclidLegato
* @memberof Pattern
* @param {number} pulses the number of onsets / beats
* @param {number} steps the number of steps to fill
* @example
* n("g2").decay(.1).sustain(.3).euclidLegato(3,8)
*/
Expand All @@ -166,6 +168,18 @@ export const euclidLegato = register(['euclidLegato'], function (pulses, steps,
return _euclidLegato(pulses, steps, 0, pat);
});

/**
* Similar to `euclid`, but each pulse is held until the next pulse,
* so there will be no gaps, and has an additional parameter for 'rotating'
* the resulting sequence
* @name euclidLegatoRot
* @memberof Pattern
* @param {number} pulses the number of onsets / beats
* @param {number} steps the number of steps to fill
* @param {number} rotation offset in steps
* @example
* note("c3").euclidLegatoRot(3,5,2)
*/
export const euclidLegatoRot = register(['euclidLegatoRot'], function (pulses, steps, rotation, pat) {
return _euclidLegato(pulses, steps, rotation, pat);
});
6 changes: 6 additions & 0 deletions packages/core/pianoroll.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,12 @@ Pattern.prototype.punchcard = function (options) {
);
};

/**
* Displays a vertical pianoroll with event labels.
* Supports all the same options as pianoroll.
*
* @name wordfall
*/
Pattern.prototype.wordfall = function (options) {
return this.punchcard({ vertical: 1, labels: 1, stroke: 0, fillActive: 1, active: 'white', ...options });
};
Expand Down
17 changes: 17 additions & 0 deletions test/__snapshots__/examples.test.mjs.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1798,6 +1798,23 @@ exports[`runs examples > example "euclidLegato" example index 0 1`] = `
]
`;

exports[`runs examples > example "euclidLegatoRot" example index 0 1`] = `
[
"[ 0/1 → 1/4 | note:c3 ]",
"[ 1/4 → 3/4 | note:c3 ]",
"[ 3/4 → 1/1 | note:c3 ]",
"[ 1/1 → 5/4 | note:c3 ]",
"[ 5/4 → 7/4 | note:c3 ]",
"[ 7/4 → 2/1 | note:c3 ]",
"[ 2/1 → 9/4 | note:c3 ]",
"[ 9/4 → 11/4 | note:c3 ]",
"[ 11/4 → 3/1 | note:c3 ]",
"[ 3/1 → 13/4 | note:c3 ]",
"[ 13/4 → 15/4 | note:c3 ]",
"[ 15/4 → 4/1 | note:c3 ]",
]
`;

exports[`runs examples > example "euclidRot" example index 0 1`] = `
[
"[ 3/16 → 1/4 | note:c3 ]",
Expand Down

0 comments on commit b73ea7f

Please sign in to comment.