Free Core now2sdk v0.2.4 Core is free for commercial use with zero license key required
Docs Hub SDK Modules Release Notes Pricing Contact GitHub
Download Free SDK →
Router / Audio DSP Free Core Module Summary →

LAudioFilter Reference Manual & Broadcast Audio DSP

Header#include "LAudioFilter.h"
HierarchyLObject, LSink (Proxy DSP Node)
LicenseFree Core
TargetsLinux x64 · Win64 · C++17

LAudioFilter is a standalone broadcast audio DSP node derived from both LObject and LSink. Unlike legacy embedded filter hooks, it connects anywhere in the audio or combined A/V graph (e.g. LLive -> LAudioFilter -> LAudioMixer -> LOutput or LAudioMixer -> LAudioFilter -> LOutput) while passing video frames through untouched so GPU video paths remain undisturbed.

It strictly separates enable/disable state (via setProps) from parameter values (via typed Props structs and updateFilter), matching the design of LCharacter and LColor.


1. Architectural Concept & Signal Flow

graph LR
    SRC[LLive / LFile / LPlaylist / LAudioMixer] -->|setSource| AF[LAudioFilter]
    AF -->|Video: Direct Passthrough| DOWN[LMixer / LOutput / LRecorder]
    AF -->|Audio: Disabled or All Off| PASS[Zero-Overhead Bypass]
    AF -->|Audio: Active DSP Stages| DSP[Noise Gate -> Noise Reduction -> Compressor -> 3-Band EQ -> Gain -> Limiter -> Delay]
    DSP --> DOWN

2. Typed Filter Props Structs

Each DSP stage has a lightweight NOW2SDK_EXPORT configuration struct with broadcast defaults. None of these structs contain an enable flag.

struct LNoiseGateProps {
    float thresholdDb  = -40.0f; // Open gate threshold in dBFS
    float rangeDb      = -60.0f; // Attenuation depth below threshold
    float attackMs     = 20.0f;  // Gate open time (ms)
    float releaseMs    = 250.0f; // Gate close time (ms)
};

Controls background noise gating ("noise_gate").

struct LNoiseReductionProps {
    float amountDb     = 12.0f;  // FFT noise reduction strength (0.01..97 dB)
    float noiseFloorDb = -50.0f; // Estimated noise floor (-80..-20 dBFS)
};

Controls broadband spectral noise reduction ("noise_reduction").

struct LCompressorProps {
    float thresholdDb  = -18.0f; // Compression knee threshold in dBFS
    float ratio        = 4.0f;   // Compression ratio (1.0..20.0)
    float attackMs     = 20.0f;  // Attack time (ms)
    float releaseMs    = 250.0f; // Release time (ms)
    float makeupDb     = 0.0f;   // Post-compression makeup gain (dB)
};

Controls broadcast dynamic range compression ("compressor").

struct LLimiterProps {
    float ceilingDb    = -1.0f;  // Brickwall ceiling (-24..0 dBFS)
    float releaseMs    = 50.0f;  // Limiter release time (ms)
};

Controls true-peak / brickwall output limiting ("limiter").

struct LEqProps {
    float highpassHz   = 0.0f;    // Sub-bass highpass cutoff (0 disables)
    float lowDb        = 0.0f;    // Low-shelf boost/cut (-24..+24 dB)
    float lowFreqHz    = 120.0f;  // Low-shelf corner frequency
    float midDb        = 0.0f;    // Parametric mid boost/cut (-24..+24 dB)
    float midFreqHz    = 1000.0f; // Parametric mid center frequency
    float midQ         = 1.0f;    // Parametric Q factor
    float highDb       = 0.0f;    // High-shelf boost/cut (-24..+24 dB)
    float highFreqHz   = 6000.0f; // High-shelf corner frequency
};

Controls highpass filter plus 3-band broadcast equalizer ("eq").

struct LAudioDelayProps {
    int delayMs = 0; // Lip-sync delay in milliseconds (0..10000)
};

struct LAudioGainProps {
    float gainDb = 0.0f; // Trim gain in dB (-60..+36)
};

Controls lip-sync alignment delay ("delay") and output trim gain ("gain").


3. API Reference & Key Methods

void setSource(LObject* source);
LObject* getSource() const;
void setEnabled(bool enabled);
bool isEnabled() const;

Connects an upstream source (LLive, LFile, LPlaylist, LAudioMixer, etc.) and enables or bypasses the entire DSP chain.

void setProps(const std::string& key, bool enabled);
void setProps(const std::string& key, const std::string& value);
bool isFilterEnabled(const std::string& key) const;
std::string getProps(const std::string& key) const;

Enables or disables individual filter stages without modifying their stored parameter structs. Supported keys: "enabled", "noise_gate", "noise_reduction", "compressor", "limiter", "eq", "delay", "gain".

void updateFilter(const LNoiseGateProps& props);
void updateFilter(const LNoiseReductionProps& props);
void updateFilter(const LCompressorProps& props);
void updateFilter(const LLimiterProps& props);
void updateFilter(const LEqProps& props);
void updateFilter(const LAudioDelayProps& props);
void updateFilter(const LAudioGainProps& props);
// Matching getFilter(...) overloads read current values back.

Updates the parameters of a specific stage atomically. Does not alter whether the stage is currently enabled.

void reset();
bool hasActiveFilters() const;

reset() disables all stages and restores default parameter structs. hasActiveFilters() reports whether at least one stage is active.


4. C++ Pipeline Example

#include "now2sdk.h"

int main() {
    LLive* micFeed = new LLive();
    micFeed->DeviceSet(0);
    micFeed->Start();

    // Insert LAudioFilter between LLive and LAudioMixer
    LAudioFilter* voiceDsp = new LAudioFilter();
    voiceDsp->setSource(micFeed);

    // 1. Configure parameters cleanly with typed structs
    LNoiseGateProps gate;
    gate.thresholdDb = -42.0f;
    gate.releaseMs   = 200.0f;
    voiceDsp->updateFilter(gate);

    LCompressorProps comp;
    comp.thresholdDb = -16.0f;
    comp.ratio       = 4.0f;
    comp.makeupDb    = 3.0f;
    voiceDsp->updateFilter(comp);

    LEqProps eq;
    eq.highpassHz = 80.0f;
    eq.midDb      = 2.0f;
    voiceDsp->updateFilter(eq);

    // 2. Enable / disable stages explicitly with setProps
    voiceDsp->setProps("noise_gate", true);
    voiceDsp->setProps("compressor", true);
    voiceDsp->setProps("eq", true);

    // 3. Feed into LAudioMixer
    LAudioMixer* audioMix = new LAudioMixer();
    audioMix->addTrack("mic1", voiceDsp);

    return 0;
}