Post by Steven CookPost by Bogac Topaktasy(n) = alpha * x(n) + (1 - alpha) * y(n-1)
y(n) = y(n-1) + alpha * ( x(n) - y(n-1) )
Thanks for these answers. My code (for a BLIT-based synthesizer) looks more
y(n) = y(n-1) * alpha + x(in)
Does that make a difference?
only in nomenclature and in a constant gain that does not affect the
-3 dB frequency because what we *mean* by the "-3 dB frequency" is
the frequency where the gain is 3 dB lower than at DC, no matter what
the gain there is.
your "alpha" is precisely the same as "p" in what i wrote. but,
using your alpha, the model i describe is
y[n] = (1-alpha)*x[n] + alpha*y[n-1]
the only difference is that my input is scaled by (1-alpha) and yours
is not. my DC gain is 1 (or 0 dB). that means that your DC gain is
1/(1-alpha) which is bigger than 1. the -3 dB frequency is still the
same:
w0 = 2*pi*f0/Fs = arccos( 2 - (1/2)*(alpha + 1/alpha) )
= arccos( 2 - cosh(log(alpha)) )
if your alpha is less than e^(-arccosh(3)) = 0.171572875, then you
don't have a -3 dB frequency (the LPF attenuation never exceeds 3
dB). if your alpha is equal to 1, you have a non-leaky integrator
and if your alpha is greater than 1, your LPF will blow up.
one last notational issue;\: i would recommend sticking with the now
common notation that you see in DSP and discrete-filtering texts and
most of the IEEE (or AES) lit. for discrete-time or discrete-
frequency sequences, we use brackets:
x[n], y[n], h[n], X[k], Y[k], H[k]
for continuous-time and continuous-frequency functions, we use parenths:
x(t), X(f), or maybe X(omega) or X(w) or sometimes
(for consistency with the Laplace transform), X(jw)
in older textbooks, they used the standard subscript
x or x_n instead of "x[n]"
n
but sometimes, in continuous-time signals, we would get a *vector* of
signals
{ x_1(t), x_2(t), x_3(t), ... x_m(t) }
where, if this was converted to discrete time, it was cumbersome to
have two subscripts; one for which element in the vector and another
for discrete time. so the present notation was evolved
{ x_1[n], x_2[n], x_3[n], ... x_m[n] }
and widely adopted. of course this notation doesn't work with
MATLAB, but they screw up the x[0] issue anyway (the bastards).
the main reason is that if you see an argument in brackets or as a
subscript, we're talking about a discrete sequence where the argument
better the hell be an integer rather than a continuous function where
the argument is not restricted to or generally assumed to be an integer.
--
r b-j ***@audioimagination.com
"Imagination is more important than knowledge."