# Filters

Filters attenuate frequencies above or below a cutoff point.

## Lowpass Filter

The lowpass filter (`lpf`) attenuates frequencies above the cutoff.

```forth
saw 1000 lpf .               ( cut above 1000 Hz )
saw 500 lpf 0.8 lpq .        ( with resonance )
```

| Parameter | Range | Description |
|-----------|-------|-------------|
| `lpf` | Hz | Cutoff frequency |
| `lpq` | 0-1 | Resonance (peak at cutoff) |

## Highpass Filter

The highpass filter (`hpf`) attenuates frequencies below the cutoff.

```forth
kick 200 hpf .               ( cut below 200 Hz )
pad 400 hpf 0.3 hpq .        ( with resonance )
```

| Parameter | Range | Description |
|-----------|-------|-------------|
| `hpf` | Hz | Cutoff frequency |
| `hpq` | 0-1 | Resonance |

## Bandpass Filter

The bandpass filter (`bpf`) attenuates frequencies outside a band around the center frequency.

```forth
noise 1000 bpf 0.7 bpq .     ( narrow band around 1000 Hz )
```

| Parameter | Range | Description |
|-----------|-------|-------------|
| `bpf` | Hz | Center frequency |
| `bpq` | 0-1 | Resonance (narrower band) |

## Filter Slope

The `ftype` parameter sets the filter slope (rolloff steepness).

| Value | Slope |
|-------|-------|
| `1` | 12 dB/octave |
| `2` | 24 dB/octave (default) |
| `3` | 48 dB/octave |

```forth
saw 800 lpf 3 ftype .        ( 48 dB/oct lowpass )
```

## Filter Envelope Modulation

Use the `env` word to apply a DAHDSR envelope to any filter cutoff:

```forth
saw 200 8000 0.01 0.3 0.5 0.3 env lpf .   ( cutoff sweeps from 200 to 8000 Hz )
```

The same works for highpass and bandpass: `env hpf`, `env bpf`.

## Ladder Filters

Ladder filters use a different algorithm (Moog-style) with self-oscillation at high resonance.

```forth
saw 800 llpf 0.7 llpq .      ( ladder lowpass )
saw 300 lhpf 0.5 lhpq .      ( ladder highpass )
saw 1000 lbpf 0.8 lbpq .     ( ladder bandpass )
```

| Parameter | Range | Description |
|-----------|-------|-------------|
| `llpf` | Hz | Ladder lowpass cutoff |
| `llpq` | 0-1 | Ladder lowpass resonance |
| `lhpf` | Hz | Ladder highpass cutoff |
| `lhpq` | 0-1 | Ladder highpass resonance |
| `lbpf` | Hz | Ladder bandpass cutoff |
| `lbpq` | 0-1 | Ladder bandpass resonance |

Ladder filter cutoffs can also be modulated with `env`, `lfo`, `slide`, etc.

## EQ

The 3-band EQ applies shelf and peak filters at fixed frequencies.

```forth
kick 3 eqlo -2 eqhi .        ( +3 dB at 200 Hz, -2 dB at 5000 Hz )
snare 2 eqmid .              ( +2 dB at 1000 Hz )
```

| Parameter | Frequency | Type |
|-----------|-----------|------|
| `eqlo` | 200 Hz | Low shelf (dB) |
| `eqmid` | 1000 Hz | Peak (dB) |
| `eqhi` | 5000 Hz | High shelf (dB) |

## Tilt EQ

Tilt EQ applies a high shelf at 800 Hz with up to ±6 dB gain.

```forth
pad -0.5 tilt .              ( -3 dB above 800 Hz )
hat 0.5 tilt .               ( +3 dB above 800 Hz )
```

| Parameter | Range | Description |
|-----------|-------|-------------|
| `tilt` | -1 to 1 | High shelf gain (-1 = -6 dB, 0 = flat, 1 = +6 dB) |
