Page 1 of 1

Question for you math-heads about single pole filters

Posted: Fri Jul 18, 2014 1:23 pm
by Digital Larry
Many of the code examples have these sneaky few lines in them with magical numbers that are never explained very well. Well maybe they ARE explained somewhere, but I'm just dense and need better explanations to understand things.

For example, the low pass filter acting as a control smoother prior to the RDA instruction:

Code: Select all

rdax adcl,1
wra delay,0
clr
or 32767*256
mulx POT1
sof maxlength/1000,0
rdfx del_read, 0.0125
wrax del_read,1
wrax addr_ptr,0
Here I'm mostly interested in this line:

rdfx del_read, 0.0125


and the source and meaning of the "magic" number 0.0125.

The knowledge base article on simple filters implies that the factor used in the RDFX instruction is (1 - e^(-2 * PI * f0/fs)).

So, if 0.0125 = (1 - e^(-2 * PI * f0/fs)), then (step by step)

e^(-2 * PI * f0/fs) = 1 - 0.0125 = 0.9875

take natural log of both sides....

-2 * PI * f0/fs = ln(0.9875) which is about -0.012579.

making f0 = 0.012579 * fs /(2 * PI)
= 0.012579 * 32768/(6.283) = 65.6 Hz.

Is this correct?

Posted: Fri Jul 18, 2014 2:23 pm
by frank
When Keith or I wrote code for just smoothing something we used values that we had used in the past that worked or just tweaked the value until it sounded like we wanted. Never bothered to figure out the actual frequency it was at.

Posted: Fri Jul 18, 2014 3:15 pm
by Digital Larry
Hi Frank,

I can totally respect that approach. I've done it myself. As you know I'm developing this visual tool for algorithm creation and I wonder sometimes what is the best thing to show the person using the tool. It could be:

1) The actual number used in the algorithm
2) The -3 dB point of a filter
3) The time delay/rise time

I think the answer depends on the application, and the level of understanding (both DSP in general and FV-1 specifically) of the user.

For audio filters, sometimes people would want to correlate a filter frequency to an actual note so they might want to set it at 440 Hz. And for audio range filters, I think it's pretty important that these things be consistent between different filter types. If I put a resonant peak at 440 Hz then I really want to hear it when I hit that "A" note.

For a filter that is smoothing the output of a rectifier to act as an envelope follower, that one you can really dial in by ear because when it's too fast your audio sounds awful!

For something like a control smoother for delay times, maybe the rise time would be more useful than a filter frequency.

Still interested in alternative points of view. Thanks!