From 04973d153b9e9c8a4a1b8d553c3c31be58f457fa Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sun, 25 Sep 2022 22:39:16 +0200 Subject: [PATCH] doc: legato gain velocity --- packages/core/controls.mjs | 4 ++-- packages/core/pattern.mjs | 18 +++++++++++++++++- tutorial/tutorial.mdx | 4 ++++ 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/packages/core/controls.mjs b/packages/core/controls.mjs index 6e34c3d0..f8dfd6c0 100644 --- a/packages/core/controls.mjs +++ b/packages/core/controls.mjs @@ -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() * */ [ diff --git a/packages/core/pattern.mjs b/packages/core/pattern.mjs index a537650f..d50a821e 100644 --- a/packages/core/pattern.mjs +++ b/packages/core/pattern.mjs @@ -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 })); } diff --git a/tutorial/tutorial.mdx b/tutorial/tutorial.mdx index 92a63709..3f36c469 100644 --- a/tutorial/tutorial.mdx +++ b/tutorial/tutorial.mdx @@ -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 }}