Illposed Software — Java OSC (Download)
Overview
JavaOSC is a library for talking the Open Sound Control (OSC) protocol in Java. It is not, in itself, a usable program. Rather, it is a library designed for building programs that need to communicate over OSC (e.g., SuperCollider, Max/MSP, Reaktor, etc.)
Download
| javaosc.zip | The 20060402 release (April 2, 2006). |
| javaoscdoc/ | Browse javadoc for the library |
Examples
Sending:
OSCPort sender = new OSCPort();
Object args[] = new Object[2];
args[0] = new Integer(3);
args[1] = "hello";
OSCMessage msg = new OSCMessage("/sayhello", args);
try {
sender.send(msg);
} catch (Exception e) {
showError("Couldn't send");
}
Receiving:
receiver = new OSCPortIn(OSCPort.defaultSCOSCPort());
OSCListener listener = new OSCListener() {
public void acceptMessage(java.util.Date time, OSCMessage message) {
System.out.println("Message received!");
}
};
receiver.addListener("/sayhello", listener);
receiver.startListening();
Manifest
| build/ | where ant puts the .class files |
| build-support/ | a MainClass.mf for the build |
| doc/ | javadoc for the library |
| lib/ | libs used and generated by JavaOSC |
| javaosc.jar | the JavaOSC library |
| javaoscfull.jar | the JavaOSC library plus test and examples |
| junit.jar | the JUnit test framework |
| puredata/ | PureData file for the PD example |
| src/ | JavaOSC source |
| supercollider/ | SuperCollider files for the examples |
Use
Look at the code in com.illposed.osc.test.OSCPortTest or the simple UI located in com.illposed.osc.ui.OscUI
To Run &mdash SuperCollider demo
JavaOSC is not a standalone application — it is designed to be used in other applications. But, for demonstration purposes there is a very basic app created by John Thompson and improved by Martin Kaltenbrunner.
To run the demo, run the javaoscfull.jar file. On the Mac, you can double click the library "lib/javaoscfull.jar". There is also a "run" ant task you can execute by typing "ant run".
Next launch SuperCollider. Open the file located in the "supercollider/" directory and load the synthdef into SuperCollider. Start the SC local server running.
Click the "All On" button an start moving the sliders. You should hear the sounds change.
To see what messages the UI is sending, run either the CNMAT dumpOSC, or turn on dumpOSC in SuperCollider.
To Run &mdash PD demo
There is also a Pure Data patch created by Alexandre Quessy.
To try the demo app with Pure Data, launch Pure Data and open the file "javaosc.pd".
Turn down the volume a bit at first, as it might be very loud. Click the "All On" button an start moving the sliders. You should hear the sounds change.
To see what messages the UI is sending, just look in the Pd window or in the terminal.
Thanks
Thanks to John Thompson for writing the Java demo app, Alexandre Quessy for the PD demo, and to Martin Kaltenbrunner and Alex Potsides for making improvements to the code!