Debian Codegraph @

docs/_sources/examples/05-envelopes/02-linear-ramp.rst.txt

raw
1 02-linear-ramp.py - Portamento, glissando, ramping.
2 ============================================================================================================================================
3
4
5 The SigTo object allows to create audio glissando between the
6 current value and the target value, within a user-defined time.
7 The target value can be a float or another PyoObject. A new ramp
8 is created everytime the target value changes.
9
10 Also:
11
12 The VarPort object acts similarly but works only with float and
13 can call a user-defined callback when the ramp reaches the target
14 value.
15
16 The PyoObject.set() method is another way create a ramp for any
17 given parameter that accept audio signal but is not already
18 controlled with a PyoObject.
19
20 .. code-block:: python
21
22 from pyo import *
23
24 s = Server().boot()
25
26 # 2 seconds linear ramp starting at 0.0 and ending at 0.3.
27 amp = SigTo(value=0.3, time=2.0, init=0.0)
28
29 # Pick a new value four times per second.
30 pick = Choice([200, 250, 300, 350, 400], freq=4)
31
32 # Print the chosen frequency
33 pp = Print(pick, method=1, message="Frequency")
34
35 # Add a little portamento on an audio target and detune a second frequency.
36 freq = SigTo(pick, time=0.01, mul=[1, 1.005])
37 # Play with portamento time.
38 freq.ctrl([SLMap(0, 0.25, "lin", "time", 0.01, dataOnly=True)])
39
40 # Play a simple wave.
41 sig = RCOsc(freq, sharp=0.7, mul=amp).out()
42
43 s.gui(locals())
44