#import <Allpass1UG.h>
Public Member Functions | |
(id) | - setInput: |
Sets the input patchpoint of filter to aPatchPoint. | |
(id) | - setOutput: |
Sets the output patchpoint of filter to aPatchPoint. | |
(id) | - setBB0: |
Sets the filter coefficient to bb0. | |
(id) | - clear |
Clears filter memory, i.e., sets the value of the two state variables (used for x(n-1) and y(n-1)) to 0.0. | |
(double) | - delayAtFreq: |
Returns filter delay at given frequency. | |
Static Public Member Functions | |
(BOOL) | + shouldOptimize: |
Specifies that all arguments are to be optimized if possible except the state variable. |
Allpass1UG is a one-pole, one-zero filter. The value of the filter coefficient is set directly. The filter's transfer function is given as
bb0 + 1/z H(z) = --------- 1 + bb0/z
where bb0 is the filter coefficient. Thus, the pole is at -bb0 and the zero is at -1/bb0.
In pseudo-C notation:
for (n = 0; n < I_NTICK; n++) { t = sinp:ainp[n] - bb0 * s; sout:aout[n] = bb0 * t + s; s = t; }
The difference equation used to implement the filter in the DSP is:
y(n) = bb0 * x(n) + x(n-1) - bb0 * y(n-1);
where x(n) denotes the input signal at time n, and y(n) is the output signal. This is the so-called “direct-form-1” digital filter structure. It has the property that the filter can only overflow if the output overflows. (In other words, internal overflow is not possible.) For stability, bb0 must lie between -1.0 and 1.0.
Allpass1UG is fastest if the input memory space is x in which case three inner-loop instructions are required. Otherwise, four inner-loop instructions are used.
Allpass1UGab a output b input
+ (BOOL) shouldOptimize: | (unsigned) | arg |
Specifies that all arguments are to be optimized if possible except the state variable.
arg | is an unsigned. |
- (id) setInput: | (id) | aPatchPoint |
Sets the input patchpoint of filter to aPatchPoint.
aPatchPoint | is an id. |
- (id) setOutput: | (id) | aPatchPoint |
Sets the output patchpoint of filter to aPatchPoint.
aPatchPoint | is an id. |
- (id) setBB0: | (double) | bb0 |
Sets the filter coefficient to bb0.
bb0 | is an double. |
- (id) clear |
Clears filter memory, i.e., sets the value of the two state variables (used for x(n-1) and y(n-1)) to 0.0.
- (double) delayAtFreq: | (double) | hzVal |
Returns filter delay at given frequency.
hzVal | is a double. |