Class BlockConvolver

Class Documentation

class ear::dsp::block_convolver::BlockConvolver

BlockConvolver implements partitioned overlap-add convolution with a fixed block size, with efficient fading between filters.

Public Functions

BlockConvolver(const Context &ctx, size_t num_blocks)

Create a BlockConvolver given the block size and number of blocks.

Parameters
  • ctxContext required for transformations.

  • num_blocks – Maximum number of blocks of any filter used.

BlockConvolver(const Context &ctx, const Filter &filter, size_t num_blocks = 0)

Create a BlockConvolver given the block size and number of blocks.

If filter == nullptr, num_blocks must be specified.

Parameters
  • ctxContext required for transformations.

  • filter – Initial filter to be used, or nullptr for no filter.

  • num_blocks – Maximum number of blocks of any filter used; using 0 will take the number of blocks from the passed filter.

void process(const float *in, float *out)

Pass a block of audio through the filter.

Parameters
  • in – Input samples of length block_size

  • out – Output samples of length block_size

void crossfade_filter(const Filter &filter)

Crossfade to a new filter during the next block.

This is equivalent to:

  • Creating a new convolver.

  • Passing the next block of samples through the old and new convolvers, with the input to the old faded down across the block, and the input to the new faded up across the block. All subsequent blocks are passed through the new filter.

  • Mixing the output of the old and new filters for the next num_blocks blocks.

void fade_down()

Crossfade to a zero-valued filter.

void set_filter(const Filter &filter)

Switch to a different filter at the start of the next block.

void unset_filter()

Switch to a zero-valued filter at the start of the next block.