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