File: 01-complex-oscs.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 (60 lines) | stat: -rw-r--r-- 1,768 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
01-complex-oscs.py - Complex spectrum oscillators.
============================================================================================================================================


This tutorial presents four objects of the library which are
useful to generate complex spectrums by means of synthesis.

Blit:
Impulse train generator with control over the number of harmonics.

RCOsc:
Aproximation of a RC circuit (a capacitor and a resistor in series).

SineLoop:
Sine wave oscillator with feedback.

SuperSaw:
Roland JP-8000 Supersaw emulator.

Use the "voice" slider of the window "Input interpolator" to
interpolate between the four waveforms. Each one have an LFO
applied to the argument that change the tone of the sound.

.. code-block:: python

    from pyo import *
    
    s = Server().boot()
    
    # Sets fundamental frequency.
    freq = 187.5
    
    # Impulse train generator.
    lfo1 = Sine(0.1).range(1, 50)
    osc1 = Blit(freq=freq, harms=lfo1, mul=0.3)
    
    # RC circuit.
    lfo2 = Sine(0.1, mul=0.5, add=0.5)
    osc2 = RCOsc(freq=freq, sharp=lfo2, mul=0.3)
    
    # Sine wave oscillator with feedback.
    lfo3 = Sine(0.1).range(0, 0.18)
    osc3 = SineLoop(freq=freq, feedback=lfo3, mul=0.3)
    
    # Roland JP-8000 Supersaw emulator.
    lfo4 = Sine(0.1).range(0.1, 0.75)
    osc4 = SuperSaw(freq=freq, detune=lfo4, mul=0.3)
    
    # Interpolates between input objects to produce a single output
    sel = Selector([osc1, osc2, osc3, osc4]).out()
    sel.ctrl(title="Input interpolator (0=Blit, 1=RCOsc, 2=SineLoop, 3=SuperSaw)")
    
    # Displays the waveform of the chosen source
    sc = Scope(sel)
    
    # Displays the spectrum contents of the chosen source
    sp = Spectrum(sel)
    
    s.gui(locals())