The class SWDataNetworkClient implements an OSC client to the SenseWorld DataNetwork so that an external SC client can also be part of the network. It implements the client side of the OSC interface. It inherits from the class SWDataNetwork to manage the data it receives, and thus has the same interface in its use within SC, with some additional methods for interaction with the host.
In a setup with several collaborators using SC, one of them will act as a host for the network, while the other SC participants register as clients to that host. Since the code interface for both is almost the same, apart from the initialisation, it is very easy for SC participants to prepare and test their own inputs and outputs to the DataNetwork individually, and switch to the shared network during collective rehearsals.
Deriving data from existing nodes can be done for example by combining data from various nodes, calculating statistical properties of data, or smoothing data. To facilitate this, we have developed methods to do this either making use of the language features of SC, or by making use of the server’s unit generators to perform these calculations.
PureData and Max/MSP clients
Two abstractions provide access to the SenseWorld DataNetwork within a Pd or Max patch: dn.node and dn.makenode. Both implementations require a private variable for the host IP address and for the client name (shared between all instances on a client), but otherwise take care of the details of talking to the network.
dn.node subscribes to an existing node, outputting the received data as a list. In Pure Data each instance subscribes to a single node, whereas in Max it is possible to receive data from multiple nodes using a single dn.node object (in which case each node’s data list is preceded by its node ID).
dn.makenode does the opposite, publishing data to the network using a unique node ID. The data must be formatted as a list with a number of elements equal to the number of data slots given as a creation argument to the instance.
Processing and Java
The Processing client is based on the JavaOSC library, and is based around two classes: DNConnection, dealing with the communication to and from the host, and DNNode, dealing with the properties of a DataNode. As the implementation is basically a Java class, the client can not only be used for Processing, but also for any Java program.
The C++ library is based upon liblo for handling OSC communication and consists of a set of classes to deal with the various components of the DataNetwork:
- DataNetwork base class for the network.
- DataNode base class for a data node.
- DataSlot base class for a data slot.
- DataNetworkOSC implements the OSC interface.
- OSCServer C++ class to implement an OSC Server (taken from swonder and slightly expanded)