Write some amount of documentation
This commit is contained in:
74
docs/lfo.md
Normal file
74
docs/lfo.md
Normal file
@@ -0,0 +1,74 @@
|
||||
# LFO & Ramps
|
||||
|
||||
Generate time-varying values synchronized to the beat for modulation.
|
||||
|
||||
## Ramp
|
||||
|
||||
The `ramp` word creates a sawtooth wave from 0 to 1:
|
||||
|
||||
```forth
|
||||
0.25 1.0 ramp ( one cycle per 4 beats, linear )
|
||||
1.0 2.0 ramp ( one cycle per beat, exponential curve )
|
||||
```
|
||||
|
||||
Stack: `(freq curve -- val)`
|
||||
|
||||
## Shortcut Ramps
|
||||
|
||||
```forth
|
||||
0.5 linramp ( linear ramp, curve=1 )
|
||||
0.25 expramp ( exponential ramp, curve=3 )
|
||||
2.0 logramp ( logarithmic ramp, curve=0.3 )
|
||||
```
|
||||
|
||||
## Triangle Wave
|
||||
|
||||
```forth
|
||||
0.5 tri ( triangle wave 0→1→0 )
|
||||
```
|
||||
|
||||
## Perlin Noise
|
||||
|
||||
Smooth random modulation:
|
||||
|
||||
```forth
|
||||
0.25 perlin ( smooth noise at 0.25x beat rate )
|
||||
```
|
||||
|
||||
## Range Scaling
|
||||
|
||||
Scale a 0-1 value to any range:
|
||||
|
||||
```forth
|
||||
0.5 200 800 range ( 0.5 becomes 500 )
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
Modulate filter cutoff:
|
||||
|
||||
```forth
|
||||
"saw" s
|
||||
0.25 1.0 ramp 500 2000 range lpf
|
||||
.
|
||||
```
|
||||
|
||||
Random panning:
|
||||
|
||||
```forth
|
||||
"hat" s
|
||||
0.5 perlin -1 1 range pan
|
||||
.
|
||||
```
|
||||
|
||||
## Words
|
||||
|
||||
| Word | Stack | Description |
|
||||
|------|-------|-------------|
|
||||
| `ramp` | (freq curve -- val) | Ramp 0-1: fract(freq*beat)^curve |
|
||||
| `linramp` | (freq -- val) | Linear ramp (curve=1) |
|
||||
| `expramp` | (freq -- val) | Exponential ramp (curve=3) |
|
||||
| `logramp` | (freq -- val) | Logarithmic ramp (curve=0.3) |
|
||||
| `tri` | (freq -- val) | Triangle wave 0→1→0 |
|
||||
| `perlin` | (freq -- val) | Perlin noise 0-1 |
|
||||
| `range` | (val min max -- scaled) | Scale 0-1 to min-max |
|
||||
Reference in New Issue
Block a user