set up a periodic random-number generator for control purposes, using a pfield-handle connection to an Instrument parameter


pfield-handle = makerandom(“type”, frequency, min, max[, seed])

Parameters inside the [brackets] are optional.


makerandom returns a pfield-handle that will deliver data periodically from an internal RTcmix random-number generator. The period is determined by the frequency argument, and the random numbers will lie within the range set by the min and max arguments. The random-numbers will be generated according the the random-number distribution specified in the “type” string argument. These distributions are identical to the ones decribed in the maketable “random” table construction command. The optional seed argument allows the user to specify a particular seed value for the psuedorandom algorithm used by the random-number generator. The active control rate (set via control_rate) must be the same for makerandom and the instrument that uses the makerandom pfield-handle.

Many of the arguments for makerandom may themselves also be pfield-handles.



pitch1 = makerandom("low", 10, 8.00, 8.11)
pitch2 = makerandom("high", 15, 8.00, 8.11)
wave = maketable("wave", 1000, 1.0, 0.2, 0.1)
WAVETABLE(0, 4.9, 15000, pitch1, 0.0, wave)
WAVETABLE(0, 4.9, 15000, pitch2, 1.0, wave)

This scorefile uses two random-number PField generators, one operating at 10 Hz (10 values/second) and the other at 15 Hz (15 values/second) to control the pitch of two WAVETABLE notes, one in the left channel and one in the right. The pitch (in octave.pitch-class notation) is coming directly from the random-number pfield-handles, pitch1 and pitch2. The range of these random-number generators is set to produce values within the octave 8.00 to 8.11 (middle “C” to the “B” above middle “C”).

See Also

maketable, makeconnection, makeLFO, makefilter, makeconverter, makemonitor, irand, srand, trand, random, rand, pickrand, pickwrand, spray_init, get_spray,