Debian Codegraph @

pyo/examples/x17-osc/04-receive-list.py

raw symbols SCIP
1 """
2 Receiving OSC messages as list of audio streams
3
4 **04-receive-list.py**
5
6 OscListReceive receives list of values over a network via the Open Sound
7 Control protocol. It converts the values as audio streams that can be used
8 to control audio process.
9
10 """
11 from pyo import *
12
13 s = Server().boot()
14
15 source = SfPlayer("../snds/flute.aif", loop=True, mul=0.7)
16
17 # Receives a list of two values from a TouchOSC's XY pad and converts
18 # them as audio streams. All streams for a given address can be retrieve
19 # with the syntax: rec[address]. One can access the individual streams
20 # for an address with slicing: rec[address][0], rec[address][1], etc.
21 rec = OscListReceive(port=9002, address="/4/xy", num=2)
22
23 # Sets initial values for the OSC streams. This allow the program to run with
24 # minimal behaviour even if no message have been sent on this address.
25 rec.setValue("/4/xy", [0.5, 0.5])
26
27 # Assign the value on the X axis to the drive parameter, and
28 # the value on the Y axis to the slope (lowpass filter) parameter.
29 disto = Disto(source, drive=Sqrt(rec["/4/xy"][0]), slope=Sqrt(rec["/4/xy"][1]), mul=0.5).mix(2).out()
30
31 s.gui(locals())