doc: degradeBy

This commit is contained in:
Felix Roos 2022-09-14 21:54:42 +02:00
parent 88e39d22f1
commit 8e61673bd6
2 changed files with 18 additions and 4 deletions

View File

@ -223,6 +223,18 @@ Pattern.prototype._degradeByWith = function (withPat, x) {
return this.fmap((a) => (_) => a).appLeft(withPat._filterValues((v) => v > x));
};
/**
* Randomly removes events from the pattern by a given amount.
* 0 = 0% chance of removal
* 1 = 100% chance of removal
*
* @name degradeBy
* @memberof Pattern
* @param {number} amount - a number between 0 and 1
* @returns Pattern
* @example
* s("hh*8").degradeBy(0.5).out()
*/
Pattern.prototype._degradeBy = function (x) {
return this._degradeByWith(rand, x);
};

View File

@ -177,11 +177,11 @@ In essence, the `x!n` is like a shortcut for `[x*n]@n`.
## Euclidian
Using round brackets, we can create rhythmical sub-divisions based on three parameters: beats, segments and offset.
The first parameter controls how may beats will be played.
The second parameter controls the total amount of segments the beats will be distributed over.
Using round brackets, we can create rhythmical sub-divisions based on three parameters: beats, segments and offset.
The first parameter controls how may beats will be played.
The second parameter controls the total amount of segments the beats will be distributed over.
The third (optional) parameter controls the starting position for distributing the beats.
One popular Euclidian rhythm (going by various names, such as "Pop Clave") is "(3,8,1)" or simply "(3,8)",
One popular Euclidian rhythm (going by various names, such as "Pop Clave") is "(3,8,1)" or simply "(3,8)",
resulting in a rhythmical structure of "x ~ ~ x ~ ~ x ~" (3 beats over 8 segments, starting on position 1).
<MiniRepl tune={`"e5(2,8) b4(3,8) d5(2,8) c5(3,8)".slow(4)`} />
@ -450,6 +450,8 @@ Stacks the given pattern to the current pattern:
<MiniRepl tune={`"c4,eb4,g4".stack("bb4,d5")`} />
{{ 'Pattern.degradeBy' | jsdoc }}
## Tone API
To make the sounds more interesting, we can use Tone.js instruments ands effects.