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)); 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) { Pattern.prototype._degradeBy = function (x) {
return this._degradeByWith(rand, x); return this._degradeByWith(rand, x);
}; };

View File

@ -450,6 +450,8 @@ Stacks the given pattern to the current pattern:
<MiniRepl tune={`"c4,eb4,g4".stack("bb4,d5")`} /> <MiniRepl tune={`"c4,eb4,g4".stack("bb4,d5")`} />
{{ 'Pattern.degradeBy' | jsdoc }}
## Tone API ## Tone API
To make the sounds more interesting, we can use Tone.js instruments ands effects. To make the sounds more interesting, we can use Tone.js instruments ands effects.