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 773. 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 -n ; For Non-realtime ouput leave only the line below: ; -o poisson.wav -W ;;; for file output any platform </CsOptions> <CsInstruments> sr = 44100 ksmps = 441 ;ksmps set deliberately high to have few k-periods per second nchnls = 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> 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>
Here is another example of the poisson opcode. It uses the file poisson2.csd.
Example 774.
<CsoundSynthesizer> <CsOptions> ; Select audio/midi flags here according to platform -odac ;;;realtime audio out ;-iadc ;;;uncomment -iadc if RT audio input is needed too ; For Non-realtime ouput leave only the line below: ; -o poisson2.wav -W ;;; for file output any platform ; By Stefano Cucchi - 2024 </CsOptions> <CsInstruments> sr = 44100 ksmps = 1024 nchnls = 2 0dbfs = 1 instr 1 kpitch poisson p4 printk (ksmps/sr),kpitch ;prints every k-period a1 oscili 0.3, kpitch, 1 outs a1, a1 endin </CsInstruments> <CsScore> f1 0 4096 10 1 0.1 0 0.2 0 0.3 0 0.1 i 1 0 5 100 i 1 + 5 200 e </CsScore> </CsoundSynthesizer>
A musical example featuring the poisson opcode: Poisson_Cucchi.csd by Stefano Cucchi.