Difference between comb and allpass

    Sep 27 2013 | 1:27 pm
    Hello there, It might be an already asked question, but indeed I'm still looking for the answer...
    does someone could explain in a quite detailed post the difference between a comb filter and an allpass one ?
    Thanks !

    • Sep 28 2013 | 12:34 am
      If you look at the 'details' tab of the help patcher for [comb~] and [allpass~] you can see that the implementations are very similar, but with the important difference of how they handle gain coefficients. In plain English (more or less), [comb~] has separate gain controls for the direct, delayed, and fedback & delayed (direct, feedforward and feedback, respectively) versions of the signal. The [allpass~], on the other hand locks the direct and feedback gain together. The allpass will typically be more stable than the comb, as the allpass always balances these two signals whereas with the comb you can get far more variety of settings, some of which will blow up the filter.
      VERY generally, an allpass is used as a building block for other things (like reverberators, etc.) and/or for relatively mild phase manipulation whereas comb can be used as a more radical timbral shaper all on its own.
    • Sep 28 2013 | 4:54 am
      you could also say that an allpass consists* of two combs. (*well, _can consist of two combs)
    • Sep 28 2013 | 2:20 pm
      Okay, thanks for the complete explanation. I had read the tutorials before but it lost me.. Now it's quite okay ! If I understood well, you'd rather use the comb filter to act on the tone of the output (the french word is the "timbre" sorry for bad translation), whereas if I only want some "kind of discrete" phase interferences I'll use an allpass.
      But to change the tone with the comb~, it makes use of phase interferences to attenuate other frequencies isn't it ? Understand this principle but why do they use the term of "feedforward" ? the delayed signal is simply output or do I miss something? I've got the same probleme of vocabularty for the feedback parameter. I understand the it feed the input with the output, but I don't get this sentence "the output signal it sent that same amount of time ago (which would have included prior delays)", on this context the sentence means for me that it's a simple delayed output that doesn't affect the input, but it would have no sense... I need to be lightened up some times... But thanks anyway
      @Roman Thilenius, to complete your answer the allpass~ may even be an addition of severals (quite a lot actually) comb filters with there first parameters differently modulated ?
    • Sep 28 2013 | 3:49 pm
      One other little thing, I'm annoying as well by the term "maximum delay", the first argument of both objects. What does mean maximum whereas you can exeed the limit with the inlet "delay time" ? Thanks
    • Sep 28 2013 | 4:21 pm
      That's the maximum delay possible. It's like tapin~.
      Allpass is also a type of interpolation. For a comb filter you often want a particular tuning. You won't get enough without interpolation, but you'll also notice that linear interpolation has a low pass filtering effect. Allpass interpolation has a flatter frequency response, preserving high frequency components. (This comes at the cost of phase smearing)
      (So comb filtering effects will be produced with a feedback delay with a wavelength short enough to be in the audio, rather than rhythmic, range. You could use allpass interpolation for the delay line.)
      The latest version of BEAP has a comb filter that I wrote that uses allpass interpolation.
    • Sep 28 2013 | 6:10 pm
      I noticed that, but I don't get why it's the maximum delay possible whereas you can exceed this limit with the "initial delay"...
      I understood the waveshaping caused by a short enought delayed feedback. But I don't really picture the term of interpolation (it as to many senses for me) ? You're speaking of phase interference ?
      I'll have a look at to your Beap patch, thanks. But actually I was more trying to understand the parameters and possibilities of comb filter. Could you answer to this part of the post ?
      "I Understand this principle but why do they use the term of “feedforward” ? the delayed signal is simply output or do I miss something? I’ve got the same probleme of vocabularty for the feedback parameter. I understand the it feed the input with the output, but I don’t get this sentence “the output signal it sent that same amount of time ago (which would have included prior delays)”, on this context the sentence means for me that it’s a simple delayed output that doesn’t affect the input, but it would have no sense…"
      Thank you for helping
    • Sep 28 2013 | 6:28 pm
      Beforehand, Sorry to be taken for a noob, but I can't find the BEAP project. You've posted it as a project or only in a thread ?
    • Sep 29 2013 | 3:41 pm
      (oh, and "timbre" is a perfectly valid english term as well)
      @peter: Latest version? As in, the update from three days ago? the install I have seems to have your adapted algo in it.
    • Sep 29 2013 | 8:57 pm
      Did some testing. Okay, that thing rules, Peter. Good job.
    • Sep 30 2013 | 6:30 pm
      @wetterberg Thanks! Yeah, sorry not version as far as "release" but latest commit.
      @Guygz You can find a diagram of the innards of comb~ on its help page. (it's under the "details" tab) If you think about feedforward as representing some sort of "future" state, you can see that, since that's impossible to predict, it really just means delaying the input (worth paying attention to how the coefficients get mapped, though!). For comb~, the third inlet is gain for the incoming signal, fourth is gain for the delayed feedforward signal, and fifth is for feedback gain.
      Feedforward terms are standard parts of IIR filters. If you look at the biquad~ help file, you'll see that it also has feedforward sections. Feedback terms have substantially greater weight because their effects continue to ripple through (whereas feedforward terms are only calculated once) the system.
      The Wikipedia page for comb filters shows the difference in frequency response for feedback vs feedforward. Feedforward is an FIR (Finite Impulse Response) filter, whereas feedback is an IIR (Infinite Impulse Response) filter.
      The interpolation has to do with how the filter handles non-integer length sample delays. Comb~ does linear interpolation, which is a form of lowpass filtering. Try setting delays (use sampstoms~) in integer (e.g. 441) vs non-integer (441.49) lengths with high feedback, then send an impulse through comb~. You should notice that integer length delays last longer and are brighter. This is because they aren't using interpolation. Allpass interpolation is designed to have a flatter frequency response, so it does not have as much of a damping effect.
      You might also check out teeth~, which permits different feedforward and feedback delays.
    • Oct 02 2013 | 6:13 pm
      So the signal is delayed previously, after this delay comes the "present signal" and after an other delay of the same value comes the officialy delayed one. It's because of this previous and "hidden" delay that they can predict a "future state of the sound". Comb~ is nothing more than a balanced blend of a signal, a delayed one, and an other double delayed ? I see that like that, tell me if I got something completely wrong...
      I understand as well the -why- of those different frequency response for feedforward and feedback. One is subtracting the frequency of the delay and the other is arising it.
      After reading your answer, and seeing the filterdetail help window I really understand better the operation based in comb~, that's great thanks a lot. It could appear simple but it's really comfortable to have a picture of it.
      I knew what was an interpolation but didn't see where was is place in this discussion. Now it's okay, if you put only a line between two points you remove possible transitions (hi fq ones) and that's why there is a low pass effect.
      When I was reading the tutorial of comb filters, they talked about a delay of one sample or two, you're saying that we can delay for example a two samples and a half and then comb~ interpolates the end of the third sample ? But the float number your talking about is for delay time, not a number of samples, I don't really get it... And there's also this stupid question that I can't answer since a week. I would have understand the utility of the first argument (a "maximum delay time") if, once this limit crossed by the second one, the filter blow up or shut off or stop itself to the limit, but nothing of that kind happen. If you've got : comb~ 15 22 0,8 0,5 0,6 the delay time would be 22 and not 15, so what is the point ?
      I'm asking those meticulous questions because I'm actually trying to make a kind of complete reverb patch by my own to enter in an engineer school. But I'm only a sound technician of 20, and I admit I cruelly miss some theoretical studies of the question sometimes... But this forum learn me a lot, and thanks again for the help. What you're saying about allpass and the lowpass effect of comb~ is really interesting and I think I'll use this method to build the diffuse field of it.
      I have checked teeth~ and the distinction of the two delays could be really useful to build a more random field !
    • Oct 02 2013 | 8:28 pm
      I'm not really sure on the arguments (for the particular reasoning for them); I usually just steal from the help file...
      Interpolation is especially significant inside a comb filter because it's going to process the loop many times, rather than just once, so there's a lot more cumulative degradation that comes with interpolation. You'll particularly notice this in the case of Karplus-Strong synthesis. If you're asking for a 2.5 sample delay, then you're going to have to interpolate. (another example of this happens in sound-file playback. If you want to play at 0.8X the speed, you're going to have to either repeat samples (BAD!) or interpolate the in-between values)
      In the case of linear interpolation, this means blending 50% of the value at 2 samples, with 50% of the value at three samples. (the % changes with the fractional part)
      You could implement a comb filter inside of gen~ that used different interpolation (say cubic or spline) and that should be kinder to the high frequencies.
      Using two delays inside a feedback loop is often a part of physical modelling synthesis, btw. (check out some of the examples in the gen~ folder)
    • Oct 09 2013 | 3:10 pm
      I've checked every object you introduced to me, teeth~ and and allpass~ are really useful to built different kinds of diffuse field indeed. Thanks again for you're help'n'patience Peter, you're a true teacher ! Bravo
    • Oct 09 2013 | 6:19 pm
      Glad to help. I've had some pretty good teachers along the way who have helped me.