OSCNode Examples
The OSCNode is a Ygdrasil node that provides basic network communication over OSC. You can use it with any program or language that can receive OSC messages.
The host and port parameters are used to set the host address and port of the sound server computer. OSCNode will send all OSC messages to this address and port. This is not terribly robust, since running the scene in different installation setups requires actually changing this part of the YG scene file. On the other hand, this does allow one YG scene to control multiple sound servers simultaneously.
Example: playing basic tones
OSCNode osc (host("localhost"),port(9000))
wandTrigger (
when(button1,osc.oscmessage("/sinewave",220.0)),
when(button2,osc.oscmessage("/sinewave",440.0)),
when(button3,osc.oscmessage("/sinewave",880.0))
)
Sending the wand position over OSC
#include "user0.scene"
wandPosition(when(inside,osc.sendMessage("/wand" $xpos $ypos $zpos)))
OSCNode osc (host("localhost"),port(10000))
Getting OSC Messages in PureData
dumpOSC receives osc messages; give it the port number you want to listen to. Must be the same as what you enter in YG.
route routes different OSC messages such as "/wand", "/bang", "/note", whatever send from YG.
unpack f f f splits up a message into 3 floating-point numbers.
OSCNode Documentation
| Message | Parameters | Default | Description |
| host | string | "localhost" | the hostname or IP address of the sound server computer. |
| port | int | 0 | the port to send OSC messages to on the sound server |
| oscMessage | string osc address, parameter1, parameter2, ... | sends a message over OSC. the meaning of the OSC Address parameter depends on the exact sound server application, but
generally refers to a patch, synth, or function running on the sound server. an OSC Message can contain any number of floating-point values |
(c) Ben Chang