logcurve

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

Description

Generates a logarithmic curve in range 0 to 1 of arbitrary steepness. Steepness index equal to or lower than 1.0 will result in Not-a-Number errors and cause unstable behavior.

The formula used to calculate the curve is:

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

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

Syntax

kout logcurve 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 logcurve opcode. It uses the file logcurve.csd.

Example 233. Example of the logcurve 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           -idac     -d    ;;;realtime output
</CsOptions>
<CsInstruments>

sr	=	48000
ksmps	=	100
nchnls	=	2

/*--- ---*/

		instr	1	; logcurve test

kmod	phasor	1/200

kout	logcurve kmod, 2

	printk2	kmod
	printk2	kout

		endin

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

i1	0	8888

e
</CsScore>
</CsoundSynthesizer>


See Also

scale, gainslider, expcurve

Credits

Author: David Akbari
October
2006