Homepage: http://das.nasophon.de/pyliblo/
The latest version of this manual can be found at http://dsacre.github.io/pyliblo/doc/.
For the most part, pyliblo is just a thin wrapper around liblo, which does all the real work. For questions not answered here, also see the liblo documentation and the OSC spec.
Send messages to the the given target, without requiring a server. Arguments may be one or more Message or Bundle objects, or a single message given by its path and optional arguments.
Parameters: | |
---|---|
Raises: |
|
Return the current time as a floating point number (seconds since January 1, 1900).
A server that can receive OSC messages using a simple single-threaded polling model. Use ServerThread for an OSC server that runs in its own thread and never blocks.
Create a new Server object.
Parameters: |
|
---|
Exceptions: ServerError
Receive and dispatch one OSC message. Blocking by default, unless timeout is specified.
Parameters: | timeout – Time in milliseconds after which the function returns if no messages have been received. timeout may be 0, in which case the function always returns immediately, whether messages have been received or not. |
---|---|
Returns: | True if a message was received, otherwise False. |
Send a message or bundle from this server to the the given target. Arguments may be one or more Message or Bundle objects, or a single message given by its path and optional arguments.
Parameters: | |
---|---|
Raises: |
|
Register a callback function for OSC messages with matching path and argument types.
Parameters: |
|
---|
Delete a callback function. For both path and typespec, None may be used as a wildcard.
New in version 0.9.2.
Call add_method() for all methods of an object that are decorated with make_method().
Parameters: | obj – The object that implements the OSC callbacks to be registered. By default this is the server object itself. |
---|
This function is usually called automatically by the server’s constructor, unless its reg_methods parameter was set to False.
Add bundle notification handlers.
Parameters: |
|
---|
New in version 0.10.0.
The server’s URL.
The server’s port number.
The server’s protocol (one of the constants UDP, TCP, or UNIX).
Return the file descriptor of the server socket, or -1 if not supported by the underlying server protocol.
Free the underlying server object and close its port. Note that this will also happen automatically when the server is deallocated.
Unlike Server, ServerThread uses its own thread which runs in the background to dispatch messages. ServerThread has the same methods as Server, with the exception of Server.recv(). Instead, it defines two additional methods start() and stop().
Note
Because liblo creates its own thread to receive and dispatch messages, callback functions will not be run in the main Python thread!
Create a new ServerThread object, which can receive OSC messages. Unlike Server, ServerThread uses its own thread which runs in the background to dispatch messages. Note that callback methods will not be run in the main Python thread!
Parameters: |
|
---|---|
Raises: |
|
Start the server thread. liblo will now start to dispatch any messages it receives.
Stop the server thread.
A decorator that serves as a more convenient alternative to Server.add_method().
Set the path and argument types for which the decorated method is to be registered.
Parameters: |
|
---|
Create a new Address object from the given hostname/port or URL.
Parameters: |
|
---|---|
Raises: |
|
The address’s URL.
The address’s hostname.
The address’s port number.
The address’s protocol (one of the constants UDP, TCP, or UNIX).
An OSC message, consisting of a path and arbitrary arguments.
Create a new Message object.
Append the given arguments to the message. Arguments can be single values or (typetag, data) tuples.
A bundle of one or more messages to be sent and dispatched together.
Create a new Bundle object. You can optionally specify a time at which the messages should be dispatched (as an OSC timetag float), and any number of messages to be included in the bundle.
Add one or more messages to the bundle.
Raised when creating a liblo OSC server fails.
When constructing a message, pyliblo automatically converts arguments to an appropriate OSC data type. To explicitly specify the OSC data type to be transmitted, pass a (typetag, data) tuple instead. Some types can’t be unambiguously recognized, so they can only be sent that way.
The mapping between OSC and Python data types is shown in the following table:
typetag | OSC data type | Python data type |
---|---|---|
'i' | int32 | int |
'h' | int64 | long (Python 2.x), int (Python 3.x) |
'f' | float | float |
'd' | double | float |
'c' | char | str (single character) |
's' | string | str |
'S' | symbol | str |
'm' | midi | tuple of four ints |
't' | timetag | float |
'T' | true | |
'F' | false | |
'N' | nil | |
'I' | infinitum | |
'b' | blob | list of ints (Python 2.x), bytes (Python 3.x) |