12inline float convolveNaive(
const float* in,
const float* kernel,
int len) {
14 for (
int i = 0; i < len; i++) {
15 y += in[len - 1 - i] * kernel[i];
22 for (
int i = 0; i < len; i++) {
23 float t = i - (len - 1) / 2.f;
24 out[i] = 2 * cutoff *
sinc(2 * cutoff * t);
55 pffft_destroy_setup(
pffft);
58 void setKernel(
const float* kernel,
size_t length) {
71 if (kernel && length > 0) {
96 std::memset(output, 0,
sizeof(
float) *
blockSize);
float sinc(float x)
The normalized sinc function See https://en.wikipedia.org/wiki/Sinc_function.
Definition common.hpp:26
void boxcarLowpassIR(float *out, int len, float cutoff=0.5f)
Computes the impulse response of a boxcar lowpass filter.
Definition fir.hpp:21
float convolveNaive(const float *in, const float *kernel, int len)
Performs a direct sum convolution.
Definition fir.hpp:12
Root namespace for the Rack API.
Definition AudioDisplay.hpp:9
RealTimeConvolver(size_t blockSize)
blockSize is the size of each FFT block.
Definition fir.hpp:42
PFFFT_Setup * pffft
Definition fir.hpp:39
void setKernel(const float *kernel, size_t length)
Definition fir.hpp:58
float * kernelFfts
Definition fir.hpp:32
void processBlock(const float *input, float *output)
Applies reverb to input input and output must be of size blockSize
Definition fir.hpp:94
float * inputFfts
Definition fir.hpp:33
float * tmpBlock
Definition fir.hpp:35
float * outputTail
Definition fir.hpp:34
size_t blockSize
Definition fir.hpp:36
~RealTimeConvolver()
Definition fir.hpp:51
size_t kernelBlocks
Definition fir.hpp:37
size_t inputPos
Definition fir.hpp:38