Looking for an example of realtime convolution algorithm

Hello all,
I have been studying reverb convolutions for the past few months. I hunderstand the theory of it but I have no experience with realtime dsp.
I already implemented different algorithm in python to perform convolution such as direct form, fft products, and overlapp-add algorithm (but with fixed inputs).
I’d like to write a module that implements convolution in real time but I’m stuck where it comes to transposing any of those algorithms to a module where it’s input is not a single array x of fixed length.

Do any of you have any resources to point me at that implement such algorithms in real time ?

I’m aware that convolution might not be the best path to start dsp dev, but that’s what I’m most familiar with and I also want it available in vcv (and open source) !

Thank y’all for your help !

1 Like

Hmm, any convolution I’ve seen and used has always been sample based i.e. you load the waveform into it. It can be as difficult as you want to make it, from my own experience

Some good reading here:
https://www.earlevel.com/main/category/digital-audio/convolution/
and here
http://www.dspguide.com/ch6.htm

musicdsp also has a lot of good examples
http://www.musicdsp.org/en/latest/

1 Like

Rack’s DSP library includes an overlap-add convolution in dsp::RealTimeConvolver.

2 Likes

I can tell you from my experience that getting this to work on your own is really difficult. That dsp::RealTimeConvolver looks like it will make it easy. Of course it’s still block based, so depending on what latency you can tolerate you will at a minimum need to delay by a “block”, or you will need to do some very fancy extra code to make it “zero latency”.

1 Like

Yeah you’re probably right I’ll dig deeper in the already written code.
I’d like in the end to achieve some kind of zero latency algorithm but it is probably to complex for me yet.
Thank you for your replies I’ll keep this thread updated with whatever I come up with.
Cheers !

1 Like

You may want to look into this paper from 1993, discussing a hybrid direct/block convolution method: http://alumni.media.mit.edu/~adamb/docs/ConvolutionPaper.pdf. While I’m not sure how viable this may be in the context of Rack, it may be helpful in guiding your thinking.

Yeah, for a long time that algorithm was patented by a company called Lake. No reason that wouldn’t work find in VCV Rack, but it’s not simple to implement!

This question made me think of Fons Adriaensen’s work. Interested parties might like to look at the paper at https://kokkinizita.linuxaudio.org/papers/aella.pdf

I’m not sure if Fons ever released a full version of aella - I have dim memories of it being partially released then withdrawn - but he does have some convolution code in the jconvolver and zita-convolver archives available at https://kokkinizita.linuxaudio.org/linuxaudio/downloads/index.html

jconvolver’s README states:

Jconvolver is a real-time convolution engine. It
can execute up to a 64 by 64 convolution matrix
(i.e. 4096 simultaneous convolutions) as long as
your CPU(s) can handle the load. It is designed
to be efficient also for sparse (e.g. diagonal)
matrices, and for sparse impulse responses.
Unused matrix elements and unused partitions
do not take any CPU time…

In contrast to e.g. BruteFir, jconvolver uses
multiple partition sizes, small ones at the start
of the impulse response and progressively longer
ones for the rest. This allows it provide both
zero processing delay while still remaining
efficient in CPU use. The exact sequence of
partition sizes used depends in a complex way
on almost all elements of the configuration.

Yeah, that sounds like the realtime convolution technique, formerly called “The Lake DSP Patent”.

In that case I guess the code archives may be of interest, as an implementation example. Fons’ code is “terse” tho’ ;-D

You might want to talk to Antonio Tuzzi @synthi as he has a Convolution module already - Convolvzilla