Skip to content

Random Controller

Description

Outputs one or more equally distributed random sequences (white noise). The output values range from -1 to 1.

Syntax and Default Values

The 'constant controller can be created using the following Lisp or mlys.lua syntax:

(make-controller 'random
                  dimension
                  period)
local noiseCtrl = modalys.make_controller{ kind="random",
                                           dimension=3,
                                           period=0.01}

Parameters

The 'random controller takes two arguments:

  • dimension: number of dimensions of the output controller.
  • period: sampling period (seconds). period=0 means 'every sample'.

The period is used to define the time between the updates of the controller. If zero is given then it updates every sample.

Discussion

The Random Controller is basically a white noise oscillator with an optional sample-and-hold mechanism, since it outputs values between -1 an 1, and has a user-defined sampling period. It is fairly simple to use and can output different random values in multiple dimensions, such as this example (whose graph is shown above) which outputs 3 dimensions of random values updated every 10 milliseconds:

(setq my-rand (make-controller 'random 3 0.01))
A controller with random values has many practical uses within the Modalys environment - not least of which is to provide a noise source to use with a force connection:

(setq my-string (make-object 'mono-string))
(setq my-string-acc (make-access my-string (const .6) 'trans0))
(setq my-noise (make-controller 'random 1 0))
(setq my-env (make-controller 'envelope 1 '((0 0) (0.1 5) (0.2 2) (0.3 0)) ))
(setq force-ctl (make-controller 'arithmetic 1 "*" my-noise my-env))
(make-connection 'force my-string-acc force-ctl)

★     ★