Vixen
02b45cc4
csharp
public sealed class ConvolutionReverbEffect

The reverb of an actual room, taken from a recording of it.

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

Remarks

What it is. An impulse response is what a place does to a single click — every reflection, in order, with the exact timing and colour of that room. Convolving a signal with one puts the signal in that room, and it is indistinguishable from having recorded it there, because it is the same arithmetic the air was doing. ReverbEffect approximates a room with eight comb filters and four allpasses; this does not approximate anything.

Why it needs a transform. Convolution done directly is one multiply-accumulate per impulse-response sample per output sample — a one-second response at 48 kHz is 48 000 of them per sample, about two thousand times more work than exists. Multiplying two spectra is convolving two signals, so the transform turns it into one complex multiply per bin.

Uniformly partitioned overlap-add. Transforming the whole response at once would mean waiting a whole second before producing anything. Instead it is cut into partitions the length of one block, each transformed once at load; every block, the input's spectrum is pushed into a frequency-domain delay line and multiplied against every partition, and the sum comes back out. Latency is one partition rather than the whole response.

It is the most expensive effect here by a wide margin — a second of stereo response is roughly a hundred complex multiply-accumulates of transform size per block. Put it on one aux bus and send to it; putting it on six buses is six of it.

Fields and properties (10)

  • public int ResponseFrames

    How long the response is, in frames.

  • public int ResponseChannels

    How many channels the response has.

  • public int ResponseSampleRate

    What rate the response was recorded at.

  • public bool IsRateMatched

    Whether the response's rate matches the device's.

  • public int PartitionCount

    How many partitions the response was cut into.

  • public int LatencyFrames

    How much latency the partitioning adds, in frames.

  • public float Wet

    How much of the convolved signal to add.

  • public float Dry

    How much of the untouched signal to keep.

  • public bool Enabled

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

  • public IReadOnlyList<string> Properties

    The knobs this effect will answer to, by name.

Methods (6)

  • public ConvolutionReverbEffect(AudioClip response)

    An effect that convolves against an impulse response.

  • 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.

  • public bool TrySetProperty(string name, float value)

    Sets one of the effect's knobs by name, for automation.

  • public bool TryGetProperty(string name, out float value)

    Reads one of the effect's knobs by name.

Used by (2)

  • ConvolutionTestsVixen.Audio.Tests
  • MixControlTestsVixen.Audio.Tests