memlnaut-nisps/playground/faust/eoc-compressor.dsp
w1n5t0n 0a5f2544ca feat(playground/eoc): EQ + Compressor + Reverb modules (meml-4b4, meml-cpe, meml-wwc)
Faust DSP sources, compiled WASM + JSON descriptors, AudioWorklet processors,
and EOCModule subclasses for all three effects.

- meml-4b4: 4-band parametric EQ (fi.low_shelf, fi.peak_eq × 2, fi.high_shelf)
  10 params: freq/gain per band, Q for the two mid bell bands
- meml-cpe: stereo feed-forward compressor (co.compressor_mono × 2)
  7 params: threshold, ratio, attack, release, knee, makeup, mix (parallel)
- meml-wwc: zita reverb (re.zita_rev1_stereo) with pre-delay and M/S width
  8 active params + mod_rate placeholder (zita internal mod not yet exposed)

All three DSPs compile cleanly under Faust 2.83.1. moduleFactory in
eoc-chain-ui.js now returns real instances for eq/compressor/reverb.
2026-04-03 17:57:36 +01:00

34 lines
1.3 KiB
Text

// eoc-compressor.dsp — Stereo feed-forward compressor for MEMLNaut EOC chain
//
// 7 params: threshold, ratio, attack, release, knee, makeup, mix
//
// Compile:
// faust -lang wasm -cn eoc_compressor -e eoc-compressor.dsp -o eoc-compressor.wasm -json
import("stdfaust.lib");
threshold = hslider("threshold[unit:dB]", -24.0, -60.0, 0.0, 0.1);
ratio = hslider("ratio", 4.0, 1.0, 20.0, 0.1);
attack = hslider("attack[unit:ms]", 10.0, 0.1, 200.0, 0.1);
release = hslider("release[unit:ms]", 100.0, 10.0, 2000.0, 1.0);
knee = hslider("knee[unit:dB]", 6.0, 0.0, 24.0, 0.1);
makeup = hslider("makeup[unit:dB]", 0.0, 0.0, 24.0, 0.1);
mix = hslider("mix", 1.0, 0.0, 1.0, 0.001);
// Convert ms to seconds for Faust
attackSec = attack / 1000.0;
releaseSec = release / 1000.0;
// Soft-knee threshold adjustment (shift threshold down by half the knee)
threshKnee = threshold - knee / 2.0;
// Makeup gain as linear multiplier
makeupLin = ba.db2linear(makeup);
// Compressor on a single channel with makeup applied
compCh(x) = co.compressor_mono(ratio, threshKnee, attackSec, releaseSec, x) * makeupLin;
// Parallel compression (dry/wet blend)
parallelComp(x) = (1.0 - mix) * x + mix * compCh(x);
process = parallelComp, parallelComp;