Skip to content

gaussi

Gaussian distribution random number generator with controlled interpolation between values.

This is an x-class noise generator.

Syntax

ares gaussi krange, xamp, xcps
ires gaussi krange, xamp, xcps
kres gaussi krange, xamp, xcps

Performance

krange -- the range of the random numbers (-krange to +krange). Outputs both positive and negative numbers.

gauss returns random numbers following a normal distribution centered around 0.0 (mu = 0.0) with a variance (sigma) of krange / 3.83. Thus more than 99.99% of the random values generated are in the range -krange to +krange. If a mean value different of 0.0 is desired, this mean value has to be added to the generated numbers (see example below).

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.

xamp -- range over which random numbers are distributed.

xcps -- the frequency which new random numbers are generated.

Examples

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

Example of the gaussi opcode.
<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
klambda gaussi  100, 1, 3
        printk2 klambda         ; look
aout    oscili  0.8, 440+klambda, 1     ; & listen
        outs    aout, aout
endin

</CsInstruments>
<CsScore>
; sine wave
f 1 0 16384 10 1

i 1 0 4
e

</CsScore>
</CsoundSynthesizer>

See also

Random (Noise) Generators

Credits

Author: John ffitch
Bath
May 2011
New in version 5.14