Omniverse Kit extension for sending and receiving OSC (Open Sound Control) messages.
The OSC control surface app running on the iPad is TouchOSC.
Open the Community tab under Extensions window (Window > Extensions
), search for OSC
, and install and enable the omni.osc
extension.
After installing and enabling the extension, you should see the following window.
Enter the private IP address of the computer running your Kit application and the desired port, then click Start
. If you are prompted to configure your Windows Firewall, ensure that the Kit application is allowed to communicate with other devices on the private network.
You can find the private IP address of your computer by running ipconfig
in the Windows terminal.
If you run the server on localhost
, that means the server can only receive messages from OSC clients running on the same machine. If you want to receive messages from OSC clients running on other devices on the same network, you must run the server on an IP address that is visible to those devices.
Once the server is running, confirm that it can successfully receive messages by inspecting the verbose console logs. It might be helpful to filter only the logs that originate from omni.osc
.
Below is a python snippet that demonstrates how to handle OSC messages received by the server. It assumes that the OSC server configured above is running. You can paste and run the below snippet directly into the Omniverse Script Editor for testing.
import carb
import carb.events
import omni.osc
def on_event(event: carb.events.IEvent) -> None:
addr, args = omni.osc.osc_message_from_carb_event(event)
carb.log_info(f"Received OSC message: [{addr}, {args}]")
sub = omni.osc.subscribe_to_osc_event_stream(on_event)
Search for OSC
in the Action Graph nodes list and add the On OSC Message
node to your graph. The node takes a single input,
the OSC address path that this node will handle. This input can be a valid regular expression. Note that this input field does not support
OSC pattern matching expressions. The node outputs an OmniGraph bundle with two attributes named address
and arguments
which you
can access by using the Extract Attribute
node.
You can find example USD stages that demonstrate how to configure an ActionGraph using this extension at exts/omni.osc/data/examples.
Since omni.osc
depends on python-osc, you can import this module directly in
your own Python code to send OSC messages. Please see the documentation for additional
information and support.
import random
import time
from pythonosc import udp_client
client = udp_client.SimpleUDPClient("127.0.0.1", 3334)
client.send_message("/scale", [random.random(), random.random(), random.random()])
You can paste and run the above snippet directly into the Omniverse Script Editor for testing.
This is not currently implemented.
- OSC Bundles are currently not supported.
- The OmniGraph
On OSC Message
node can only handle OSC messages containing lists of floating-point arguments.
The below sections should help you diagnose any potential issues you may encounter while working with omni.osc
extension.
- First, enable verbose logs in the console (filter by the
omni.osc
extension). The server will log any messages received. - Confirm that the computer running the Kit application and the device sending the OSC messages are on the same network.
- Confirm that kit.exe is allowed to communicate with the private network through the Windows Defender Firewall. Note that you may have multiple instances of kit.exe on this list. When in doubt, ensure that all of them have the appropriate permission.
- Confirm that the Windows Defender Firewall allows incoming UDP traffic to the port in use.
- Confirm that the device sending the OSC messages is sending the messages via UDP to the correct IP address and port.
- Use a tool such as wireshark to confirm that the computer running the Kit application is receiving UDP traffic from the device.
- Confirm that the computer running the Kit application and the device receiving the OSC messages are on the same network.
- Confirm that kit.exe is allowed to communicate with the private network through the Windows Defender Firewall.
- Confirm that the device receiving the OSC messages is able to receive incoming UDP traffic at the port in use.
The source code for this repository is provided as-is and we are not accepting outside contributions.
- The code in this repository is licensed under the Apache License 2.0. See LICENSE.
- python-osc is licensed under the Unlicense. See exts/omni.osc/vendor/LICENSE-python-osc.