Illposed Software — Java OSC (Download)


Background

I originally wrote javaosc in 2002 in order to get some Java code I had communicating with something I had implemented in SuperCollider. A year later, I rewrote what I had and added support for receiving OSC messages as well as sending them. At that time, compatibility with the Java 1.1 JDK was important, since that was what was supported by Internet Explorer, an important platform to consider when writing applets. This restriction became increasingly annoying, but my migration to Objective-C as my primary development language, which had started in 2001, had became progressively more complete, and by 2005, I was hardly doing any Java at all. So, I never had an opportunity to revisit and modernize my JavaOSC code.

Java, of course, continued to develop as well, with new versions coming out periodically, and, from time to time, users of javaosc would send me patches fixing compatibility with newer versions of the JDK or fixing bugs they found. I was always very grateful for these patches, who doesn't like to see that their software is being used, but I became slower and slower and integrating them into the main codebase because I was doing so little work with Java, much less JavaOSC.

Several years ago, I tried, together with some users of the library who had submitted patches, to move the code to SourceForge and get greater community involvement in the project, but it never took off. In the meantime, I have returned to doing more Java, but I do not do any music apps with it anymore. That's why I was very thankful when hoijui contacted me earlier this year and asked about making the code available in more up-to-date environments: git and Maven. At the same time, he updated the code to bring it up to Java 1.5 compatability.

For users new to javaosc, I would recommend starting with hoijui's git repository or the Maven central repository. I will continue to host javadoc for the project.

Download

JavaOSC [github] JavaOSC source from github
JavaOSC [Maven] JavaOSC in the Maven central repository
javaoscdoc/ Browse javadoc for the library [not yet updated to the current git version]

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();

Use

Look at the code in com.illposed.osc.test.OSCPortTest or the simple UI located in com.illposed.osc.ui.OscUI

To Run — 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 — 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, to Martin Kaltenbrunner and Alex Potsides for making improvements to the code, and to hoijui for modernizing and taking over the code.