User-Defined Opcode Database |

# ExpCurve

Normalised exponential curve with variable steepness.

Download UDO File### Description

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.

### Syntax

kout **ExpCurve** kfloat, ksteepness

### Performance

kfloat -- A normalised floating point value in range 0 - 1.

ksteepness -- Steepness index of the resulting curve. This should be > 1. There exists a safeguard in the opcode to help minimize errors related to Not-a-Number (NaN) as a result of having a steepness index of <= 1.

### Code

opcode ExpCurve, k, kk
kfloat, ksteep xin
if (ksteep > 1) then
ksteep = ksteep
elseif (ksteep < 1) then
ksteep = 1
endif
kout = (exp(kfloat * log(ksteep)) - 1)/(ksteep - 1)
xout kout
endop

### Examples

sr = 44100
kr = 441
ksmps = 100
nchnls = 2
OSCinit 4200
#include "ExpCurve.udo"
instr 1
kf1 init 0
kf2 init 0
kk OSClisten "/expcurve/params", "ff", kf1, kf2
if kk =0 goto ex
kout ExpCurve kf1, kf2
printk2 kout
ex:
endin

### Credits

David Akbari - 2005