randomh
Generates random numbers with a user-defined limit and holds them for a period of time.
Syntax
ares randomh kmin, kmax, xcps [,imode] [,ifirstval]
kres randomh kmin, kmax, kcps [,imode] [,ifirstval]
Initialization
imode (optional, default=0) -- generation mode of the first output value (see below)
ifirstval (optional, default=0) -- first output value
Performance
kmin -- minimum range limit
kmax -- maximum range limit
kcps, xcps -- rate of random break-point generation
The randomh opcode is similar to randh but allows the user to set arbitrary minimum and maximum values.
When imode = 0 (the default), the kmin argument value is outputted during 1/kcps (resp. 1/xcps) seconds at the beginning of the note. Then, the normal process takes place with a new random number generated and held every 1/kcps (resp. 1/xcps) seconds.
When imode = 2, the ifirstval argument value is outputted during 1/kcps (resp. 1/xcps) seconds at the beginning of the note. Then, the normal process takes place with a new random number generated and held every 1/kcps (resp. 1/xcps) seconds.
When imode = 3, the generation process begins with a random value from the initialization time.
Examples
Here is an example of the randomh opcode. It uses the file randomh.csd.
Its output should include lines like this:
Mode: 0
i1 220.00000
i1 396.26079
i1 240.75446
i1 364.24577
...
Mode: 2
i1 330.00000
i1 416.50935
i1 356.11619
i1 433.59324
...
Mode: 3
i1 261.17741
i1 402.00891
i1 393.86592
i1 307.19839
...
Two musical examples featuring the randomh opcode: FtmorfRandomh_Cucchi.csd and Ftmorf_Cucchi.csd, both by Stefano Cucchi.
See also
Credits
Author: Gabriel Maldonado
Arguments imode and ifirstval added by François Pinot, Jan. 2011, after a discussion with Peiman Khosravi on the csnd list.