lpf18
Prev | Orchestra Opcodes and Operators | Next

## lpf18

lpf18 — A 3-pole sweepable resonant lowpass filter.

## Description

Implementation of a 3 pole sweepable resonant lowpass filter.

## Syntax

    ares lpf18 asig, xfco, xres, xdist [, iskip]

## Initialization

iskip (optional, default=0) -- Skip initialization if present and non-zero.

## Performance

xfco -- the filter cutoff frequency in Hz. Should be in the range 0 to sr/2.

xres -- the amount of resonance. Self-oscillation occurs when xres is approximately 1. Should usually be in the range 0 to 1, however, values slightly greater than 1 are possible for more sustained oscillation and an “overdrive” effect.

xdist -- amount of distortion. kdist = 0 gives a clean output. xdist > 0 adds tanh() distortion controlled by the filter parameters, in such a way that both low cutoff and high resonance increase the distortion amount. Some experimentation is encouraged.

lpf18 is a digital emulation of a 3 pole (18 dB/oct.) lowpass filter capable of self-oscillation with a built-in distortion unit. It is really a 3-pole version of moogvcf, retuned, recalibrated and with some performance improvements. The tuning and feedback tables use no more than 6 adds and 6 multiplies per control rate. The distortion unit, itself, is based on a modified tanh function driven by the filter controls.

| Note
Before version 6.04 this filter requires that the input signal be normalized to one.

## Examples

Here is an example of the lpf18 opcode. It uses the file lpf18.csd.

Example 528. Example of the lpf18 opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

    <CsoundSynthesizer>
    <CsOptions>
    ; Select audio/midi flags here according to platform
    ; Audio out   Audio in    No messages
    -odac           -iadc     -d     ;;;RT audio I/O
    ; For Non-realtime ouput leave only the line below:
    ; -o lpf18.wav -W ;;; for file output any platform
    </CsOptions>
    <CsInstruments>

    ; Initialize the global variables.
    sr = 44100
    kr = 4410
    ksmps = 10
    nchnls = 1

    ; Instrument #1.
    instr 1
      ; Generate a sine waveform.
      ; Note that its amplitude (kamp) ranges from 0 to 1.
      kamp init 1
      kcps init 440
      knh init 3
      ifn = 1
      asine buzz kamp, kcps, knh, ifn

      ; Filter the sine waveform.
      ; Vary the cutoff frequency (kfco) from 300 to 3,000 Hz.
      kfco line 300, p3, 3000
      kres init 0.8
      kdist = p4
      ivol = p5
      aout lpf18 asine, kfco, kres, kdist

      out aout * ivol
    endin

    </CsInstruments>
    <CsScore>

    ; Table #1, a sine wave.
    f 1 0 16384 10 1

    ; different distortion and volumes to compensate
    i 1 0 4 0.2 30000
    i 1 4.5 4 0.9 27000
    e

    </CsScore>
    </CsoundSynthesizer>

## Credits

Author: Josep M Comajuncosas
Spain
December 2000

Example written by Kevin Conder with help from Iain Duncan. Thanks goes to Iain for helping with the example.

New in Csound version 4.10

Audio rate parameters introduced in version 6.02

October 2013.

Prev | Up | Next
lpcfilter | Home | lpfreson