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
|
02-linear-ramp.py - Portamento, glissando, ramping.
============================================================================================================================================
The SigTo object allows to create audio glissando between the
current value and the target value, within a user-defined time.
The target value can be a float or another PyoObject. A new ramp
is created everytime the target value changes.
Also:
The VarPort object acts similarly but works only with float and
can call a user-defined callback when the ramp reaches the target
value.
The PyoObject.set() method is another way create a ramp for any
given parameter that accept audio signal but is not already
controlled with a PyoObject.
.. code-block:: python
from pyo import *
s = Server().boot()
# 2 seconds linear ramp starting at 0.0 and ending at 0.3.
amp = SigTo(value=0.3, time=2.0, init=0.0)
# Pick a new value four times per second.
pick = Choice([200, 250, 300, 350, 400], freq=4)
# Print the chosen frequency
pp = Print(pick, method=1, message="Frequency")
# Add a little portamento on an audio target and detune a second frequency.
freq = SigTo(pick, time=0.01, mul=[1, 1.005])
# Play with portamento time.
freq.ctrl([SLMap(0, 0.25, "lin", "time", 0.01, dataOnly=True)])
# Play a simple wave.
sig = RCOsc(freq, sharp=0.7, mul=amp).out()
s.gui(locals())
|