OscMessage
Hold an OSC message: an address and its arguments.
An OscMessage is what the function you set up with OscIn.onInput() receives. Read the message with getAddress() and getArguments().
Creating an OscMessage
You normally receive an OscMessage, rather than create one. To send an OSC message, use OscOut.sendMessage(), which builds and sends an OscMessage object for you.
If necessary, you can create an OscMessage using the following functions:
OscMessage(oscAddress)
OscMessage(oscAddress, arguments)
| Parameter | Type | Default | Description |
|---|---|---|---|
oscAddress |
str |
required | The OSC address, for example "/first/second/third". |
arguments |
list |
None |
The message's arguments (numbers, text, or True/False). Defaults to no arguments. |
For example,
oscIn2.py
# oscIn2.py
#
# Demonstrates how to see what type of messages an OSC device
# (e.g., a smartphone app) generates.
#
from osc import *
oscIn = OscIn( 57110 )
def printMessage(message):
address = message.getAddress()
args = message.getArguments()
print("OSC message:", address, )
for i in range( len(args) ):
print(args[i])
print()
oscIn.onInput("/.*", printMessage)
Functions
Once an OscMessage message has been created, the following functions are available:
| Function | Description |
|---|---|
message.getAddress() |
Return the message's OSC address. |
message.getArguments() |
Return the message's arguments. |