Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add doc for euclidLegatoRot, wordfall and slider #801

Merged
merged 5 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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