Merge pull request #1015 from ilesinge/document_signals

Document signals
This commit is contained in:
Felix Roos 2024-03-24 15:06:33 +01:00 committed by GitHub
commit 4086df95b7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 479 additions and 68 deletions

View File

@ -143,7 +143,24 @@ export const rand = signal(timeToRand);
export const rand2 = rand.toBipolar(); export const rand2 = rand.toBipolar();
export const _brandBy = (p) => rand.fmap((x) => x < p); export const _brandBy = (p) => rand.fmap((x) => x < p);
/**
* A continuous pattern of 0 or 1 (binary random), with a probability for the value being 1
*
* @name brandBy
* @param {number} probability - a number between 0 and 1
* @example
* s("hh*10").pan(brandBy(0.2))
*/
export const brandBy = (pPat) => reify(pPat).fmap(_brandBy).innerJoin(); export const brandBy = (pPat) => reify(pPat).fmap(_brandBy).innerJoin();
/**
* A continuous pattern of 0 or 1 (binary random)
*
* @name brand
* @example
* s("hh*10").pan(brand)
*/
export const brand = _brandBy(0.5); export const brand = _brandBy(0.5);
export const _irand = (i) => rand.fmap((x) => Math.trunc(x * i)); export const _irand = (i) => rand.fmap((x) => Math.trunc(x * i));
@ -397,6 +414,8 @@ export const chooseInWith = (pat, xs) => {
* Chooses randomly from the given list of elements. * Chooses randomly from the given list of elements.
* @param {...any} xs values / patterns to choose from. * @param {...any} xs values / patterns to choose from.
* @returns {Pattern} - a continuous pattern. * @returns {Pattern} - a continuous pattern.
* @example
* note("c2 g2!2 d2 f1").s(choose("sine", "triangle", "bd:6"))
*/ */
export const choose = (...xs) => chooseWith(rand, xs); export const choose = (...xs) => chooseWith(rand, xs);
@ -423,6 +442,7 @@ Pattern.prototype.choose2 = function (...xs) {
/** /**
* Picks one of the elements at random each cycle. * Picks one of the elements at random each cycle.
* @synonyms randcat
* @returns {Pattern} * @returns {Pattern}
* @example * @example
* chooseCycles("bd", "hh", "sd").s().fast(8) * chooseCycles("bd", "hh", "sd").s().fast(8)
@ -451,10 +471,26 @@ const _wchooseWith = function (pat, ...pairs) {
const wchooseWith = (...args) => _wchooseWith(...args).outerJoin(); const wchooseWith = (...args) => _wchooseWith(...args).outerJoin();
/**
* Chooses randomly from the given list of elements by giving a probability to each element
* @param {...any} pairs arrays of value and weight
* @returns {Pattern} - a continuous pattern.
* @example
* note("c2 g2!2 d2 f1").s(wchoose(["sine",10], ["triangle",1], ["bd:6",1]))
*/
export const wchoose = (...pairs) => wchooseWith(rand, ...pairs); export const wchoose = (...pairs) => wchooseWith(rand, ...pairs);
/**
* Picks one of the elements at random each cycle by giving a probability to each element
* @synonyms wrandcat
* @returns {Pattern}
* @example
* wchooseCycles(["bd",10], ["hh",1], ["sd",1]).s().fast(8)
*/
export const wchooseCycles = (...pairs) => _wchooseWith(rand, ...pairs).innerJoin(); export const wchooseCycles = (...pairs) => _wchooseWith(rand, ...pairs).innerJoin();
export const wrandcat = wchooseCycles;
// this function expects pat to be a pattern of floats... // this function expects pat to be a pattern of floats...
export const perlinWith = (pat) => { export const perlinWith = (pat) => {
const pata = pat.fmap(Math.floor); const pata = pat.fmap(Math.floor);
@ -523,6 +559,11 @@ export const degrade = register('degrade', (pat) => pat._degradeBy(0.5));
* @returns Pattern * @returns Pattern
* @example * @example
* s("hh*8").undegradeBy(0.2) * s("hh*8").undegradeBy(0.2)
* @example
* s("hh*10").layer(
* x => x.degradeBy(0.2).pan(0),
* x => x.undegradeBy(0.8).pan(1)
* )
*/ */
export const undegradeBy = register('undegradeBy', function (x, pat) { export const undegradeBy = register('undegradeBy', function (x, pat) {
return pat._degradeByWith( return pat._degradeByWith(
@ -531,6 +572,21 @@ export const undegradeBy = register('undegradeBy', function (x, pat) {
); );
}); });
/**
* Inverse of `degrade`: Randomly removes 50% of events from the pattern. Shorthand for `.undegradeBy(0.5)`
* Events that would be removed by degrade are let through by undegrade and vice versa (see second example).
*
* @name undegrade
* @memberof Pattern
* @returns Pattern
* @example
* s("hh*8").undegrade()
* @example
* s("hh*10").layer(
* x => x.degrade().pan(0),
* x => x.undegrade().pan(1)
* )
*/
export const undegrade = register('undegrade', (pat) => pat._undegradeBy(0.5)); export const undegrade = register('undegrade', (pat) => pat._undegradeBy(0.5));
/** /**

View File

@ -1163,6 +1163,96 @@ exports[`runs examples > example "bpsustain" example index 0 1`] = `
] ]
`; `;
exports[`runs examples > example "brand" example index 0 1`] = `
[
"[ 0/1 → 1/10 | s:hh pan:false ]",
"[ 1/10 → 1/5 | s:hh pan:false ]",
"[ 1/5 → 3/10 | s:hh pan:true ]",
"[ 3/10 → 2/5 | s:hh pan:true ]",
"[ 2/5 → 1/2 | s:hh pan:false ]",
"[ 1/2 → 3/5 | s:hh pan:true ]",
"[ 3/5 → 7/10 | s:hh pan:false ]",
"[ 7/10 → 4/5 | s:hh pan:true ]",
"[ 4/5 → 9/10 | s:hh pan:false ]",
"[ 9/10 → 1/1 | s:hh pan:true ]",
"[ 1/1 → 11/10 | s:hh pan:true ]",
"[ 11/10 → 6/5 | s:hh pan:false ]",
"[ 6/5 → 13/10 | s:hh pan:false ]",
"[ 13/10 → 7/5 | s:hh pan:false ]",
"[ 7/5 → 3/2 | s:hh pan:true ]",
"[ 3/2 → 8/5 | s:hh pan:true ]",
"[ 8/5 → 17/10 | s:hh pan:true ]",
"[ 17/10 → 9/5 | s:hh pan:true ]",
"[ 9/5 → 19/10 | s:hh pan:true ]",
"[ 19/10 → 2/1 | s:hh pan:false ]",
"[ 2/1 → 21/10 | s:hh pan:false ]",
"[ 21/10 → 11/5 | s:hh pan:false ]",
"[ 11/5 → 23/10 | s:hh pan:true ]",
"[ 23/10 → 12/5 | s:hh pan:false ]",
"[ 12/5 → 5/2 | s:hh pan:false ]",
"[ 5/2 → 13/5 | s:hh pan:false ]",
"[ 13/5 → 27/10 | s:hh pan:false ]",
"[ 27/10 → 14/5 | s:hh pan:false ]",
"[ 14/5 → 29/10 | s:hh pan:true ]",
"[ 29/10 → 3/1 | s:hh pan:true ]",
"[ 3/1 → 31/10 | s:hh pan:true ]",
"[ 31/10 → 16/5 | s:hh pan:true ]",
"[ 16/5 → 33/10 | s:hh pan:false ]",
"[ 33/10 → 17/5 | s:hh pan:false ]",
"[ 17/5 → 7/2 | s:hh pan:false ]",
"[ 7/2 → 18/5 | s:hh pan:true ]",
"[ 18/5 → 37/10 | s:hh pan:true ]",
"[ 37/10 → 19/5 | s:hh pan:false ]",
"[ 19/5 → 39/10 | s:hh pan:false ]",
"[ 39/10 → 4/1 | s:hh pan:true ]",
]
`;
exports[`runs examples > example "brandBy" example index 0 1`] = `
[
"[ 0/1 → 1/10 | s:hh pan:false ]",
"[ 1/10 → 1/5 | s:hh pan:false ]",
"[ 1/5 → 3/10 | s:hh pan:false ]",
"[ 3/10 → 2/5 | s:hh pan:false ]",
"[ 2/5 → 1/2 | s:hh pan:false ]",
"[ 1/2 → 3/5 | s:hh pan:false ]",
"[ 3/5 → 7/10 | s:hh pan:false ]",
"[ 7/10 → 4/5 | s:hh pan:true ]",
"[ 4/5 → 9/10 | s:hh pan:false ]",
"[ 9/10 → 1/1 | s:hh pan:true ]",
"[ 1/1 → 11/10 | s:hh pan:true ]",
"[ 11/10 → 6/5 | s:hh pan:false ]",
"[ 6/5 → 13/10 | s:hh pan:false ]",
"[ 13/10 → 7/5 | s:hh pan:false ]",
"[ 7/5 → 3/2 | s:hh pan:false ]",
"[ 3/2 → 8/5 | s:hh pan:true ]",
"[ 8/5 → 17/10 | s:hh pan:true ]",
"[ 17/10 → 9/5 | s:hh pan:false ]",
"[ 9/5 → 19/10 | s:hh pan:false ]",
"[ 19/10 → 2/1 | s:hh pan:false ]",
"[ 2/1 → 21/10 | s:hh pan:false ]",
"[ 21/10 → 11/5 | s:hh pan:false ]",
"[ 11/5 → 23/10 | s:hh pan:false ]",
"[ 23/10 → 12/5 | s:hh pan:false ]",
"[ 12/5 → 5/2 | s:hh pan:false ]",
"[ 5/2 → 13/5 | s:hh pan:false ]",
"[ 13/5 → 27/10 | s:hh pan:false ]",
"[ 27/10 → 14/5 | s:hh pan:false ]",
"[ 14/5 → 29/10 | s:hh pan:false ]",
"[ 29/10 → 3/1 | s:hh pan:false ]",
"[ 3/1 → 31/10 | s:hh pan:false ]",
"[ 31/10 → 16/5 | s:hh pan:true ]",
"[ 16/5 → 33/10 | s:hh pan:false ]",
"[ 33/10 → 17/5 | s:hh pan:false ]",
"[ 17/5 → 7/2 | s:hh pan:false ]",
"[ 7/2 → 18/5 | s:hh pan:false ]",
"[ 18/5 → 37/10 | s:hh pan:false ]",
"[ 37/10 → 19/5 | s:hh pan:false ]",
"[ 19/5 → 39/10 | s:hh pan:false ]",
"[ 39/10 → 4/1 | s:hh pan:true ]",
]
`;
exports[`runs examples > example "cat" example index 0 1`] = ` exports[`runs examples > example "cat" example index 0 1`] = `
[ [
"[ 0/1 → 1/4 | s:hh ]", "[ 0/1 → 1/4 | s:hh ]",
@ -1242,6 +1332,31 @@ exports[`runs examples > example "channels" example index 0 1`] = `
] ]
`; `;
exports[`runs examples > example "choose" example index 0 1`] = `
[
"[ 0/1 → 1/5 | note:c2 s:sine ]",
"[ 1/5 → 2/5 | note:g2 s:bd n:6 ]",
"[ 2/5 → 3/5 | note:g2 s:sine ]",
"[ 3/5 → 4/5 | note:d2 s:triangle ]",
"[ 4/5 → 1/1 | note:f1 s:bd n:6 ]",
"[ 1/1 → 6/5 | note:c2 s:bd n:6 ]",
"[ 6/5 → 7/5 | note:g2 s:triangle ]",
"[ 7/5 → 8/5 | note:g2 s:triangle ]",
"[ 8/5 → 9/5 | note:d2 s:sine ]",
"[ 9/5 → 2/1 | note:f1 s:sine ]",
"[ 2/1 → 11/5 | note:c2 s:triangle ]",
"[ 11/5 → 12/5 | note:g2 s:bd n:6 ]",
"[ 12/5 → 13/5 | note:g2 s:triangle ]",
"[ 13/5 → 14/5 | note:d2 s:sine ]",
"[ 14/5 → 3/1 | note:f1 s:triangle ]",
"[ 3/1 → 16/5 | note:c2 s:sine ]",
"[ 16/5 → 17/5 | note:g2 s:bd n:6 ]",
"[ 17/5 → 18/5 | note:g2 s:triangle ]",
"[ 18/5 → 19/5 | note:d2 s:triangle ]",
"[ 19/5 → 4/1 | note:f1 s:sine ]",
]
`;
exports[`runs examples > example "chooseCycles" example index 0 1`] = ` exports[`runs examples > example "chooseCycles" example index 0 1`] = `
[ [
"[ 0/1 → 1/8 | s:bd ]", "[ 0/1 → 1/8 | s:bd ]",
@ -7321,6 +7436,73 @@ exports[`runs examples > example "tri" example index 0 1`] = `
] ]
`; `;
exports[`runs examples > example "undegrade" example index 0 1`] = `
[
"[ 1/8 → 1/4 | s:hh ]",
"[ 3/8 → 1/2 | s:hh ]",
"[ 1/2 → 5/8 | s:hh ]",
"[ 5/8 → 3/4 | s:hh ]",
"[ 9/8 → 5/4 | s:hh ]",
"[ 5/4 → 11/8 | s:hh ]",
"[ 3/2 → 13/8 | s:hh ]",
"[ 13/8 → 7/4 | s:hh ]",
"[ 7/4 → 15/8 | s:hh ]",
"[ 2/1 → 17/8 | s:hh ]",
"[ 17/8 → 9/4 | s:hh ]",
"[ 19/8 → 5/2 | s:hh ]",
"[ 23/8 → 3/1 | s:hh ]",
"[ 3/1 → 25/8 | s:hh ]",
"[ 13/4 → 27/8 | s:hh ]",
"[ 15/4 → 31/8 | s:hh ]",
"[ 31/8 → 4/1 | s:hh ]",
]
`;
exports[`runs examples > example "undegrade" example index 1 1`] = `
[
"[ 0/1 → 1/10 | s:hh pan:0 ]",
"[ 1/10 → 1/5 | s:hh pan:0 ]",
"[ 1/5 → 3/10 | s:hh pan:1 ]",
"[ 3/10 → 2/5 | s:hh pan:1 ]",
"[ 2/5 → 1/2 | s:hh pan:0 ]",
"[ 1/2 → 3/5 | s:hh pan:1 ]",
"[ 3/5 → 7/10 | s:hh pan:0 ]",
"[ 7/10 → 4/5 | s:hh pan:1 ]",
"[ 4/5 → 9/10 | s:hh pan:0 ]",
"[ 9/10 → 1/1 | s:hh pan:1 ]",
"[ 1/1 → 11/10 | s:hh pan:1 ]",
"[ 11/10 → 6/5 | s:hh pan:0 ]",
"[ 6/5 → 13/10 | s:hh pan:0 ]",
"[ 13/10 → 7/5 | s:hh pan:0 ]",
"[ 7/5 → 3/2 | s:hh pan:1 ]",
"[ 3/2 → 8/5 | s:hh pan:1 ]",
"[ 8/5 → 17/10 | s:hh pan:1 ]",
"[ 17/10 → 9/5 | s:hh pan:1 ]",
"[ 9/5 → 19/10 | s:hh pan:1 ]",
"[ 19/10 → 2/1 | s:hh pan:0 ]",
"[ 2/1 → 21/10 | s:hh pan:0 ]",
"[ 21/10 → 11/5 | s:hh pan:0 ]",
"[ 11/5 → 23/10 | s:hh pan:1 ]",
"[ 23/10 → 12/5 | s:hh pan:0 ]",
"[ 12/5 → 5/2 | s:hh pan:0 ]",
"[ 5/2 → 13/5 | s:hh pan:0 ]",
"[ 13/5 → 27/10 | s:hh pan:0 ]",
"[ 27/10 → 14/5 | s:hh pan:0 ]",
"[ 14/5 → 29/10 | s:hh pan:1 ]",
"[ 29/10 → 3/1 | s:hh pan:1 ]",
"[ 3/1 → 31/10 | s:hh pan:1 ]",
"[ 31/10 → 16/5 | s:hh pan:1 ]",
"[ 16/5 → 33/10 | s:hh pan:0 ]",
"[ 33/10 → 17/5 | s:hh pan:0 ]",
"[ 17/5 → 7/2 | s:hh pan:0 ]",
"[ 7/2 → 18/5 | s:hh pan:1 ]",
"[ 18/5 → 37/10 | s:hh pan:1 ]",
"[ 37/10 → 19/5 | s:hh pan:0 ]",
"[ 19/5 → 39/10 | s:hh pan:0 ]",
"[ 39/10 → 4/1 | s:hh pan:1 ]",
]
`;
exports[`runs examples > example "undegradeBy" example index 0 1`] = ` exports[`runs examples > example "undegradeBy" example index 0 1`] = `
[ [
"[ 1/8 → 1/4 | s:hh ]", "[ 1/8 → 1/4 | s:hh ]",
@ -7352,6 +7534,51 @@ exports[`runs examples > example "undegradeBy" example index 0 1`] = `
] ]
`; `;
exports[`runs examples > example "undegradeBy" example index 1 1`] = `
[
"[ 0/1 → 1/10 | s:hh pan:0 ]",
"[ 1/10 → 1/5 | s:hh pan:0 ]",
"[ 1/5 → 3/10 | s:hh pan:0 ]",
"[ 3/10 → 2/5 | s:hh pan:0 ]",
"[ 2/5 → 1/2 | s:hh pan:0 ]",
"[ 1/2 → 3/5 | s:hh pan:0 ]",
"[ 3/5 → 7/10 | s:hh pan:0 ]",
"[ 7/10 → 4/5 | s:hh pan:1 ]",
"[ 4/5 → 9/10 | s:hh pan:0 ]",
"[ 9/10 → 1/1 | s:hh pan:1 ]",
"[ 1/1 → 11/10 | s:hh pan:1 ]",
"[ 11/10 → 6/5 | s:hh pan:0 ]",
"[ 6/5 → 13/10 | s:hh pan:0 ]",
"[ 13/10 → 7/5 | s:hh pan:0 ]",
"[ 7/5 → 3/2 | s:hh pan:0 ]",
"[ 3/2 → 8/5 | s:hh pan:1 ]",
"[ 8/5 → 17/10 | s:hh pan:1 ]",
"[ 17/10 → 9/5 | s:hh pan:0 ]",
"[ 9/5 → 19/10 | s:hh pan:0 ]",
"[ 19/10 → 2/1 | s:hh pan:0 ]",
"[ 2/1 → 21/10 | s:hh pan:0 ]",
"[ 21/10 → 11/5 | s:hh pan:0 ]",
"[ 11/5 → 23/10 | s:hh pan:0 ]",
"[ 23/10 → 12/5 | s:hh pan:0 ]",
"[ 12/5 → 5/2 | s:hh pan:0 ]",
"[ 5/2 → 13/5 | s:hh pan:0 ]",
"[ 13/5 → 27/10 | s:hh pan:0 ]",
"[ 27/10 → 14/5 | s:hh pan:0 ]",
"[ 14/5 → 29/10 | s:hh pan:0 ]",
"[ 29/10 → 3/1 | s:hh pan:0 ]",
"[ 3/1 → 31/10 | s:hh pan:0 ]",
"[ 31/10 → 16/5 | s:hh pan:1 ]",
"[ 16/5 → 33/10 | s:hh pan:0 ]",
"[ 33/10 → 17/5 | s:hh pan:0 ]",
"[ 17/5 → 7/2 | s:hh pan:0 ]",
"[ 7/2 → 18/5 | s:hh pan:0 ]",
"[ 18/5 → 37/10 | s:hh pan:0 ]",
"[ 37/10 → 19/5 | s:hh pan:0 ]",
"[ 19/5 → 39/10 | s:hh pan:0 ]",
"[ 39/10 → 4/1 | s:hh pan:1 ]",
]
`;
exports[`runs examples > example "unison" example index 0 1`] = ` exports[`runs examples > example "unison" example index 0 1`] = `
[ [
"[ 0/1 → 1/12 | note:d s:supersaw unison:1 ]", "[ 0/1 → 1/12 | note:d s:supersaw unison:1 ]",
@ -7619,6 +7846,68 @@ exports[`runs examples > example "vowel" example index 1 1`] = `
] ]
`; `;
exports[`runs examples > example "wchoose" example index 0 1`] = `
[
"[ 0/1 → 1/5 | note:c2 s:sine ]",
"[ 1/5 → 2/5 | note:g2 s:triangle ]",
"[ 2/5 → 3/5 | note:g2 s:sine ]",
"[ 3/5 → 4/5 | note:d2 s:sine ]",
"[ 4/5 → 1/1 | note:f1 s:triangle ]",
"[ 1/1 → 6/5 | note:c2 s:triangle ]",
"[ 6/5 → 7/5 | note:g2 s:sine ]",
"[ 7/5 → 8/5 | note:g2 s:sine ]",
"[ 8/5 → 9/5 | note:d2 s:sine ]",
"[ 9/5 → 2/1 | note:f1 s:sine ]",
"[ 2/1 → 11/5 | note:c2 s:sine ]",
"[ 11/5 → 12/5 | note:g2 s:sine ]",
"[ 12/5 → 13/5 | note:g2 s:sine ]",
"[ 13/5 → 14/5 | note:d2 s:sine ]",
"[ 14/5 → 3/1 | note:f1 s:sine ]",
"[ 3/1 → 16/5 | note:c2 s:sine ]",
"[ 16/5 → 17/5 | note:g2 s:sine ]",
"[ 17/5 → 18/5 | note:g2 s:sine ]",
"[ 18/5 → 19/5 | note:d2 s:sine ]",
"[ 19/5 → 4/1 | note:f1 s:sine ]",
]
`;
exports[`runs examples > example "wchooseCycles" example index 0 1`] = `
[
"[ 0/1 → 1/8 | s:bd ]",
"[ 1/8 → 1/4 | s:bd ]",
"[ 1/4 → 3/8 | s:bd ]",
"[ 3/8 → 1/2 | s:bd ]",
"[ 1/2 → 5/8 | s:bd ]",
"[ 5/8 → 3/4 | s:bd ]",
"[ 3/4 → 7/8 | s:bd ]",
"[ 7/8 → 1/1 | s:bd ]",
"[ 1/1 → 9/8 | s:bd ]",
"[ 9/8 → 5/4 | s:bd ]",
"[ 5/4 → 11/8 | s:bd ]",
"[ 11/8 → 3/2 | s:bd ]",
"[ 3/2 → 13/8 | s:bd ]",
"[ 13/8 → 7/4 | s:bd ]",
"[ 7/4 → 15/8 | s:bd ]",
"[ 15/8 → 2/1 | s:bd ]",
"[ 2/1 → 17/8 | s:bd ]",
"[ 17/8 → 9/4 | s:bd ]",
"[ 9/4 → 19/8 | s:bd ]",
"[ 19/8 → 5/2 | s:bd ]",
"[ 5/2 → 21/8 | s:bd ]",
"[ 21/8 → 11/4 | s:bd ]",
"[ 11/4 → 23/8 | s:bd ]",
"[ 23/8 → 3/1 | s:bd ]",
"[ 3/1 → 25/8 | s:bd ]",
"[ 25/8 → 13/4 | s:bd ]",
"[ 13/4 → 27/8 | s:bd ]",
"[ 27/8 → 7/2 | s:bd ]",
"[ 7/2 → 29/8 | s:bd ]",
"[ 29/8 → 15/4 | s:bd ]",
"[ 15/4 → 31/8 | s:bd ]",
"[ 31/8 → 4/1 | s:bd ]",
]
`;
exports[`runs examples > example "when" example index 0 1`] = ` exports[`runs examples > example "when" example index 0 1`] = `
[ [
"[ 0/1 → 1/3 | note:c3 ]", "[ 0/1 → 1/3 | note:c3 ]",

View File

@ -380,6 +380,7 @@
"bjork", "bjork",
"euclidrot" "euclidrot"
], ],
"/packages/core/zyklus.mjs": [],
"/packages/core/signal.mjs": [ "/packages/core/signal.mjs": [
"steady", "steady",
"signal", "signal",
@ -392,18 +393,14 @@
"tri2", "tri2",
"time", "time",
"_brandBy", "_brandBy",
"brandBy",
"brand",
"_irand", "_irand",
"pickSqueeze", "pickSqueeze",
"pickmodSqueeze", "pickmodSqueeze",
"__chooseWith", "__chooseWith",
"randcat", "randcat",
"wchoose", "wrandcat",
"wchooseCycles",
"perlinWith", "perlinWith",
"degradeByWith", "degradeByWith"
"undegrade"
], ],
"/packages/core/speak.mjs": [ "/packages/core/speak.mjs": [
"speak" "speak"
@ -415,7 +412,6 @@
"/packages/core/neocyclist.mjs": [ "/packages/core/neocyclist.mjs": [
"NeoCyclist" "NeoCyclist"
], ],
"/packages/core/zyklus.mjs": [],
"/packages/core/cyclist.mjs": [ "/packages/core/cyclist.mjs": [
"Cyclist" "Cyclist"
], ],

View File

@ -90,6 +90,7 @@ export const SIDEBAR: Sidebar = {
{ text: 'Time Modifiers', link: 'learn/time-modifiers' }, { text: 'Time Modifiers', link: 'learn/time-modifiers' },
{ text: 'Control Parameters', link: 'functions/value-modifiers' }, { text: 'Control Parameters', link: 'functions/value-modifiers' },
{ text: 'Signals', link: 'learn/signals' }, { text: 'Signals', link: 'learn/signals' },
{ text: 'Random Modifiers', link: 'learn/random-modifiers' },
{ text: 'Conditional Modifiers', link: 'learn/conditional-modifiers' }, { text: 'Conditional Modifiers', link: 'learn/conditional-modifiers' },
{ text: 'Accumulation', link: 'learn/accumulation' }, { text: 'Accumulation', link: 'learn/accumulation' },
{ text: 'Tonal Functions', link: 'learn/tonal' }, { text: 'Tonal Functions', link: 'learn/tonal' },

View File

@ -68,6 +68,42 @@ import { JsDoc } from '../../docs/JsDoc';
<JsDoc client:idle name="pick" h={0} /> <JsDoc client:idle name="pick" h={0} />
## pickmod
<JsDoc client:idle name="pickmod" h={0} />
## pickF
<JsDoc client:idle name="pickF" h={0} />
## pickmodF
<JsDoc client:idle name="pickmodF" h={0} />
## pickRestart
<JsDoc client:idle name="pickRestart" h={0} />
## pickmodRestart
<JsDoc client:idle name="pickmodRestart" h={0} />
## pickReset
<JsDoc client:idle name="pickReset" h={0} />
## pickmodReset
<JsDoc client:idle name="pickmodReset" h={0} />
## inhabit
<JsDoc client:idle name="inhabit" h={0} />
## inhabitmod
<JsDoc client:idle name="inhabitmod" h={0} />
## squeeze ## squeeze
<JsDoc client:idle name="squeeze" h={0} /> <JsDoc client:idle name="squeeze" h={0} />

View File

@ -0,0 +1,85 @@
---
title: Random Modifiers
layout: ../../layouts/MainLayout.astro
---
import { MiniRepl } from '../../docs/MiniRepl';
import { JsDoc } from '../../docs/JsDoc';
# Random Modifiers
These methods add random behavior to your Patterns.
## choose
<JsDoc client:idle name="choose" h={0} />
## wchoose
<JsDoc client:idle name="wchoose" h={0} />
## chooseCycles
<JsDoc client:idle name="chooseCycles" h={0} />
## wchooseCycles
<JsDoc client:idle name="wchooseCycles" h={0} />
## degradeBy
<JsDoc client:idle name="Pattern.degradeBy" h={0} />
## degrade
<JsDoc client:idle name="Pattern.degrade" h={0} />
## undegradeBy
<JsDoc client:idle name="Pattern.undegradeBy" h={0} />
## undegrade
<JsDoc client:idle name="Pattern.undegrade" h={0} />
## sometimesBy
<JsDoc client:idle name="Pattern.sometimesBy" h={0} />
## sometimes
<JsDoc client:idle name="Pattern.sometimes" h={0} />
## someCyclesBy
<JsDoc client:idle name="Pattern.someCyclesBy" h={0} />
## someCycles
<JsDoc client:idle name="Pattern.someCycles" h={0} />
## often
<JsDoc client:idle name="Pattern.often" h={0} />
## rarely
<JsDoc client:idle name="Pattern.rarely" h={0} />
## almostNever
<JsDoc client:idle name="Pattern.almostNever" h={0} />
## almostAlways
<JsDoc client:idle name="Pattern.almostAlways" h={0} />
## never
<JsDoc client:idle name="Pattern.never" h={0} />
## always
<JsDoc client:idle name="Pattern.always" h={0} />
Next up: [Conditional Modifiers](/learn/conditional-modifiers)

View File

@ -31,14 +31,14 @@ They can provide streams of numbers that can be sampled at discrete points in ti
<JsDoc client:idle name="square" h={0} /> <JsDoc client:idle name="square" h={0} />
## Ranges from -1 to 1
There is also `saw2`, `sine2`, `cosine2`, `tri2` and `square2` which have a range from -1 to 1!
## rand ## rand
<JsDoc client:idle name="rand" h={0} /> <JsDoc client:idle name="rand" h={0} />
## Ranges from -1 to 1
There is also `saw2`, `sine2`, `cosine2`, `tri2`, `square2` and `rand2` which have a range from -1 to 1!
## perlin ## perlin
<JsDoc client:idle name="perlin" h={0} /> <JsDoc client:idle name="perlin" h={0} />
@ -47,64 +47,12 @@ There is also `saw2`, `sine2`, `cosine2`, `tri2` and `square2` which have a rang
<JsDoc client:idle name="irand" h={0} /> <JsDoc client:idle name="irand" h={0} />
# Random Modifiers ## brand
These methods add random behavior to your Patterns. <JsDoc client:idle name="brand" h={0} />
## chooseCycles ## brandBy
<JsDoc client:idle name="chooseCycles" h={0} /> <JsDoc client:idle name="brandBy" h={0} />
## degradeBy Next up: [Random Modifiers](/learn/random-modifiers)
<JsDoc client:idle name="Pattern.degradeBy" h={0} />
## degrade
<JsDoc client:idle name="Pattern.degrade" h={0} />
## undegradeBy
<JsDoc client:idle name="Pattern.undegradeBy" h={0} />
## sometimesBy
<JsDoc client:idle name="Pattern.sometimesBy" h={0} />
## sometimes
<JsDoc client:idle name="Pattern.sometimes" h={0} />
## someCyclesBy
<JsDoc client:idle name="Pattern.someCyclesBy" h={0} />
## someCycles
<JsDoc client:idle name="Pattern.someCycles" h={0} />
## often
<JsDoc client:idle name="Pattern.often" h={0} />
## rarely
<JsDoc client:idle name="Pattern.rarely" h={0} />
## almostNever
<JsDoc client:idle name="Pattern.almostNever" h={0} />
## almostAlways
<JsDoc client:idle name="Pattern.almostAlways" h={0} />
## never
<JsDoc client:idle name="Pattern.never" h={0} />
## always
<JsDoc client:idle name="Pattern.always" h={0} />
Next up: [Conditional Modifiers](/learn/conditional-modifiers)