how to calculate combfilter?

DSP related issues, mathematics, processing and techniques
Post Reply
User avatar
Nubeat7
Posts: 1347
Joined: Sat Apr 14, 2012 9:59 am
Location: Vienna
Contact:

how to calculate combfilter?

Post by Nubeat7 »

hi all, i try to make a combfilter referring to this papers:
https://ccrma.stanford.edu/~jos/fp/Signal_Flow_Graph.html

it was easy to built the main construct, my question now is how to cook the parameters 'frequency' and 'resonance'
atm i set the range for delaytime from 1 sample to 64 (freq) which sounds fine and what i found out 0.01..0.49 for the feedforward gain and 0.01..0.99 for the feedbackgain (which would be the resonance..)
this combination sounds pretty good but shouldnt i calculate them in any way?

so how to calculate the 'frequency' parameter range, and how the resonance (feedforward and feedback gains) - should they be exponetial? or is it a case of taste
i`m also not sure if they are related to the delaytime?

it should be used the same way as the standard filters lp,hp,bp & comb in with freq and res parameters

thx
User avatar
martinvicanek
Posts: 1334
Joined: Sat Jun 22, 2013 8:28 pm

Re: how to calculate combfilter?

Post by martinvicanek »

Hey Nubeat,
the transfer function of that comb filter is

Code: Select all

       1 + g1*z^-M1
H(z) = ------------
       1 + g2*z^-M2

So there is a numerator which has zeros (dips in the spectrum) and a denominator which produces poles (peaks). Now the numerator dips occur at frequencies

f1, 3*f1, 5*f1, ..., where f1 = f_Nyquist/M1.

Similarly, the denominator peaks occur at frequencies

f2, 3*f2, 5**f2, ..., where f2 = f_Nyquist/M2.

The effect is strongest for g1 or g2 approaching 1. However, if you choose g1 = g2 and M1 = M2 the dips and peaks will cancel. But why don't you just hook the thing to a spectrum analyzer and experiment for yourself? ;)
User avatar
Nubeat7
Posts: 1347
Joined: Sat Apr 14, 2012 9:59 am
Location: Vienna
Contact:

Re: how to calculate combfilter?

Post by Nubeat7 »

thank you martin, sadly i don`t know how to cook the 2 parameters out of this formula.

i don`t understand the z-transfer and its really difficult to find noob papers on this, specially in german..

i prepared a basic schematic, would be great if you could explain there how to use this formula to get the required parameters

thx
Attachments
combfilter.fsm
(1.58 MiB) Downloaded 1497 times
KG_is_back
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: how to calculate combfilter?

Post by KG_is_back »

Frequency is simply a reciprocal of delay time... you don't need Z-transfer to calculate that.
For the resonance, I have found no general way how to define resonance in comb filter.
User avatar
martinvicanek
Posts: 1334
Joined: Sat Jun 22, 2013 8:28 pm

Re: how to calculate combfilter?

Post by martinvicanek »

You can view the circuit as two comb filters in series, one feedforward and one feedback, so their transfer functions simply multiply. The feedforward filter has maximum attenuation (dips) equal to (1 - g1) at frequencies f1, 3*f1, 5*f1, ... (see above). In between those dips, at frequencies 2*f1, 4*f1, ..., there are gain maximums equal to (1 + g1). So for g1 = 0.5 you would have -6dB dips and +3.5dB gains.

For the feedback filter, the situation is just opposite: You have peaks equal to 1/(1 - g2) at frequencies f2, 3*f2, ..., and minimums equal to 1/(1 + g2) in between. +6dB peaks and -3.5dB minimums for g2 = 0.5.

I made a few modifications to your schematic. Note that the JOS diagram shows the second stage in feedback topology, so that's an important change. However, then it does not make sense to have common knobs for g1, g2, and M1, M2, respectively, because then the overall transfer function will be unity (refer to the expression for H(z) above). So I provided individual knobs for each parameter.

Then a few minor details, like you had the volume control after the clipper, which led to unwanted clipping sometimes e.g for white noise, so I put the volume control before the clipper. I also threw in a rational mapper for the g's so you can tamper the knob response for a perceptually uniform function.

It is fun to play with it. You will find that the feedback filter produces pitched sounds because the peaks form a series of (odd) harmonics.

Not sure I answered your question, though? :oops:
Attachments
combfilter_02.fsm
(1.13 MiB) Downloaded 1462 times
User avatar
Nubeat7
Posts: 1347
Joined: Sat Apr 14, 2012 9:59 am
Location: Vienna
Contact:

Re: how to calculate combfilter?

Post by Nubeat7 »

thanks, ok i slowly get it now

so in fact i could name the feedforward version 'comb notch' and the feedback 'comb peak' or?
Post Reply