Debian Codegraph @

pyo/examples/x02-controls/01-fixed-control.py

raw symbols SCIP
1 """
2 01-fixed-control.py - Number as argument.
3
4 Audio objects behaviour can be controlled by passing
5 value to their arguments at initialization time.
6
7 """
8 from pyo import *
9
10 s = Server().boot()
11 s.amp = 0.1
12
13 # Sets fundamental frequency
14 freq = 200
15
16 # Approximates a triangle waveform by adding odd harmonics with
17 # amplitude proportional to the inverse square of the harmonic number.
18 h1 = Sine(freq=freq, mul=1).out()
19 h2 = Sine(freq=freq * 3, phase=0.5, mul=1.0 / pow(3, 2)).out()
20 h3 = Sine(freq=freq * 5, mul=1.0 / pow(5, 2)).out()
21 h4 = Sine(freq=freq * 7, phase=0.5, mul=1.0 / pow(7, 2)).out()
22 h5 = Sine(freq=freq * 9, mul=1.0 / pow(9, 2)).out()
23 h6 = Sine(freq=freq * 11, phase=0.5, mul=1.0 / pow(11, 2)).out()
24
25 # Displays the final waveform
26 sp = Scope(h1 + h2 + h3 + h4 + h5 + h6)
27
28 s.gui(locals())