File: 04-noise-generators.rst.txt

package info (click to toggle)
python-pyo 1.0.6-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 52,332 kB
  • sloc: python: 135,133; ansic: 127,822; javascript: 16,116; sh: 395; makefile: 388; cpp: 242
file content (44 lines) | stat: -rw-r--r-- 1,146 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
04-noise-generators.py - Different pseudo-random noise generators.
============================================================================================================================================


There are three noise generators (beside random generators that
will be covered later) in the library. These are the classic
white noise, pink noise and brown noise.

Noise:
White noise generator, flat spectrum.

PinkNoise:
Pink noise generator, 3dB rolloff per octave.

BrownNoise:
Brown noise generator, 6dB rolloff per octave.

Use the "voice" slider of the window "Input interpolator" to
interpolate between the three sources.

.. code-block:: python

    from pyo import *
    
    s = Server().boot()
    
    # White noise
    n1 = Noise(0.3)
    
    # Pink noise
    n2 = PinkNoise(0.3)
    
    # Brown noise
    n3 = BrownNoise(0.3)
    
    # Interpolates between input objects to produce a single output
    sel = Selector([n1, n2, n3]).out()
    sel.ctrl(title="Input interpolator (0=White, 1=Pink, 2=Brown)")
    
    # Displays the spectrum contents of the chosen source
    sp = Spectrum(sel)
    
    s.gui(locals())