vocoder

Function vocoder 

Source
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

IndexSignalRequiredNotes
0carrier LyesLeft carrier channel
1carrier RyesRight carrier channel
2modulator LyesLeft modulator channel
3modulator RyesRight modulator channel

§Outputs

Returns 2 outputs: vocoded left and right channels.

§Properties

KeyTypeRangeDefaultNotes
windowMsnumber1–10010FFT window length in ms
smoothingMsnumber0–20005Energy smoothing in ms (high values = spectral sustain)
maxGainDbnumber0–10040Per-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]