Debian Codegraph @

docs/_sources/examples/17-osc/03-send-streams.rst.txt

raw
1 Sending audio streams as Open Sound Control messages
2 ============================================================================================================================================
3
4
5 **03-send-streams.py**
6
7 This program does not generate any sound. All it does is to produce
8 audio streams that are then send on an open port as OSC messages in
9 order to control a granulation process created in the example
10 *02-receive-streams.py*.
11
12 .. code-block:: python
13
14 from pyo import *
15
16 s = Server().boot()
17
18 # Manual control of the density of grains per second.
19 dens = Sig(0.5)
20 dens.ctrl(title="Density of grains per second")
21
22 # Generate a normalized random position in the sound with interpolation.
23 pos = Randi(min=0.00, max=1.00, freq=0.1)
24
25 # Manual control of the transposition per grain.
26 pit = Sig(0)
27 pit.ctrl(title="Transposition per grain")
28
29 # Manual control of the grain's duration.
30 dur = Sig(0.5)
31 dur.ctrl(title="Grain duration")
32
33 # Takes audio signals and sends their current value as OSC messages every buffer size.
34 send = OscSend(
35 input=[dens, pos, pit, dur],
36 port=9000,
37 address=["/density", "/position", "/pitch_rand", "/duration"],
38 host="127.0.0.1",
39 )
40
41 s.gui(locals())
42