Use Non-Frames Version Previous Page Next Page
Signal Generators: Random (Noise) Generators

duserrnd, cuserrnd

  ir      duserrnd   ifn
  kr      duserrnd   kfn
  ar      duserrnd   afn

  ir      cuserrnd   imin, imax, ifn
  kr      cuserrnd   kmin, kmax, kfn
  ar      cuserrnd   amin, amax, afn

Description

Output is a controlled series of pseudo-random numbers. The random distribution is created by the user.

Initialization

ifn – table containing the random distribution function. ifn is generated with GEN40, GEN41, or GEN42. The table length does not need to be a power of 2.

imin – minimum range limit

imax – maximum range limit

Performance

kfn, afn – table containing the random distribution function. ifn is generated with GEN40, GEN41, or GEN42. The table length does not need to be a power of 2. Rate of xfn must agree with rate of output.

kmin, amin – minimum range limit. Rate of xmin must agree with rate of output.

kmax, amax – maximum range limit. Rate of xmax must agree with rate of output.

duserrnd (discrete user-defined-distribution random generator) generates random values according to a discrete random distribution contained in xfn. The user creates the discrete distribution histogram table by using GEN41. To create the table, the user must define an arbitrary amount of number pairs. The first number of each pair represents a value and the second represents its probability. See GEN41 for more details. duserrnd is designed be used in algorithmic music generation.

duserrnd can also be used to generate values following a set of ranges of probabilities by using distribution functions generated by GEN42. In order to simulate continuous ranges, the table, xfn, should be reasonably large, since duserrnd does not interpolate between table elements.

urd is a version of duserrnd which can be used as a function in expressions. See urd for more information.

cuserrnd (continuous user-defined-distribution random generator) generates random values according to a continuous random distribution contained in xfn. In this case the shape of the distribution histogram can be drawn or generated by any GEN routine. The table containing the shape of such histogram must then be translated to a distribution function using GEN40. This ftable must then be assigned to the xfn. The output range will be rescaled according to the xmin, and xmax arguments. cuserrnd linearly interpolates between table elements, so it is not recommended for discrete distributions (GEN41 and GEN42).

For a tutorial on random distribution histograms and functions see D. Lorrain. "A Panoply of Stochastic Cannons." In C. Roads, ed., Music Machine. Cambridge, Massachusetts: MIT Press, 1989, pp. 351–379.

Author

Gabriel Maldonado
Italy
2001
New in Csound 4.16


Use Non-Frames Version Previous Page Next Page
Signal Generators: Random (Noise) Generators