poisson — Poisson distribution random number generator (positive values only).
Poisson distribution random number generator (positive values only). This is an x-class noise generator.
ares, kres, ires - number of events occuring (always an integer).
klambda - the expected number of occurrences that occur during the rate interval.
In probability theory and statistics, the Poisson distribution is a discrete probability distribution. It expresses the probability of a number of events occurring in a fixed period of time if these events occur with a known average rate, and are independent of the time since the last event.
The Poisson distribution describing the probability that there are exactly k occurrences (k being a non-negative integer, k = 0, 1, 2, ...) is:
where:
The Poisson distribution arises in connection with Poisson processes. It applies to various phenomena of discrete nature (that is, those that may happen 0, 1, 2, 3, ... times during a given period of time or in a given area) whenever the probability of the phenomenon happening is constant in time or space. Examples of events that can be modelled as Poisson distributions include:
For more detailed explanation of these distributions, see:
C. Dodge - T.A. Jerse 1985. Computer music. Schirmer books. pp.265 - 286
D. Lorrain. A panoply of stochastic cannons. In C. Roads, ed. 1989. Music machine . Cambridge, Massachusetts: MIT press, pp. 351 - 379.
Here is an example of the poisson opcode. It uses the file poisson.csd. It is written for *NIX systems, and will generate errors on Windows.
Example 637. Example of the poisson opcode.
See the sections Real-time Audio and Command Line Flags for more information on using command line flags.
<CsoundSynthesizer> <CsOptions> ; Select audio/midi flags here according to platform ; Audio out Audio in -odac -iadc ;;;RT audio I/O ; For Non-realtime ouput leave only the line below: ; -o poisson.wav -W ;;; for file output any platform </CsOptions> <CsInstruments> ; Initialize the global variables. sr = 44100 ksmps = 441 ;ksmps set deliberately high to have few k-periods per second nchnls = 1 ; Instrument #1. instr 1 ; Generates a random number in a poisson distribution. ; klambda = 1 i1 poisson 1 print i1 endin instr 2 kres poisson p4 printk (ksmps/sr),kres ;prints every k-period endin </CsInstruments> <CsScore> ; Play Instrument #1 for one second. i 1 0 1 i 2 1 0.2 0.5 i 2 2 0.2 4 ;average 4 events per k-period i 2 3 0.2 20 ;average 20 events per k-period e </CsScore> </CsoundSynthesizer>