exprand

exprand — Exponential distribution random number generator (positive values only).

Description

Exponential distribution random number generator (positive values only). This is an x-class noise generator.

Syntax

ares exprand klambda
ires exprand klambda
kres exprand klambda

Performance

klambda -- lambda parameter for the exponential distribution.

The probablity density function of an exponential distribution is an exponential curve, whose mean is 0.69515/lambda. For more detailed explanation of these distributions, see:

  1. C. Dodge - T.A. Jerse 1985. Computer music. Schirmer books. pp.265 - 286

  2. D. Lorrain. A panoply of stochastic cannons. In C. Roads, ed. 1989. Music machine . Cambridge, Massachusetts: MIT press, pp. 351 - 379.

Examples

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

Example 236. Example of the exprand 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 exprand.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

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

instr 1  	; every run time same values

klamda	exprand	20
	printk	.2, klamda		; look
aout	oscili	0.8, 440+klamda, 1	; & listen
	outs	aout, aout
endin

instr 2		; every run time different values

	seed 0
klamda	exprand	20
	printk	.2, klamda		; look 
aout	oscili	0.8, 440+klamda, 1	; & listen
	outs	aout, aout
endin
</CsInstruments>
<CsScore>
; sine wave
f 1 0 16384 10 1

i 1 0 2
i 2 3 2
e

</CsScore>
</CsoundSynthesizer>


Its output should include lines like this:

 i   1 time     0.00033:     4.09813
 i   1 time     0.20033:    56.39567
 i   1 time     0.40033:     3.23362
 i   1 time     0.60033:     0.24277
 i   1 time     0.80033:    13.71228
 i   1 time     1.00000:    12.71885
 i   1 time     1.20033:    32.36737
 i   1 time     1.40033:     0.29747
 i   1 time     1.60033:     4.04450
 i   1 time     1.80000:    35.75676
 i   1 time     2.00000:     3.69845

 Seeding from current time 3034472128

 i   2 time     3.00033:     6.67934
 i   2 time     3.20033:     2.72431
 i   2 time     3.40033:    14.51822
 i   2 time     3.60000:    12.10120
 i   2 time     3.80033:     1.12266
 i   2 time     4.00000:    26.90772
 i   2 time     4.20000:     0.43554
 i   2 time     4.40033:    28.59836
 i   2 time     4.60033:    27.01831
 i   2 time     4.80033:    18.19911
 i   2 time     5.00000:     4.45125

See Also

seed, betarand, bexprnd, cauchy, gauss, linrand, pcauchy, poisson, trirand, unirand, weibull

Credits

Author: Paris Smaragdis
MIT, Cambridge
1995