0
$\begingroup$

I am implementing a real-time convolution reverb. I currently have a working implementation, doing frequency-domain multiplication after FFT, using uniformly partitioned block sizes. This answer on this platform was super helpful for me.

I was wondering if anyone could write a similar step by step guide for non-uniformly partitioned convolution. For example, as a follow-up to that post's example where the IR consisted of 32 blocks of 512 samples, lets say we want to use 2 different block sizes (for head and tail): 8 blocks of 512 samples for the reverb head, and 3 blocks of 4096 samples for the reverb tail. How would this be implemented?

Any general solution for an arbitrary number of different block sizes used?

$\endgroup$

1 Answer 1

0
$\begingroup$

This can certainly be done.

In your example that's almost trivial: run both the 4k and the 512k chain in parallel and sum the results (but see disclaimer below).

You can segment the impulse response in as many chunks as you like and run each chunk in parallel: you just have to make sure that the outputs of each chunk are properly aligned in time before adding them up.

More formally: Let's assume we have an impulse response $h[n]$ of length $N$ that we segment into M segments each starting at index $n_m$ and having a length of $N_m$, i.e.

$$h_m[n] = \begin{cases} h[n-n_m] & n_m \leq n < n_m+N_m \\ 0 & \text{else} \end{cases}$$

We assume the segments are continuous and cover the whole impulse response, i.e. $n_0 = 0$, $n_{m+1} = n_{n} + N_m$ and $\sum_m N_m = N $.

The impulse response is then the sum of the properly aligned segments, i.e.

$$h[n] = \sum_{m=0}^{M-1} h_m[n-n_m] $$

That translates equally to the output of the convolution.

$$y[n] = \sum_{m=0}^{M-1} y_m[n-n_m] $$

where $y[n],y_m[n]$ are the outputs of the convolution of any input with $y[n],y_m[n]$ respectively.

The easiest way to to ensure proper time alignment is to simply make sure that the sum of the length of the previous segments equals the current segment size. For example you could do 16k = 4128 + 7512 + 3*4096 with a final latency of only 128 samples.

DISLCLAIMER: Especially in a real time system, the exact alignment delays depends on how exactly the different segment sizes are implemented: are these independent threads or is the "shortest block" chain buffering the data for the "larger block" chains.

$\endgroup$
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.