initialvalue If given, sets the internal state. It defaults to the first value passed
Performance
ain -- input signal
klagtime -- 60 dB lag time in seconds.
kladown -- 60 dB lag time in seconds for the downgoing signal.
This is essentially the same as one pole 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.
Examples
Here is an example of the sclag opcode. It uses the file sclag.csd.
<CsoundSynthesizer><CsOptions> -o dac
</CsOptions><CsInstruments>sr=44100ksmps=128nchnls=20dbfs=1.0instr1; smooth a krate signal x:k=floor(line(0,p3,10))x2:k=sclag(x,0.1)printk2(x2)endininstr2; smooth an audio signalmidi:k=floor(line(60,p3,72)/2)*2freq:a=upsamp(mtof(midi))freqsmooth:a=sclag(freq,1)a1=oscili(1,freq)a2=oscili(1,freqsmooth)out(a1,a2)endin</CsInstruments><CsScore>i105i2010</CsScore></CsoundSynthesizer>
Here is an example of the sc_lag opcode. It uses the file sc_lag.csd.
<CsoundSynthesizer><CsOptions> -o dac
</CsOptions><CsInstruments>sr=44100ksmps=128nchnls=20dbfs=1.0instr1; smooth a krate signal kx=floor(line(0,p3,10))kx2=sc_lag(kx,0.1)printk2kx2endininstr2; smooth an audio signalkmidi=floor(line(60,p3,72)/2)*2afreq=upsamp(mtof(kmidi))afreqsmooth=sc_lag(afreq,1)a1=oscili(1,afreq)a2=oscili(1,afreqsmooth)outch1,a1outch2,a2endin</CsInstruments><CsScore>i105i2010</CsScore></CsoundSynthesizer>