randomiSignal Generators:Random (Noise) Generatorsrandomirandomi
Generates a user-controlled random number series with interpolation between each new number.
Description
Generates a user-controlled random number series with interpolation between each new number.
Syntaxares randomi kmin, kmax, xcps [,imode] [,ifirstval]kres randomi kmin, kmax, kcps [,imode] [,ifirstval]Initializationimode (optional, default=0) -- first interpolation cycle mode (see below)
ifirstval (optional, default=0) -- first output value
Performancekmin -- minimum range limit
kmax -- maximum range limit
kcps, xcps -- rate of random break-point generation
The randomi opcode is similar to randi 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, before
the first random number is generated. Then the normal interpolation process
takes place, first between kmin and the first random
number generated, and then between successive generated random numbers,
each interpolation cycle having a duration of 1/kcps
(resp. 1/xcps) seconds.
When imode = 1, a random number is generated at
initialization and interpolation begins immediately between the
kmin argument value and that random number.
When imode = 2, a random number is generated at
initialization and interpolation begins immediately between the
ifirstval argument value and that random number.
When imode = 3, two random numbers are generated
at initialization as breakpoints for the first interpolation cycle.
Examples
Here is an example of the randomi opcode. It uses the file randomi.csd.
Example of the randomi 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:
Mode: 0
k1 = 220.000000
k1 = 220.000000
k1 = 220.146093
k1 = 246.827703
k1 = 395.595775
...
Mode: 1
k1 = 220.000000
k1 = 224.325329
k1 = 274.370074
k1 = 343.216049
k1 = 414.324347
...
Mode: 2
k1 = 330.000000
k1 = 292.628171
k1 = 334.519777
k1 = 290.610602
k1 = 394.905366
...
Mode: 3
k1 = 360.727674
k1 = 431.680412
k1 = 380.625254
k1 = 289.267139
k1 = 303.038109
...See alsoRandom (Noise) GeneratorsCreditsAuthor: &namegabriel;Arguments imode and ifirstval
added by &namepinot;, Jan. 2011, after a discussion with Peiman Khosravi on
the csnd list.Example written by &namekevin;, adapted for new args by &namepinot;.