From b0f8047ad053153d5548e64f7818bda55c594fd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Przemys=C5=82aw=20Pluta?= Date: Fri, 27 Mar 2020 14:26:44 +0100 Subject: [PATCH] Updated smnp.audio.synth (markdown) --- smnp.audio.synth.md | 45 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/smnp.audio.synth.md b/smnp.audio.synth.md index aca27d3..6c75b82 100644 --- a/smnp.audio.synth.md +++ b/smnp.audio.synth.md @@ -30,20 +30,59 @@ synth(music); ## synth ``` -synth(wave: list) #1` +synth(wave: list) #1 synth(config: map<>, notes: ...list) #2 -synth(...notes: list) #3 -Synthesises produced wave (`#1`) or calls internaly `wave()` function and then synthesises it (#2). +synth(...notes: list) #3 +``` +Synthesises produced wave (`#1`) or calls internaly [smnp.audio::wave](https://github.com/bartlomiej-pluta/smnp/wiki/smnp.audio.synth#wave) function and then synthesises it (`#2`, `#3`). #### Arguments * `wave` - a wave in the form of lists of integers with values between 0 and 255 (one byte) +* `config` - see [smnp.audio::wave](https://github.com/bartlomiej-pluta/smnp/wiki/smnp.audio.synth#wave) +* `notes` - see [smnp.audio::wave](https://github.com/bartlomiej-pluta/smnp/wiki/smnp.audio.synth#wave) + +#### Example ``` +wave = wave(range(@c, @c5, "diatonic")); +synth(wave); +``` + ## adsr ``` adsr(p1: float = 0.1, p2: float = 0.3, p3: float = 0.8, s: float = 0.8) ``` +Produces ADSR (_Attack-Decay-Sustain-Release_) wave envelope of given parameters. In fact, it produces a config map +that is parsed by [smnp.audio::wave](https://github.com/bartlomiej-pluta/smnp/wiki/smnp.audio.synth#wave) function. + +#### Arguments +* `p1` - (values between 0.0 and 1.0) the end point of _Attack_ +* `p2` - (values between 0.0 and 1.0) the end point of _Decay_ +* `p3` - (values between 0.0 and 1.0) the end point of _Sustain_ +* `s` - (values between 0.0 and 1.0) the const level of _Sustain_ phase + +#### Output +* `map` - a config map that represents the configured ADSR envelope + +#### Example +``` +notes = range(@c, @c5); +wave = wave({ envelope -> adsr(0.2, 0.3, 0.9, 0.8) }, notes); +synth(wave); +``` ## constant ``` constant() +``` +Produces constant wave envelope with value of 1.0. In fact, it produces a config map +that is parsed by [smnp.audio::wave](https://github.com/bartlomiej-pluta/smnp/wiki/smnp.audio.synth#wave) function. + +#### Output +* `map` - a config map that represents the constant envelope - actually it is exactly `{ name -> "const" }` + +#### Example +``` +notes = range(@c, @c5); +wave = wave({ envelope -> constant() }, notes); +synth(wave); ``` \ No newline at end of file