docs: envelope functions

This commit is contained in:
Felix Roos 2022-12-23 17:57:01 +01:00
parent 243a350e2b
commit 63fffd7493

View File

@ -51,6 +51,7 @@ const generic_params = [
* *
* @name accelerate * @name accelerate
* @param {number | Pattern} amount acceleration. * @param {number | Pattern} amount acceleration.
* @superdirtOnly
* @example * @example
* s("sax").accelerate("<0 1 2 4 8 16>").slow(2).osc() * s("sax").accelerate("<0 1 2 4 8 16>").slow(2).osc()
* *
@ -75,19 +76,20 @@ const generic_params = [
* *
* @name amp * @name amp
* @param {number | Pattern} amount gain. * @param {number | Pattern} amount gain.
* @superdirtOnly
* @example * @example
* s("bd*8").amp(".1*2 .5 .1*2 .5 .1 .5").osc() * s("bd*8").amp(".1*2 .5 .1*2 .5 .1 .5").osc()
* *
*/ */
['f', 'amp', 'like @gain@, but linear.'], ['f', 'amp', 'like @gain@, but linear.'],
// TODO: find out why 0 does not work, and it generally seems not right /**
/*
* A pattern of numbers to specify the attack time of an envelope applied to each sample. * A pattern of numbers to specify the attack time of an envelope applied to each sample.
* [More info about envelopes](/learn/synths-samples-effects/#envelope)
* *
* @name attack * @name attack
* @param {number | Pattern} attack time in seconds. * @param {number | Pattern} attack time in seconds.
* @example * @example
* n("c5 e5").s('superpiano').attack("<0 .1>").osc() * note("c3 e3").attack("<0 .1 .5>")
* *
*/ */
[ [
@ -107,18 +109,36 @@ const generic_params = [
*/ */
['f', 'bank', 'selects sound bank to use'], ['f', 'bank', 'selects sound bank to use'],
// TODO: find out how this works? /**
/* * Gain envelope decay time = the time it takes after the attack time to reach the sustain level.
* Envelope decay time = the time it takes after the attack time to reach the sustain level. * [More info about envelopes](/learn/synths-samples-effects/#envelope)
* *
* @name decay * @name decay
* @param {number | Pattern} time decay time in seconds * @param {number | Pattern} time decay time in seconds
* @example * @example
* s("sax").cut(1).decay("<.1 .2 .3 .4>").sustain(0).osc() * note("c3 e3").decay("<.1 .2 .3 .4>").sustain(0)
* *
*/ */
['f', 'decay', ''], ['f', 'decay', ''],
/**
* Gain envelope sustain level. [More info about envelopes](/learn/synths-samples-effects/#envelope)
*
* @name sustain
* @param {number | Pattern} gain sustain level between 0 and 1
* @example
* note("c3 e3").decay(.2).sustain("<0 .1 .4 .6 1>")
*
*/
['f', 'sustain', ''], ['f', 'sustain', ''],
/**
* Gain envelope release time. [More info about envelopes](/learn/synths-samples-effects/#envelope)
*
* @name release
* @param {number | Pattern} time release time in seconds
* @example
* note("c3 e3 g3 c4").release("<0 .1 .4 .6 1>/2")
*
*/
[ [
'f', 'f',
'release', 'release',