Updated smnp.audio.synth (markdown)

Bartłomiej Przemysław Pluta
2020-03-27 14:26:44 +01:00
parent 16fe871310
commit b0f8047ad0

@@ -30,20 +30,59 @@ synth(music);
## synth
```
synth(wave: list<int>) #1`
synth(wave: list<int>) #1
synth(config: map<string><>, notes: ...list<note, int, string>) #2
synth(...notes: list<note, int, string>) #3
Synthesises produced wave (`#1`) or calls internaly `wave()` function and then synthesises it (#2).
synth(...notes: list<note, int, string>) #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<string><string, float>` - 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<string><string>` - 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);
```