flosc is a Java server that can communicate with anything that uses the OpenSound Control protocol. This includes software audio synthesizers like Max/MSP, Reaktor, and SuperCollider, and hardware like Lemur and SmartController. It can also communicate with Macromedia Flash (versions 5 and later) using Flash’s XMLSocket feature. flosc acts as a gateway between OSC and Flash, allowing messages to go in both directions. This enables many combinations of powerful, programmable platforms for high-quality animation, audio, video, and interactive production. flosc can accept simultaneous input from multiple OSC connections and Flash clients, and can broadcast messages to multiple Flash clients, but it does not do any routing. Think of it as a simple gateway or bridge between the UDP world of OSC and the TCP world of Flash XMLSockets.
Matt Wright accurately summarized flosc as:
“A standalone application written in Java that sends and receives OSC packets via UDP, translates bidirectionally between binary OSC packets and an XML encoding of OSC packets, and sends and receives XML entities via TCP in a way that’s compatible with Flash’s XMLSocket feature.”
Download
You can get everything, including precompiled class files and an example Flash client, from: http://github.com/benchun/flosc/downloads
You can also see (and fork!) the whole project here: http://github.com/benchun/flosc
The code might be useful if you want to learn how to write a recursive OSC packet parser in Java, or how to parse or create XML in Flash, or how to create a 4-byte boundary aligned array of bytes from objects in Java. Why reinvent the wheel?
License
With the exception of the noted inclusions of other free and open source software, flosc is Copyright © 2004 Benjamin Chun. You can do anything you want with flosc and the source code, including create new software and sell it, pursuant to the terms of the LGPL 3 license.
Installation and Use
Put the files anywhere you like. Be sure you have a Java runtime environment version 1.1 or later installed. (All versions of OS X come with this, so that makes your life easy if you’re on a Mac.)
Run the server like this:
java Gateway oscPort flashPort
where oscPort is the port where flosc will receive OSC packets (the UDP port for it to listen on), and where flashPort is the port to which Flash clients will connect (the TCP port you’re using in Flash).
To learn how to send and receive OSC packets using your application of choice, see the application documentation or the OpenSound Control site. Start the server, connect your Flash client, and send some packets back and forth. Then, all you have to do is think of something interesting to do with all this technology.
Applications
People have actually used flosc to make stuff. Really! Here’s proof:
Project Eclipse – Modular synthesis patch interface
Contemplace – Responsive environment
Space Jockey – Sound source positioning
Luminance – Interactive playground
Let me know if you’ve got something to add to this list. And if that stuff’s not stuffy enough, here’s a paper: OpenSound Control: State of the Art 2003 [PDF] and a conference proceedings.
Credit
This project is inspired by work done with my friend Sam Torrisi. Thanks to Colin Moock and Derek Clayton for their examples of basic XMLSocket communication in Flash, and the design for the example Flash client. Thanks to Sean Rooney for taking flosc, improving it, generalizing it, and then sharing it back. Thanks to Jesse Gilbert for actually reading the comments in my code and reminding me what static does in Java. Thanks to Dr. Toast for moving in with me so I would have to fix the bugs I was leaving open. And, of course, we would be nowhere without Matt Wright and the CNMAT crew.
flosc includes code from the (now-defunct) Java Apache Project — see Bytes.java for more information. It also includes code written by Phil Scovis — see TcpServer.java for more information. Open source is a good thing.
Pingback: Nick Fox-Gieg’s Tutorials » Kinect Setup Links
Pingback: MIDI2 – Java MIDI/Socket Server | A.Quarter.To.Seven
Pingback: AIR – Max/MSP – WiiFlash | Code Stuff
Pingback: Eyecon – rastreamento de movimento « Leandro De Maman
Wondering if anyone has considered using orbited ( http://www.orbited.org/ ) or similar to allow interaction with javascript. I would like to be able to control chuck ( http://chuck.cs.princeton.edu/ ) via Javascript; using flash in not an option for me.
– Rich
Pingback: HTML5 + Flash (stop with the versus already) | Justin C. Rounds
Pingback: Flosc – Animation | Where the action is
Pingback: Opening a local socket from an SWF file | Jean-Philippe Côté
I am trying to achieve the same thing as Robert Beattie. Anyone who got this working?