Work on documentation

This commit is contained in:
2026-01-31 15:03:20 +01:00
parent 1903d77ac1
commit c3f8ab5fb4
6 changed files with 500 additions and 0 deletions

132
docs/engine_modulation.md Normal file
View File

@@ -0,0 +1,132 @@
# Modulation
Modulation effects vary parameters over time using LFOs or envelopes.
## Vibrato
Vibrato modulates pitch with an LFO.
```forth
saw 5 vib 0.5 vibmod . ( 5 Hz, 0.5 semitone depth )
```
| Parameter | Range | Description |
|-----------|-------|-------------|
| `vib` | Hz | LFO rate |
| `vibmod` | semitones | Modulation depth |
| `vibshape` | shape | LFO waveform (sine, tri, saw, square) |
## Pitch Envelope
The pitch envelope applies an ADSR to the oscillator frequency.
```forth
sine 100 freq 24 penv 0.001 patt 0.1 pdec .
```
| Parameter | Description |
|-----------|-------------|
| `penv` | Envelope depth in semitones |
| `patt` | Attack time in seconds |
| `pdec` | Decay time in seconds |
| `psus` | Sustain level (0-1) |
| `prel` | Release time in seconds |
## Glide
Glide interpolates between pitch changes over time.
```forth
saw c4 0.1 glide . ( 100ms glide )
```
| Parameter | Range | Description |
|-----------|-------|-------------|
| `glide` | seconds | Glide time |
## FM Synthesis
FM modulates the carrier frequency with a modulator oscillator.
```forth
sine 440 freq 2 fm 2 fmh . ( modulator at 2× carrier frequency )
```
| Parameter | Range | Description |
|-----------|-------|-------------|
| `fm` | 0+ | Modulation index |
| `fmh` | ratio | Harmonic ratio (modulator / carrier) |
| `fmshape` | shape | Modulator waveform |
FM has its own envelope (`fme`, `fma`, `fmd`, `fms`, `fmr`).
## Amplitude Modulation
AM multiplies the signal by an LFO.
```forth
pad 4 am 0.5 amdepth . ( 4 Hz tremolo )
```
| Parameter | Range | Description |
|-----------|-------|-------------|
| `am` | Hz | LFO rate |
| `amdepth` | 0-1 | Modulation depth |
| `amshape` | shape | LFO waveform |
## Ring Modulation
Ring modulation multiplies two signals, producing sum and difference frequencies.
```forth
saw 150 rm 0.8 rmdepth . ( ring mod at 150 Hz )
```
| Parameter | Range | Description |
|-----------|-------|-------------|
| `rm` | Hz | Modulator frequency |
| `rmdepth` | 0-1 | Modulation depth |
| `rmshape` | shape | Modulator waveform |
## Phaser
Phaser sweeps notches through the frequency spectrum using allpass filters.
```forth
pad 0.5 phaser 0.6 phaserdepth .
```
| Parameter | Range | Description |
|-----------|-------|-------------|
| `phaser` | Hz | Sweep rate |
| `phaserdepth` | 0-1 | Sweep depth |
| `phasersweep` | cents | Sweep range |
| `phasercenter` | Hz | Center frequency |
## Flanger
Flanger mixes the signal with a short modulated delay (0.5-10ms).
```forth
pad 0.3 flanger 0.7 flangerdepth 0.5 flangerfeedback .
```
| Parameter | Range | Description |
|-----------|-------|-------------|
| `flanger` | Hz | Modulation rate |
| `flangerdepth` | 0-1 | Modulation depth |
| `flangerfeedback` | 0-0.95 | Feedback amount |
## Chorus
Chorus uses multiple modulated delay lines with 120° phase offset for stereo width.
```forth
pad 1 chorus 0.4 chorusdepth 20 chorusdelay .
```
| Parameter | Range | Description |
|-----------|-------|-------------|
| `chorus` | Hz | Modulation rate |
| `chorusdepth` | 0-1 | Modulation depth |
| `chorusdelay` | ms | Base delay time |