x-class noise generatorsgaussSignal Generators:Random (Noise) Generatorsgaussgauss
Gaussian distribution random number generator.
Description
Gaussian distribution random number generator. This is an x-class noise generator.
Syntaxares gauss krangeires gauss irangekres gauss krangeares gauss kmean, ksdevires gauss imean, isdevkres gauss kmean, ksdevPerformancekrange -- the range of the random numbers (-krange to +krange). Outputs both positive and negative numbers.
kmean -- normal distribution mean.
ksdev -- normal distribution standard deviation.
The first version of 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).
The second version takes mean and standard deviation as
parameters. They use the more mathematically sound Box-Muller
algorithm to compute the normal distribution.
For more detailed explanation of these distributions, see:
C. Dodge - T.A. Jerse 1985. Computer music. Schirmer books. pp.265 - 286D. 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 gauss opcode. It uses the file gauss.csd.
Example of the gauss opcode.See the sections Real-time Audio and Command Line Flags for more information on using command line flags.
Its output should include lines like this:
mean = 0.000, std = 0.260, samples inside the given range: 99.993%
mean = 0.005, std = 0.999, samples inside the given range: 99.998%
mean = 2.700, std = 1.497, samples inside the given range: 100.000%See alsoRandom (Noise) GeneratorsCreditsAuthor (first version): &nameparis; MIT, Cambridge1995Author (second version): Victor LazzariniMaynooth University, Ireland2020Precisions about mu and sigma added by &namepinot; after a discussion with
Joachim Heintz on the Csound List, December 2010.Example written by &namepinot;, adapted from a csd file by Joachim Heintz, December 2010.Existed in 3.30