ΣSigmaStudio Ask AI Русский Log in

Comb filter implementation.

SigmaDSP & SigmaStudio rmsnyder Apr 27, 2012 00:00 2 replies Original on forum ↗
Subscribe
rmsnyder Question
Apr 27, 2012 00:00

Hi All,

I'm new to SigmaStudio and I'm trying to implement the following algorithm (comb filter). I have no problems with y(n) = x(n) – x(n - Nf) but when I try to add the 'alpha' term I get an error 'illegal feedback'. Sampling frequency is 48k and Nf is 800. Alpha must be less than 1.

y(n) = x(n) – x(n - Nf) + alpha*y(n – Nf)

Any input would be appreciated.

Best regards,

Bob

ADIApproved Reply
Apr 27, 2012 00:00

Hi Bob,

Welcome to the SigmaDSP community.

In order to route a signal back to an earlier point in the flow (for example, like the feedback in most digital filters), you need to use a feedback cell. This acts as a kind of compiler directive that will prevent the compiler from flagging a feedback error.

You can find the feedback cell in the library here:

Here's an example of the feedback cell used in practice:

This is an implementation of this simple recursive filter:

f1c4f6575ae37c9c9462ee268c4306f5.jpg
f1c4f6575ae37c9c9462ee268c4306f5.jpg
f1c4f6575ae37c9c9462ee268c4306f5.jpg-449x278.jpg
f1c4f6575ae37c9c9462ee268c4306f5.jpg-449x278.jpg
20e26a5e3fbed287f2b241bffe93a708.jpg
20e26a5e3fbed287f2b241bffe93a708.jpg
20e26a5e3fbed287f2b241bffe93a708.jpg-408x236.jpg
20e26a5e3fbed287f2b241bffe93a708.jpg-408x236.jpg
db7e14a89b3317b50ed864048ead077b.jpg
db7e14a89b3317b50ed864048ead077b.jpg
db7e14a89b3317b50ed864048ead077b.jpg-450x133.jpg
db7e14a89b3317b50ed864048ead077b.jpg-450x133.jpg
KJBob Reply
Apr 29, 2018 00:00

A clarification: The feedback block includes a built-in delay of one sample. That's how it works. Thus, if for example a comb filter needs a N-sample delay, make the explicit delay (N-1) samples. When only a one-sample delay is needed, the feedback block itself provides it.

The feedback block has many interesting uses besides making nonstandard recursive filters. Many of these involve slow moving signals where the feedback block's one-sample delay may be safely ignored. Yet it's always present.