pub fn vocoder(
props: Value,
carrier_l: impl Into<ElemNode>,
carrier_r: impl Into<ElemNode>,
modulator_l: impl Into<ElemNode>,
modulator_r: impl Into<ElemNode>,
) -> Vec<Node>Expand description
STFT-based channel vocoder.
Port of Geraint Luff’s JSFX Vocoder. Imposes the spectral envelope of the modulator signal onto the carrier signal using per-bin energy envelope following and overlap-add reconstruction.
§Inputs
| Index | Signal | Required | Notes |
|---|---|---|---|
| 0 | carrier L | yes | Left carrier channel |
| 1 | carrier R | yes | Right carrier channel |
| 2 | modulator L | yes | Left modulator channel |
| 3 | modulator R | yes | Right modulator channel |
§Outputs
Returns 2 outputs: vocoded left and right channels.
§Properties
| Key | Type | Range | Default | Notes |
|---|---|---|---|---|
windowMs | number | 1–100 | 10 | FFT window length in ms |
smoothingMs | number | 0–2000 | 5 | Energy smoothing in ms (high values = spectral sustain) |
maxGainDb | number | 0–100 | 40 | Per-band gain ceiling (dB) |
§Example
ⓘ
use elemaudio_rs::{el, extra};
use serde_json::json;
let vocoded = extra::vocoder(
json!({ "windowMs": 10, "smoothingMs": 5, "maxGainDb": 40 }),
carrier_l, carrier_r,
modulator_l, modulator_r,
);
// vocoded is a Vec of 2 nodes: [out_l, out_r]