Feat: adding LPG
This commit is contained in:
@@ -57,17 +57,53 @@ saw snd 200 4000 1 drunk lpf . ( random walk, each step )
|
||||
|
||||
Stack effect: `( min max period -- str )`
|
||||
|
||||
## Envelopes
|
||||
## Envelope Modulation
|
||||
|
||||
Define a multi-segment envelope for a parameter. Provide a start value, then pairs of target and duration.
|
||||
Apply an envelope to any parameter. The `env` word is the complete form: it sweeps from `min` to `max` following a full attack, decay, sustain, release shape. All times are in steps.
|
||||
|
||||
```forth
|
||||
saw snd 0 1 0.1 0.7 0.5 0 8 env gain .
|
||||
saw snd 200 8000 0.01 0.1 0.5 0.3 env lpf .
|
||||
```
|
||||
|
||||
This creates: start at `0`, rise to `1` in `0.1` steps, drop to `0.7` in `0.5` steps, fall to `0` in `8` steps.
|
||||
Stack effect: `( min max attack decay sustain release -- str )`
|
||||
|
||||
Stack effect: `( start target1 dur1 [target2 dur2 ...] -- str )`
|
||||
This is the building block. From it, three shorthands drop the parameters you don't need:
|
||||
|
||||
| Word | Stack | What it does |
|
||||
|------|-------|-------------|
|
||||
| `env` | `( min max a d s r -- str )` | Full envelope (attack, decay, sustain, release) |
|
||||
| `eadr` | `( min max a d r -- str )` | No sustain (sustain = 0) |
|
||||
| `ead` | `( min max a d -- str )` | Percussive (sustain = 0, release = 0) |
|
||||
|
||||
`eadsr` is an alias for `env`.
|
||||
|
||||
```forth
|
||||
saw snd 200 8000 0.01 0.3 ead lpf . ( percussive filter pluck )
|
||||
saw snd 0 5 0.01 0.1 0.3 eadr fm . ( FM depth with release tail )
|
||||
saw snd 200 8000 0.01 0.1 0.5 0.3 env lpf . ( full ADSR on filter )
|
||||
```
|
||||
|
||||
These work on any parameter — `lpf`, `fm`, `gain`, `pan`, `freq`, anything that accepts a value.
|
||||
|
||||
## Low Pass Gate
|
||||
|
||||
The `lpg` word couples the amplitude envelope with a lowpass filter. Set your amp envelope first with `ad` or `adsr`, then `lpg` mirrors it to `lpf`.
|
||||
|
||||
```forth
|
||||
saw snd 0.01 0.1 ad 200 8000 1 lpg . ( percussive LPG )
|
||||
saw snd 0.01 0.1 0.5 0.3 adsr 200 4000 1 lpg . ( sustained LPG )
|
||||
```
|
||||
|
||||
Stack effect: `( min max depth -- )`
|
||||
|
||||
- `min`/`max` — filter frequency range in Hz
|
||||
- `depth` — 0 to 1, scales the filter range (1 = full, 0.5 = halfway)
|
||||
|
||||
```forth
|
||||
saw snd 0.01 0.5 ad 200 8000 0.3 lpg . ( subtle LPG, filter barely opens )
|
||||
```
|
||||
|
||||
`lpg` reads `attack`, `decay`, `sustain`, and `release` from the current sound. If none are set, it defaults to a short percussive shape.
|
||||
|
||||
## Combining
|
||||
|
||||
@@ -77,6 +113,6 @@ Modulation words return strings, so they compose naturally with the rest of the
|
||||
saw snd
|
||||
200 4000 4 lfo lpf
|
||||
0.3 0.7 8 tlfo pan
|
||||
0 1 0.1 0.7 0.5 0 8 env gain
|
||||
0 1 0.01 0.1 ead gain
|
||||
.
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user