# [PD] convolution using pd-vanilla

katja katjavetter at gmail.com
Mon May 5 21:41:19 CEST 2014

```Brute force time domain convolution for small kernel can be done with
[fexpr~]. For zero phase filter kernels, fast convolution in Pd is
relatively simple. Multiply real and imaginary part of the signal's
spectrum with the filter's spectrum while using four times overlap and
Hann windowing before FFT and after IFFT, and normalize. Pd's FFT
routines assume x[0] at the start of the filter kernel, not at the
center, so you have to rotate your zero phase filter kernel before
taking it's Fourier Transform.

Katja

On Mon, May 5, 2014 at 8:49 PM, david medine <dmedine at ucsd.edu> wrote:
> For the FFT based convolution, you could easily modify the example patch
> I06.timbre.stamp.pd to do straight up convolution in the frequency domain. I
> wouldn't know how to do it in the time domain without an extern or a lot of
> painstaking work. It might be a nice thing to have, though.
>
> I can tell you, though, that the frequency domain method will out perform
> the time domain in terms of CPU usage. But, since you are windowing there
> will be a latency. Apart from that, the output is identical by both methods.
>
> y(n) = x(n) * g(n)
> Y(k) = X(k)G(k), y(n) = IDFT(Y(k))
>
> where g(n) is the impulse response, X(k) is the discrete Fourier transform
> of x(n) and * is the convolution operation.
>
>
> On 05/05/2014 09:33 AM, Oli Larkin wrote:
>>
>> hi,
>>
>> is anyone aware of an example of both a brute force time domain (e.g.
>> buffir~ in Max) and an FFT-based fast convolution patch in pd-vanilla? I
>> would like to do a comparison of the two. Can be using a small IR, just for
>> demo purposes.
>>
>> cheers,
>>
>> Oli
>>
>> _______________________________________________
>> Pd-list at iem.at mailing list
>> UNSUBSCRIBE and account-management ->
>> http://lists.puredata.info/listinfo/pd-list
>
>
>
> _______________________________________________
> Pd-list at iem.at mailing list
> UNSUBSCRIBE and account-management ->
> http://lists.puredata.info/listinfo/pd-list

```