OSC – Open Sound Control

For some reason, MIDI isnt dead yet, although it is indeed ‘ubiquitous and lightweight’ that doesn’t mean it should stick around. For some tasks its fine, but its definitely starting to show its age. One of the alternatives for communication between audio / video software and devices is Open Sound Control – OSC.

Im not going to go into a deep discussion of MIDI vs. OSC at this point, there are of course some benefits to MIDI which OSC should deal with in some way (e.g. a standardised namespace for representing MIDI semantics, or a discovery mechanism for that namespace..)..anyway, I just want to let you know that I’ve been working on some OSC related stuff to make using it easier from both Actionscript 3 and Max/MSP.

First up is OSCLib, this is intended as a low level set of OSC libraries which you can use in other applications. Actionscript 3 doesnt have UDP, only HTTP sockets whereas most OSC implementations (e.g. Reaktor, Bidule) are UDP based although one notable exception is SuperCollider which supports both. So to help bridge the gap there are java implementations for both HTTP and UDP clients and servers (well, the UDP server is currently missing but should be done in a day or two..)

For Max/MSP there is an MXJ object which wraps the HTTP server so you can send messages from a Flash / Flex client directly to Max/MSP.

There is some documentation on the project wiki pages for getting your dev environment setup and also a Flash / Max demo you can try out.

As a side note if anyone has a Korg Kontrol49 then i’ve also got a project based on OSCLib for working with the Kontrol49 in native mode : KontrolTools. This allows you to have full control of the lights and text displays via OSC as well as generate OSC message from all the knobs, sliders and buttons.

Reaktor Sample Map Generator

Reaktor is great, but one thing that i dont like about it is the built in sample management, you have to create these ‘sample maps’ to use your own samples but the UI for it is a bit rubbish, like an awful version of kontakt. so i built a tool to generate map files automatically.

UPDATED
I’ve built a new version in Java which is tested and working on both Windows and OSX. You can download the app here.

I’ll put the source up soon when I get a spare minute.

comments, suggestions, modifications are all welcome.

UPDATE 2
If you are wondering how to run a .jar file then you will need to first download and install java then you should then be able to just double-click the .jar file. If for some reason that doesnt work you can ‘Open With…’ and then find where java is installed, somewhere like : C:/Program Files/Java/jre1.6.0_07/bin and choose the ‘javaw.exe’ program.

Java and zip files

I’ve just spent a day debugging what at first appeared to be a permissions problem. Im using the jakarta commons file upload with a tomcat / spring setup to allow users to upload zip files, which are then unpacked and the contents are processed into a database. Obviously using a zip should make it easier to upload multiple files and directory structures.

What was happening is that the directory entries I expected to be in the zip werent being created, so none of the files could be written when it was unpacked. Eventually i discovered that the problem was related to how different tools create zip files. I use winrar, which creates a seperate entry for a directory, as luck would have it the tool my client was using doesnt.

So, if you are writing java code to unpack zip files you will be better off doing something like this :

Enumeration entries = zip.entries();

    while (entries.hasMoreElements())
    {
        ZipEntry zipEntry = (ZipEntry) entries.nextElement();
        File file = new File(outputDirectory, zipEntry.getName());

        // check the parent of this entry to see if it exists
        if(!file.getParentFile().exists())
        {
            file.getParentFile().mkdir();
        }

	InputStream is = zip.getInputStream(zipEntry);
        FileOutputStream fos = new FileOutputStream(file);

	while (is.available() > 0)
        {
            fos.write(is.read());
        }

	fos.close();
	is.close();
}

rather than just checking if zipEntry.isDirectory() and then doing a mkdir.

Of course its wise to do both, because the zip may contain empty directories and you might rely on them being present later on.