expcurve
Prev | Orchestra Opcodes and Operators | Next

## expcurve

expcurve — This opcode implements a formula for generating a normalised exponential curve in range 0 - 1. It is based on the Max / MSP work of Eric Singer (c) 1994.

## Description

Generates an exponential curve in range 0 to 1 of arbitrary steepness. Steepness index less than 1.0 would result in Not-a-Number errors and cause unstable behavior so is treated as if it were 1.

The formula used to calculate the curve is:

    (exp(x * log(y))-1) / (y-1)

where x is equal to kindex and y is equal to ksteepness.

## Syntax

    kout expcurve kindex, ksteepness

## Performance

kindex -- Index value. Expected range 0 to 1.

ksteepness -- Steepness of the generated curve. Values closer to 1.0 result in a straighter line while larger values steepen the curve.

kout -- Scaled output.

## Examples

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

Example 274. Example of the expcurve 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    Silent
    -odac           -iadc     -n    ;;;realtime output
    </CsOptions>
    <CsInstruments>

    sr	=	44100
    ksmps	=	1000
    nchnls	=	2

    		instr	1	; logcurve test

    kmod	phasor	1/p3
    kout	expcurve kmod, p4

    printks "mod = %f  out= %f\\n", 0.5, kmod, kout

    		endin

    /*--- ---*/
    </CsInstruments>
    <CsScore>

    i1	0	5  2
    i1	5	5  5
    i1	10	5  30
    i1	15	5  0.5

    e
    </CsScore>
    </CsoundSynthesizer>

## See Also

scale, gainslider, logcurve

## Credits

Author: David Akbari
October
2006
Range check introduced in 6.16 by John ffitch

Prev | Up | Next
exp | Home | expon