lag — Exponential Lag


Plugin opcode in scugens.

Exponential lag with 60dB lag time. Port of Supercollider's Lag. This is essentially a one pole filter except that instead of supplying the coefficient directly, it is calculated from a 60 dB lag time. This is the time required for the filter to converge to within 0.01% of a value. This is useful for smoothing out control signals.


aout lag ain, klagtime [, initialvalue]
kout lag kin, klagtime [, initialvalue]


initialvalue If given, sets the internal state. It defaults to the first value passed


ain -- input signal

klagtime -- 60 dB lag time in seconds.

kladown -- 60 dB lag time in seconds for the downgoing signal.


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

Example 511. Example of the lag opcode.

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


sr = 44100
ksmps = 128
nchnls = 2
0dbfs = 1.0

instr 1
  ; smooth a krate signal  
  kx = floor(line(0, p3, 10))
  kx2 = lag(kx, 0.1)
  printk2 kx2

instr 2
  ; smooth an audio signal
  kmidi = floor(line(60, p3, 72)/2)*2
  afreq = upsamp(mtof(kmidi))
  afreqsmooth = lag(afreq, 1)
  a1 = oscili(1, afreq)
  a2 = oscili(1, afreqsmooth)
  outch 1, a1
  outch 2, a2 

i 1 0 5
i 2 0 10


See also

Standard Filters: Control signal filters


By: Eduardo Moguillansky 2017