doc: legato gain velocity

This commit is contained in:
Felix Roos 2022-09-25 22:39:16 +02:00
parent 69ce7c78a4
commit 04973d153b
3 changed files with 23 additions and 3 deletions

View File

@ -62,12 +62,12 @@ const generic_params = [
*/
['f', 'accelerate', 'a pattern of numbers that speed up (or slow down) samples while they play.'],
/**
* Like {@link amp}, but exponential.
* Controls the gain by an exponential amount.
*
* @name gain
* @param {number | Pattern} amount gain.
* @example
* s("bd*8").gain(".7*2 1 .7*2 1 .7 1").osc()
* s("hh*8").gain(".4!2 1 .4!2 1 .4 1").out()
*
*/
[

View File

@ -1271,11 +1271,27 @@ export class Pattern {
return this.withHapSpan((span) => new TimeSpan(span.begin, span.begin.add(value)));
}
// sets hap relative duration of haps
/**
*
* Multiplies the hap duration with the given factor.
* @name legato
* @memberof Pattern
* @example
* n("c3 eb3 g3 c4").legato("<.25 .5 1 2>").out()
*/
_legato(value) {
return this.withHapSpan((span) => new TimeSpan(span.begin, span.begin.add(span.end.sub(span.begin).mul(value))));
}
/**
*
* Sets the velocity from 0 to 1. Is multiplied together with gain.
* @name velocity
* @example
* s("hh*8")
* .gain(".4!2 1 .4!2 1 .4 1")
* .velocity(".4 1").out()
*/
_velocity(velocity) {
return this._withContext((context) => ({ ...context, velocity: (context.velocity || 1) * velocity }));
}

View File

@ -375,6 +375,10 @@ The sampler will always pick the closest matching sample for the current note!
Wether you're using a synth or a sample, you can apply these effects:
{{ 'gain' | jsdoc }}
{{ 'velocity' | jsdoc }}
{{ 'cutoff' | jsdoc }}
{{ 'resonance' | jsdoc }}