Debian Codegraph @

pyo/examples/x03-generators/02-band-limited-oscs.py

raw symbols SCIP
1 """
2 02-band-limited-oscs.py - Oscillators whose spectrum is kept under the Nyquist frequency.
3
4 This tutorial presents an object (misnamed LFO but it's too late
5 to change its name!) that implements various band-limited waveforms.
6 A band-limited signal is a signal that none of its partials exceeds
7 the nyquist frequency (sr/2).
8
9 The LFO object, despite its name, can be use as a standard oscillator,
10 with very high fundamental frequencies. At lower frequencies (below 20 Hz)
11 this object will give a true LFO with various shapes.
12
13 The "type" slider in the controller window lets choose between these
14 particular waveforms:
15
16 0. Saw up (default)
17 1. Saw down
18 2. Square
19 3. Triangle
20 4. Pulse
21 5. Bipolar pulse
22 6. Sample and hold
23 7. Modulated Sine
24
25 """
26 from pyo import *
27
28 s = Server().boot()
29
30 # Sets fundamental frequency.
31 freq = 187.5
32
33 # LFO applied to the `sharp` attribute
34 lfo = Sine(0.2, mul=0.5, add=0.5)
35
36 # Various band-limited waveforms
37 osc = LFO(freq=freq, sharp=lfo, mul=0.4).out()
38 osc.ctrl()
39
40 # Displays the waveform
41 sc = Scope(osc)
42
43 # Displays the spectrum contents
44 sp = Spectrum(osc)
45
46 s.gui(locals())