Random Processes

Probability Distributions

Probability is the likehood of occurrence of a given event, ratio of number of occurrences of that event to the total number of results of the random process. A probability distribution is a table that shows the likehood of occurrence of one of more events, where the probability of occurrence of a given event is expressed as a value between 0 and 1.

[continuous vs discrete distributions]

Random numbers... as normally generated in a computer are not really really random. They are the result of executing an algorithm, the output values can be considered statistically random if the algorithm is good enough. Normally the random number generator is seeded by a number, after that the numbers generated are predictable (each time we seed the generator with the same number it produces the same sequence of "random" numbers). For more details on how this is implemented in SuperCollider see /usr/share/SuperCollider/Help/Core/Kernel/randomSeed.help.rtf

There are a bunch of functions in SuperCollider that we can use to generate random numbers. Some of them will work in the language level (sclang, the SuperCollider language interpreter - that's what you have direct access to from Emacs). Others will work in the server itself (scsynth, the SuperCollider sound server which gets OSC messages from the language or other sources) and are UGens (unit generators).

Language level random number generators include:

  • rand: generates uniformly distributed random numbers between zero and the argument (not including the argument).
    // random integers
    // random floating point values
  • linrand: probability increases from zero to the argument.
  • bilinrand: triangular distribution centered around zero.
  • sum3rand: quasi guassian.

and more...

Server level random number generators include:

Load the file "/usr/share/SuperCollider/Help/Other Topics/Randomness.help.rtf" for more options...

[Distributions: uniform, linear, triangular, exponential...]

The example file probability.sc has some examples of probability distributions.

State Machines

[a definition]

A state machine remembers a "state" (a memory of where it is in its internal process) and depending on whar state it is in, it calculates outputs that are determined by the current inputs and then transitions to a different (or the same) state. We could specify a state machine by a connected graph. States are represented by circles. Directed arrows specify the transitions between states. Each transition is determined by the "current state" (that is, the circle it originates in) and by the input conditions. As a side effect of the state transition the state machine defines new output values.

[Mealy: transition -> output; Moore: state -> output]

See statemachine.sc for some simple examples