The last weeks I have improved the Simplecanvas app so now it has more features, the main one is that now you are able to share your creations with other people. I am also improving the API so it has more features and makes it easy to animate objects through time.
The only missing thing is the input, I thought it would be nice to be able to interact with the creation through some kind of simple interface. The only supported input is the mouse coordinates which is nice to do some effects but not enought to synchronize with other people.
On that line my friend Graham, an experienced music live-coder, suggested me to add OSC support so he can send me messages from his live coding sessions (using chuck) so I can use them to synchronize the beat in my animations.
I already have WebSockets support for other projects like SharedCanvas using a node.js server (without socket.io, I don’t like that library, it wants to reach so many cases making it hard to work with), the problem is that WebSockets doesn’t allow to connect to any kind of server, only to a websockets server, so I thought of using a bridge server between OSC and WebSockets, I found OSC-web by Vilson Vieira (@aut0mata) but it didnt worked, the version on his website seems to be coded to an old nodejs version, so I decided to make my own using the same library he used, node-osc.
The code is pretty simple, you can download it from here: OSCBridge.js I have only tested it under Ubuntu, but the Windows or OSX version should work if you already have nodejs working with other modules.
To install you will need to install this modules, you can use NPM (be sure to have python installed as it uses it to compile the modules):
npm install node-osc
npm install faye-websocket
To run you write:
node oscbridge.js -port 4343
The port you specify is for the WebSocket, the OSC server will be host in that port plus one (4344)
Right now it only works in one direction OSC -> WebSockets but I plant to expand it so I can send OSC messages from Javascript.
You can try it using this example:
Leave a Reply