Minimal Networking with OSC

Music 256a Homework 4

In this assignment the simple Karplus-Strong string model instrument created in homework 2 was used to implement a "sound field" using minimal networking components through OSC. The RtAudio and RtMidi libraries were used for handling real-time audio output and midi messages, and Ross Bencina's oscpack was used for handling the sending and receiving of OSC messages. Perry Cook and Gary Scavone's STK was used for generating reverb (JCRev). Some utility functions were also taken from Ge Wang's Calories. The project's source files include the necessary files from these libraries and from homework 2, as well as: In order to build the project, download the zipped source folder. Makefiles are provided to compile the code for either Mac OS X or Linux by specifying the correct makefile to use. Typing 'make' at a command line in the source directory will output the correct syntax for specifying which of these makefiles to use.


This program is a fairly simple extension of the Karplus-Strong based instrument implemented in homework 2, meant to be run by several people sitting in a common space but using different, networked computers. Upon running the program, a user simply specifies their ip address, the number of computers they would like to transmit data to, and the ip addresses and "distances" (in feet) of those computers. This then sets up a two-way communication between the computers (once both computers have added each other and begun to run the main program).

Each computer instantiates a Karplus-Strong based instrument for themselves as well as one for each computer they have specified to connect to, and when one computer plays a note locally (via MIDI control input), OSC messages are sent to all of the other networked computers specifying the same command. The local computer then synthesizes a dry output of the notes being input to it, while the networked computers synthesize reverberant versions of the same output with some amount of pre-delay (which is what the "distance" parameter is used for during the program set up) using the Karplus-Strong instrument they each have dedicated to mimic the message sending computer. In this way, each person can play a Karplus-Strong instrument of their own while all of the computers work together to create a spatially distributed reverberant field in the performance space, with the direct sound of each user's instrument coming locally from their computer and the reverberant sound of each instrument being produced at all places where there is a participating computer.

Back to 256a main page