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.
The Python module is simply called liblo.
Sends a message or bundle to the the given target, without requiring a server.
target may be an Address object, a port number, a (hostname, port) tuple, or a URL.
Exceptions: AddressError, IOError
Returns the current time as a float in OSC format, that is, the number of seconds since the epoch (January 1, 1900).
Creates a new Server object, which can receive OSC messages.
port may be a decimal port number or a UNIX socket path.
If omitted, an arbitrary free UDP port will be used.
proto can be one of the constants UDP, TCP, UNIX.
Optional keyword arguments:
reg_methods: False if you don't want the init function to automatically
register callbacks defined with the @make_method decorator.
Exceptions: ServerError
Registers a callback function for OSC messages with matching path and argument types.
For both path and typespec, None may be used as a wildcard.
The optional user_data will be passed on to the callback function.
callback_func may be a global function or a class method, pyliblo will know what to do either way.
Deletes a callback function. For both path and typespec, None may be used as a wildcard.
Decorator that basically serves the same purpose as add_method().
Note that @make_method is defined at module scope, and not a member of class Server.
Calls add_method() for all methods of obj decorated with @make_method. obj defaults to
the Server object itself.
This function is called automatically by the Server's init function, unless its reg_methods
parameter is False.
User-defined callback function, to be registered using add_method() or @make_method;
called when a matching OSC message is received.
args will be a list of message arguments, using appropriate built-in Python data types.
types is a string with the typespec of the message.
src is an Address object, containing the address the message came from.
types, src and user_data may be omitted if not needed.
The callback should return zero (or nothing/None) if the message has been dealt with correctly,
or non-zero to look for another matching message handler.
Receives and dispatches one OSC message.
Blocking by default, unless timeout (in ms) is specified.
timeout may be 0, in which case recv() returns immediately.
Returns True if a message was received, False otherwise.
Sends a message or bundle from this server to the the given target.
target may be an Address object, a port number, a (hostname, port) tuple, or a URL.
Exceptions: AddressError, IOError
The server's URL.
The server's port number.
The server's protocol (one of the constants UDP, TCP, UNIX).
Returns the file descriptor of the server socket, or -1 if not supported by the underlying server protocol.
Frees the underlying server object and closes its port. Note that this will also happen automatically when the server is garbage-collected.
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!
ServerThread has the same methods as Server, with the exception of recv().
Instead, it defines these two methods:
Starts the server thread, liblo will now start to dispatch any messages it receives.
Stops the server thread.
Creates a new Address object from the given hostname/port or URL.
proto can be one of the constants UDP, TCP, UNIX.
Exceptions: AddressError
The address' URL.
The address' hostname.
The address' port number.
The address' protocol (one of the constants UDP, TCP, UNIX).
Creates a new Message object.
Appends the given argument(s) to the message.
Creates 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.
Adds one or more messages to the bundle.
Specifies the protocol of a server or address object.
When constructing a message, pyliblo tries to automatically convert arguments to an appropriate
OSC data type, depending on the Python argument.
To explicitly specify the OSC data type to be transmitted, pass a (typetag, data) tuple.
Some types can't be unambiguously recognized, so they can only be sent that way.
Callback functions always receive their arguments according to 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 | single-character string |
's' | string | string |
'S' | symbol | string |
'm' | midi | 4-tuple of ints |
't' | timetag | float |
'T' | true | - |
'F' | false | - |
'N' | nil | - |
'I' | infinitum | - |
'b' | blob | list of ints (Python 2.x), bytes (Python 3.x) |