Debian Codegraph @

docs/_sources/examples/05-envelopes/03-exponential-ramp.rst.txt

raw
1 03-exponential-ramp.py - Exponential portamento with rising and falling times.
2 ============================================================================================================================================
3
4
5 The Port object is designed to lowpass filter an audio signal with
6 different coefficients for rising and falling signals. A lowpass
7 filter is a good and efficient way of creating an exponential ramp
8 from a signal containing abrupt changes. The rising and falling
9 coefficients are controlled in seconds.
10
11 .. code-block:: python
12
13 from pyo import *
14
15 s = Server().boot()
16
17 # 2 seconds linear ramp starting at 0.0 and ending at 0.3.
18 amp = SigTo(value=0.3, time=2.0, init=0.0)
19
20 # Pick a new value four times per second.
21 pick = Choice([200, 250, 300, 350, 400], freq=4)
22
23 # Print the chosen frequency
24 pp = Print(pick, method=1, message="Frequency")
25
26 # Add an exponential portamento on an audio target and detune a second frequency.
27 # Sharp attack for rising notes and long release for falling notes.
28 freq = Port(pick, risetime=0.001, falltime=0.25, mul=[1, 1.005])
29 # Play with portamento times.
30 freq.ctrl()
31
32 # Play a simple wave.
33 sig = RCOsc(freq, sharp=0.7, mul=amp).out()
34
35 s.gui(locals())
36