an open-source digital signal processing and sound synthesis language
about · links · contact
FIR -- simple finite impulse response filter
in RTcmix/insts/std


quick syntax:
FIR(outsk, insk, dur, AMP, ncoefficients, coefficients...)

CAPITALIZED parameters are pfield-enabled for table or dynamic control (see the maketable or makeconnection scorefile commands). Parameters after the [bracket] are optional and default to 0 unless otherwise noted.



   p0 = output start time (seconds)
   p1 = input start time (seconds)
   p2 = duration (seconds)
   p3 = amplitude multiplier (relative multiplier of input signal)
   p4 = total number of filter-equation coefficients
   p5...  the coefficients (up to 99 fir coefficients)

  p3 (amplitude) can receive updates.
  NOTE: mono input / mono output only



FIR creates a finite impulse response filter using the filter coefficients passed to the instrument. The filter is non-recursive (i.e. only past inputs are used in the equation), in the form:
    yn = anxn ± an-1xn-1... ± an-xxn-x

    (an-x are the filter coefficients, xn-x are the past inputs from the sample stream)

Usage Notes

FIR can be used to design fairly complex filters, although the phase-shifting due to a long stream of past inputs is an inherent design problem with basic FIR filters. The trick is to find the right set of coefficients. There are a number of good web sites that will generate FIR coefficients given a frequency-graph type of specification.

Sample Scores

very basic:
   rtsetparams(44100, 1)
   load("FIR")

   rtinput("mysound.aif")
   FIR(0, 0, 7.0, 0.7, 7, 0.9, 0.1, 0.69, -0.49, 0.314, 0.2, 0.09)


See Also

BUTTER ELL EQ FILTERBANK, FILTSWEEP, IIR, JFIR, MOOGVCF, MULTEQ