Vixen
02b45cc4
csharp
public sealed class EqualizerEffect

Several biquads in series, which is all an equaliser has ever been.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

Composition rather than a new filter. BiquadFilterEffect already has the seven shapes, the cookbook coefficients and the per-channel state; a three-band EQ is three of them run one after another, and writing a separate multi-band filter would be the same arithmetic with a second place for a sign error to live.

The usual arrangement is a high-pass to get rid of rumble, one or two peaking bands to fix whatever the material is doing, and a shelf at the top. That is three or four biquads, about twenty multiplies a sample a channel, and it is cheap enough to leave on a bus for the whole game.

Order matters and is the order the bands were added. Filters do not commute in floating point — the difference is small and it is not zero — so a preset that is reloaded reproduces the same signal only if the bands come back in the same order.

Fields and properties (2)

  • public bool Enabled

    Whether it does anything. A bypassed effect costs one branch a block.

  • public IReadOnlyList<BiquadFilterEffect> Bands

    The bands, in the order they run.

Methods (5)

  • public BiquadFilterEffect AddBand(BiquadFilterKind kind, float frequency, float q = 0.70710677, float gainDb = 0)

    Adds a band to the end of the chain.

  • public bool RemoveBand(BiquadFilterEffect band)

    Takes a band off.

  • public void Prepare(in AudioFormat format, int maxFrames)

    Sizes and clears every buffer the effect needs.

  • public void Process(Span<float> buffer, int frameCount, int channels)

    Processes a block in place.

  • public void Reset()

    Throws away everything the effect remembers about what came before.

Used by (4)

  • AudioEffectTestsVixen.Audio.Tests
  • EqualizerEffectAssetVixen.Audio
  • MixerAssetTestsVixen.Audio.Tests
  • MixerParameterTestsVixen.Audio.Tests