linen
Prev | Orchestra Opcodes and Operators | Next

## linen

linen — Applies a straight line rise and decay pattern to an input amp signal.

## Description

linen -- apply a straight line rise and decay pattern to an input amp signal.

## Syntax

    ares linen xamp, irise, idur, idec

    kres linen kamp, irise, idur, idec

## Initialization

irise -- rise time in seconds. A zero or negative value signifies no rise modification.

idur -- overall duration in seconds. A zero or negative value will cause initialization to be skipped.

idec -- decay time in seconds. Zero means no decay. An idec > idur will cause a truncated decay.

## Performance

kamp, xamp -- input amplitude signal.

Rise modifications are applied for the first irise seconds, and decay from time idur - idec. If these periods are separated in time there will be a steady state during which amp will be unmodified. If linen rise and decay periods overlap then both modifications will be in effect for that time. If the overall duration idur is exceeded in performance, the final decay will continue on in the same direction, going negative.

Envelope generated by the linen opcode

| Note

A common error with this opcode is to assume that the value of 0 is the held after the envelope has finished at idur. linen does not automatically end or stop at the end of the duration given. If your note length is longer than idur seconds, kres (or ares) will not come to rest at 0, but will instead continue to fall with the same rate. If a decay and then hold is required then the linseg opcode should be considered instead.

## Examples

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

Example 382. Example of the linen 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
    -odac    ;;;realtime audio out
    ;-iadc    ;;;uncomment -iadc if realtime audio input is needed too
    ; For Non-realtime ouput leave only the line below:
    ; -o linen.wav -W ;;; for file output any platform
    </CsOptions>
    <CsInstruments>

    sr = 44100
    ksmps = 32
    nchnls = 2
    0dbfs  = 1

    instr 1
    ; p4=amp
    ; p5=freq
    ; p6=attack time
    ; p7=release time
    ares linen  p4, p6, p3, p7
    asig poscil ares, p5, 1
         outs   asig, asig

    endin
    </CsInstruments>
    <CsScore>
    f1   0    4096 10 1      ; sine wave

    ;ins strt dur amp  freq attack release
    i1   0    1   .5   440   0.5    0.7
    i1   1.5  1   .2   440   0.9    0.1
    i1   3    1   .2   880   0.02   0.99
    i1   4.5  1   .2   880   0.7    0.01
    i1   6    3   .7   220   0.5    0.5
    e
    </CsScore>
    </CsoundSynthesizer>

## See Also

envlpx, envlpxr, linenr

Prev | Up | Next
line | Home | linenr