MusicKit  0.0.0
Public Member Functions | Static Public Member Functions
Allpass1UG Class Reference

Allpass1UG is a first-order all-pass filter, useful for phase modifications. More...

#import <Allpass1UG.h>

Inheritance diagram for Allpass1UG:
MKUnitGenerator

List of all members.

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.

Detailed Description

Allpass1UG is a first-order all-pass filter, useful for phase modifications.

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.

Optimization

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.

Memory Spaces

Allpass1UGab a output b input


Member Function Documentation

- (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.

Returns:
Returns self.
- (double) delayAtFreq: (double)  hzVal

Returns filter delay at given frequency.

Parameters:
hzValis a double.
Returns:
Returns a double.
- (id) setBB0: (double)  bb0

Sets the filter coefficient to bb0.

Parameters:
bb0is an double.
Returns:
Returns self. For stability, the coefficient should be within the bounds: -1.0 < bb0 < 1.0
- (id) setInput: (id)  aPatchPoint

Sets the input patchpoint of filter to aPatchPoint.

Parameters:
aPatchPointis an id.
Returns:
Returns an id. Returns self, or nil if the argument isn't a patchpoint.
- (id) setOutput: (id)  aPatchPoint

Sets the output patchpoint of filter to aPatchPoint.

Parameters:
aPatchPointis an id.
Returns:
Returns an id. Returns self, or nil if the argument isn't a patchpoint.
+ (BOOL) shouldOptimize: (unsigned)  arg

Specifies that all arguments are to be optimized if possible except the state variable.

Parameters:
argis an unsigned.
Returns:
Returns an BOOL.

The documentation for this class was generated from the following file: