diff --git a/packages/core/signal.mjs b/packages/core/signal.mjs index a13674f1..28fc491e 100644 --- a/packages/core/signal.mjs +++ b/packages/core/signal.mjs @@ -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); }; diff --git a/tutorial/tutorial.mdx b/tutorial/tutorial.mdx index f8995a33..e95ea5fe 100644 --- a/tutorial/tutorial.mdx +++ b/tutorial/tutorial.mdx @@ -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). @@ -450,6 +450,8 @@ Stacks the given pattern to the current pattern: +{{ 'Pattern.degradeBy' | jsdoc }} + ## Tone API To make the sounds more interesting, we can use Tone.js instruments ands effects.