sc_lagud
Prev | Orchestra Opcodes and Operators | Next

## sc_lagud

sc_lagud — Exponential Lag

## Description

Exponential lag with different smoothing time for up- and downgoing signals. Port of Supercollider's LagUD

## Syntax

    aout sc_lagud ain, klagup, klagdown

    kout sc_lagud kin, klagup, klagdown

## Initialization

initialvalue If given, sets the internal state. Default=0

## Performance

ain -- input signal

klagup -- 60 dB lag time in seconds for the upgoing signal.

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

This is essentially the same as sc_lag except that you can supply a different 60 dB time for when the signal goes up, from when the signal goes down. This is useful for smoothing out control signals, where "fade in" should be different from "fade out".

## Examples

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

Example 862. Example of the sc_lagud opcode.

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

    <CsoundSynthesizer>
    <CsOptions>
    </CsOptions>
    <CsInstruments>

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

    instr 1
      kx = randh(2, 1)
      kx2 = sc_lagud(kx, 1.0, 0.1, 1)
      printks "x %f  x2 %f\n", 0.1, kx, kx2
    endin

    instr 2
      kmidis[] array 60, 65, 60, 65, 60
      ilen = lenarray(kmidis)
      kidx = int(linseg(0, ilen*2, ilen-0.00000001))
      kmidi = mtof(kmidis[kidx])
      afreq = sc_lagud(a(kmidi), 1, 0.1)
      a0 = oscili(0.7, afreq)
      kfreq = sc_lagud(kmidi, 1, 0.1)
      a1 = oscili(0.7, kfreq)
      outch 1, a0
      outch 2, a1
    endin

    </CsInstruments>
    <CsScore>
    ; i 1 0 10
    i 2 0 12

    </CsScore>
    </CsoundSynthesizer>

## See Also

sc_lag, port, portk

## Credits

By: Eduardo Moguillansky 2017

Prev | Up | Next
sc_lag | Home | sc_phasor