Skip to content
Sara Adkins edited this page Jan 11, 2017 · 20 revisions

The software team of RobOrchestra deals with writing the code that controls the performance of the orchestra using timed MIDI messages. We write music generation algorithms that generate unique polyphonic music in real time. Because many of our algorithms are probability based, you will never hear the same piece twice when running our algorithms! We currently have two different methods we use to send MIDI messages to the orchestra: Processing's MidiBus Library(recommended for windows users) and the Java Sound API(recommended for mac users). Regardless of your computers operating system, it is recommended you set up both methods.

MidiBus Setup

  • Download Processing and install it. Processing is a java-based software sketchbook that has many convenient libraries for creating audio and visual art.
  • Open Processing. In the toolbar navigate to sketch>import library>add library. In the search bar type in "midi" and the library called "The MidiBus" should come up. Select the library and click install
  • To test your setup, navigate to Examples/MidiBus_TestCode on the github repo and open the file MidiBus_TestCode.pde. The file should open in Processing. Press the play button to run the code. You may have to adjust the output variable to get the correct MIDI output for your computer. The indexes for your computers MIDI outputs will be listed in the console when you run the code.
  • If you are running the test code on a Windows machine, you should hear sound. Mac users may not hear any sound output because OS X does not include a built in MIDI sequencer like Windows does. However, when the orchestra is plugged into a Mac machine, it will be able to send MIDI messages to the orchestra.

Java Sound API Setup

  • Download the Java JDK and install it. The Java JDK includes the Sound API that we will use.
  • Install a Java IDE of your choice. Some commonly used ones are NetBeans, Eclipse and IntelliJ. The IDE is just an environment where you run and edit your Java code, so you cal use any program you like.
  • Download Processing and install it.
  • To test you setup, navigate to Examples/Midi_Interface_Test in the Github repo, and open Midi_Interface_Test.pde. The file should open up in Processing.
  • Run the code by pressing the play button. If you are not hearing sound, you may have to alter the deviceIndex variable. Once you run the code, a list of available MIDI Output devices will appear in the console along with their indexes. Alter deviceIndex to these options until you hear sound when the code runs.

Using the MidiBus

The MidiBus is a library for Processing that allows us to send MIDI signals to either our computer speakers or to the RobOrchestra via USB. Processing is really a simple IDE for Java, so any java functions or syntax can be used in processing. What separates Processing from Java is that .pde(processing files) all have a setup() and a draw() function. The setup() function is run once when the code starts and then the draw function runs and loops until the program is stopped. Also unlike with Java, not everything in Processing has to be a class. You can define functions and variables directly, like you would in Python.

For a simple example of how RobOrchestra uses the MidiBus library, look over the file Examples/MidiBus_TestCode/MidiBus_TestCode.pde on the Github. This program sends the MIDI notes of a chromatic scale to either your computer's speakers, or Xylobot, if it is plugged into your computer.

The function MidiBus.list() prints to the console a list of your computers available MIDI ports. When RobOrchestra is plugged in, it will come up in this list as "USB-MIDI-2.0"(or something similar). Use the output of this function to alter the input and output variables of the MidiBus to route signals to your speakers or to the orchestra

Documentation and Resources

The MidiBus Library Documentation contains information on all MidiBus classes and functions. Of importance to RobOrchestra are the MidiBus class, the Note class, the MidiBus.list() function and the MidiBus.sendNoteOn() function

If you're interested in learning more about processing, you can check out the Reference and Example pages on the Processing website

Using the Java Sound API

Coming soon...

Clone this wiki locally