Page 1 of 1

About allpass filter algorithms

Posted: Mon Jan 10, 2011 4:22 am
by tkamogashira
Hi,

I am now developing dsp libraries (called freeverb3) and coding some dsp processings.
Some allpass algorithms in some implementations are different from each other.
It seems that the figure on the SpimSemi's site
Image
is the corrent signal flow, but some figures on some sites draw strange pictures like this.
Image

http://www.gersic.com/dspwiki/index.php ... erberation
shows the same strange allpass filter figure.
Image
In addition, the original freeverb's allpass filter's code looks strage

Code: Select all

inline float allpass::process(float input)
{
        float output;
        float bufout;
        bufout = buffer[bufidx];
        undenormalise(bufout);
        output = -input + bufout;
        buffer[bufidx] = input + (bufout*feedback);
        if(++bufidx>=bufsize) bufidx = 0;
        return output;
}
I think that the correct algorithm is like this:

Code: Select all

inline float process(float input)
{
  float output;
  float bufout = buffer[bufidx];
  undenormalise(bufout);
  buffer[bufidx] = input + bufout * feedback;
  output = bufout - buffer[bufidx] * feedback;
  bufidx ++; if(bufidx >= bufsize) bufidx = 0;
  return output;
}
The original code in the freeverb source seems to be just an 1st order IIR plus minus feedforward loop.

The site on NATIONAL INSTRUMENTS shows some optimized version of allpass filter.
http://zone.ni.com/reference/en-XX/help ... e_allpass/

I would like to know why there are so many implementations, some of which seems strange.

Thank you.

Teru

Posted: Tue Jan 11, 2011 11:52 am
by frank
Not sure why there are different versions. Maybe the way people solved for the transform to z domain? Will have to try to look into it.

Posted: Thu Jan 20, 2011 10:45 pm
by seancostello
The drawing from the Spin Semi site is a Direct Form II allpass filter, while the figure from the sites you cite is a Transposed Direct Form II allpass topology:

https://ccrma.stanford.edu/~jos/filters ... Forms.html

The Transposed Direct Form II topology has much better performance in fixed point. This is due to the feedforward path being computed first, which results in lower internal gains, and thus less distortion. However, it takes 5 cycles on the FV-1, as opposed to 2 cycles for the standard allpass delays.

On the same CCRMA site, Julius Smith claims that the Freeverb allpasses are not really allpass. I haven't done research into this myself, as I prefer other reverb topologies, but Julius Smith tends to be pretty correct about this sort of thing.

The lattice allpasses from the National Semiconductor site are the same as nested allpasses - again, Julius Smith's website at CCRMA has useful information about these. The standard lattice topology corresponds to Direct Form II, but you can rearrange things for Transposed Direct Form II without too much of a problem.

This in no way encompasses the wide variety of allpass topologies that can be used in reverbs. You can have allpass feedback delay networks, allpasses with filters inside, allpasses with filters in the feedback and feedforward loops that are conjugates of each other, parallel allpasses where the feedback and feedforward loops are coupled together...

Sean Costello