fm envelope docs

This commit is contained in:
Felix Roos 2023-08-31 12:29:29 +02:00
parent 66c895ee3c
commit b48fd78cf0
3 changed files with 71 additions and 3 deletions

View File

@ -118,7 +118,9 @@ const generic_params = [
* @name fmh * @name fmh
* @param {number | Pattern} harmonicity * @param {number | Pattern} harmonicity
* @example * @example
* note("c e g b").fm(4).fmh("<1 2 1.5 1.61>") * note("c e g b")
* .fm(4)
* .fmh("<1 2 1.5 1.61>")
* *
*/ */
[['fmh', 'fmi'], 'fmh'], [['fmh', 'fmi'], 'fmh'],
@ -130,15 +132,65 @@ const generic_params = [
* @param {number | Pattern} brightness modulation index * @param {number | Pattern} brightness modulation index
* @synonyms fmi * @synonyms fmi
* @example * @example
* note("c e g b").fm("<0 1 2 8 32>") * note("c e g b")
* .fm("<0 1 2 8 32>")
* *
*/ */
[['fmi', 'fmh'], 'fm'], [['fmi', 'fmh'], 'fm'],
// fm envelope // fm envelope
/**
* Ramp type of fm envelope. Exp might be a bit broken..
*
* @name fmenv
* @param {number | Pattern} type lin | exp
* @example
* note("c e g b")
* .fm(4)
* .fmdecay(.2)
* .fmsustain(.4)
* .fmenv("<exp lin>")
*
*/
['fmenv'], ['fmenv'],
/**
* Attack time for the FM envelope: time it takes to reach maximum modulation
*
* @name fmattack
* @param {number | Pattern} time attack time
* @example
* note("c e g b")
* .fm(4)
* .fmattack("<0 .05 .1 .2>")
*
*/
['fmattack'], ['fmattack'],
/**
* Decay time for the FM envelope: seconds until the sustain level is reached after the attack phase.
*
* @name fmdecay
* @param {number | Pattern} time decay time
* @example
* note("c e g b")
* .fm(4)
* .fmdecay("<.01 .05 .1 .2>")
* .fmsustain(.4)
*
*/
['fmdecay'], ['fmdecay'],
/**
* Sustain level for the FM envelope: how much modulation is applied after the decay phase
*
* @name fmsustain
* @param {number | Pattern} level sustain level
* @example
* note("c e g b")
* .fm(4)
* .fmdecay(.1)
* .fmsustain("<1 .75 .5 0>")
*
*/
['fmsustain'], ['fmsustain'],
// these are not really useful... skipping for now
['fmrelease'], ['fmrelease'],
['fmvelocity'], ['fmvelocity'],

View File

@ -33,7 +33,7 @@ export function registerSynthSounds() {
release = 0.01, release = 0.01,
fmh: fmHarmonicity = 1, fmh: fmHarmonicity = 1,
fmi: fmModulationIndex, fmi: fmModulationIndex,
fmenv: fmEnvelopeType = 'linear', fmenv: fmEnvelopeType = 'lin',
fmattack: fmAttack, fmattack: fmAttack,
fmdecay: fmDecay, fmdecay: fmDecay,
fmsustain: fmSustain, fmsustain: fmSustain,

View File

@ -38,4 +38,20 @@ Now we not only pattern the notes, but the sound as well!
<JsDoc client:idle name="fmh" h={0} /> <JsDoc client:idle name="fmh" h={0} />
### fmattack
<JsDoc client:idle name="fmattack" h={0} />
### fmdecay
<JsDoc client:idle name="fmdecay" h={0} />
### fmsustain
<JsDoc client:idle name="fmsustain" h={0} />
### fmenv
<JsDoc client:idle name="fmenv" h={0} />
Next up: [Audio Effects](/learn/effects)... Next up: [Audio Effects](/learn/effects)...