an open-source digital signal processing and sound synthesis language
about · links · contact


INSTRUMENT design -- simple 'tracking' one-pole filter object

The OonepoleTrack object is a subclass of the Oonepole object that 'tracks' changes to the cutoff frequency or the lag time and performs computations to update them only when they change. This only works if the caller sticks to updating either the cutoff frequency (using the setfreq method) or the lag time (using the setlag method), not mixing calls to both.

See the Oonepole documentation for a more complete description of this filter.


    OonepoleTrack(float SR)

    SR is the current sampling rate (an Instrument class variable).

Access Methods

    void OonepoleTrack::setfreq(float freq)

    updates the cutoff point freq if it has changed since the last call to the filter.

    void OonepoleTrack::setlag(float lag)

    updates the lag time lag if it has changed since the last call to the filter.


    #include <Ougens.h>
    OonepoleTrack *thefilt;
    // this instrument has a delay line
    int MYINSTRUMENT::init(float p[], int n_args)
    	thefilt = new OonepoleTrack(SR);
    int MYINSTRUMENT::run()
    	float out[2];
    	float sample;
    	for (int i = 0; i < framesToRun(); i++)
    		sample = someSampleGeneratingProcess();
    		out[0] = thefilt->next(sample);

See Also