Detailed Documentation of the Max5 Client

Tutorial A: Help Patches

Assumptions

  • The senseworld server is already running (the Max5 patches won’t be useful without an operational server). If you haven’t gotten the server going, please refer to its documentation and get it up and running.
  • You must know the IP address of the datanetwork server.
This is a dn.makenode.tutorial screenshot

FIGURE 1: MakeNode Window

Getting started

  • Look at dn.makenode.tutorial in the ssdn_max5 folder. It gives you a basic example of how to create a data node using the dn.makenode object and how to subscribe to this node on the network using dn.node objects.
  • You will have to modify the pv dn-host object to use the IP address of your datanetwork server. Save the patch if you have to modify this object so that you don’t have to do it again.
    If all goes well the dn.makenode and dn.node objects will both connect and register to the datanetwork. If you don’t see anything from “SENSEWORLD” then you aren’t connected to the server (or the server is not running).
  • If you change the numbers going into the “pack” object above dn.makenode, you should see the data appearing in the Max window as messages from the server as well as in the message box underneath the “dn.node” object.

Going further

Using dn.makenode and dn.node objects in a custom patch, you can get data from any node for which you know the ID number, and you can publish any data you like by making your own node. You can even take data from a node, process it using your Max skills, and publish the output using a dn.makenode object — then other clients in any of the supported languages (Max/MSP, processing, C++, Pd, SuperCollider) can use your processed data for further processing. Have fun and be safe!

Tutorial B: Starting From Scratch

This section will teach you how to get a patch going from scratch, assuming that a Senseworld Datanetwork host is currently running and that there is a node to subscribe to.

Max5 Window showing dn-host

FIGURE 2: pv dn-host

First, create a new patch and add a private variable called dn-host with the host’s IP address as a creation argument. This variable will be referenced by all of your node and makenode objects.

Max5 Window showing dn.node object

FIGURE 3: dn.node

Now add your first dn.node object. Its creation arguments are the name of your client (pick one) and the node ID on the network, in this case 103. In my case, this node is a minibee with a light sensor on it.

Optionally you can type several node IDs as arguments, and the object will subscribe to all of them. In this case you should only use the right outlet of the object since it tags the messages with the node ID. The left outlet only outputs the first node subscribed to.

Another option is to add or remove node subscriptions dynamically using the “add” and “remove” messages.

You can see here how the data from the node is now available for use. Let’s make a very simple example of how to process this data and re-publish it as a new node, which will demonstrate the use of multiple nodes and a makenode in the same patch.

Max5 Window showing dn.node and dn.makenode object

FIGURE 4: Using dn.makenode object

This patch simply takes the light level output of node 103, checks to see if it is above a certain threshold, and then outputs the result of the threshold comparison to a new node. Notice the creation arguments of our dn.makenode object: first the client name, next the makenode ID (arbitrary but should be unique: I’ve chosen 789) and then the number of slots (just one for now) and if possible a simple description of the node.

Max5 Window publishing data with dn.makenode

FIGURE 5: Seeing the data you publish

Here we have made a second dn.node object to show how our dn.makenode is publishing data. Currently the light level is too low to pass the threshold, but soon it will be brighter, and oh what a time we will have!

Max5 Window seeing the data you published

FIGURE 6: The data you publish is available to others using dn.node

Wow! Check out that thresholding action. In your applications of these concepts you’ll probably be doing more than just checking a light level. Hopefully this tutorial will have given you a starting-off point from which to build your SenseStage project!

Comments/Questions

Comments are closed.