File: 01-osc-scan.rst.txt

package info (click to toggle)
python-pyo 1.0.6-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 52,332 kB
  • sloc: python: 135,133; ansic: 127,822; javascript: 16,116; sh: 395; makefile: 388; cpp: 242
file content (35 lines) | stat: -rw-r--r-- 1,068 bytes parent folder | download | duplicates (2)
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
Scan Open Sound Control inputs on a specific port
============================================================================================================================================


**01-osc-scan.py**

Scan Open Sound Control inputs on a specific port. This program
can be used to find the address used by a specific device or the
range of values sent on a given address.

.. code-block:: python

    from pyo import *
    
    # Set the port number.
    port = 9002
    
    s = Server().boot().start()
    
    print("Play with your OSC interface...")
    
    # Function called whenever OscDataReceive receives an input.
    def printInputMessage(address, *args):
        print("Address =", address)
        print("Values =", args)
        print("---------------")
    
    
    # OscDataReceive accepts any kind of OSC message.
    # The wildcard alone ("*") to the address argument means that
    # the object will monitor any address on the port.
    scan = OscDataReceive(port=port, address="*", function=printInputMessage)
    
    s.gui(locals())