Debian Codegraph @

pyo/examples/x22-events/13-using-audio-objects.py

raw symbols SCIP
1 """
2 13-using-audio-objects.py - Using audio objects as generators.
3
4 Because Events computes its events in real time, it is possible to use
5 the current value of audio streams as generators for parameter (even
6 as generators for EventGenerator's arguments). So, wherever a float or
7 an EventGenerator is possible, a PyoObject is too.
8
9 Considering the wide range of audio signal possibilities pyo is offering,
10 it is worthy to explore these combinations!
11
12 """
13
14 from pyo import *
15
16 s = Server().boot()
17
18 # Attack - decay envelope.
19 env = CosTable([(0, 0.0), (64, 1.0), (8191, 0.0)])
20
21 # The pool of notes.
22 scl = EventScale(root="C", scale="egyptian", first=4, octaves=3)
23
24 # LFO on the duration multiplier.
25 durmul1 = Sine(freq=0.1).range(0.5, 1.5)
26 # Random on the length of each segment.
27 segment1 = RandInt(max=6, freq=0.5)
28 # Random on the distance between segments starting points.
29 step1 = RandInt(max=6, freq=0.75, add=-3)
30
31 e1 = Events(
32 midinote=EventSlide(scl, segment1, step1), beat=1 / 4.0, db=[-12, -18, -18], envelope=env, durmul=durmul1,
33 ).play()
34
35 # Out-of-phase LFO on the duration multiplier.
36 durmul2 = Sine(freq=0.1, phase=0.5).range(0.5, 1.5)
37 segment2 = RandInt(max=6, freq=0.5)
38 step2 = RandInt(max=6, freq=0.75, add=-3)
39
40 e2 = Events(
41 midinote=EventSlide(scl, segment2, step2),
42 db=[-9, -15, -15],
43 envelope=env,
44 durmul=durmul2,
45 beat=1 / 4.0,
46 bpm=60,
47 transpo=-12,
48 ).play()
49
50 s.gui(locals())