Multimodal Media Madness - Winter Semester 2005/2006
Due on Monday, November 21, 2005
In this assignment, you will examine the MIDI protocol and the basic MIDI file format in more depth.
If you are not yet up to speed on Java programming, we highly recommend you review some basic Java programming tutorials.
Your assignment for the week is to create a Java program that does something similar to your first Max sequencer from last week. In particular, your program must at least be able to:
- Capture MIDI notes from a port (i.e., our USB MIDI Keyboard) and play them through SimpleSynth.
- Use the number keys 0-9 to select an instrument.
- When you press the spacebar, the program should take your input and record it to a MIDI file. The program should stop recording when you press the spacebar again. This MIDI file should play correctly in QuickTime. You do not have to keep track of the timing information or any program changes -- just record each note one by one, spaced evenly apart to the MIDI file.
Please note the following:
- When communicating to SimpleSynth via MIDI, you must compose the MIDI messages yourself manually. Do not use the built-in APIs for sending note on/off messages or program changes.
- Likewise for writing out to a MIDI file, you must write the code for outputting a MIDI-compatible file yourself, without using any third-party libraries/source code. For this assignment, it is enough to create a single-track MIDI file.
- Be sure to comment your code! If we cannot understand what you are doing, you will lose marks (especially if your code doesn't work as expected)
Hints and Tips:
- You must start SimpleSynth if you wish to hear sound. (Use this instead of GarageBand).
- You may find this specification of the MIDI protocol useful. We've also created a skeleton MIDI controller class to get you started (this class uses Apple's CoreMIDI API's, and will most likely not work on anything other than a Mac).
- The MIDI file format is described in various places: borg.com, wotsit.org. This description is a good start. We've also created a sample MIDI file which contains 3 evenly-spaced notes (C, D, E) for reference.
- We recommend using the
FileOutputStream
class for writing out binary files (do not useFileWriter
as it passes your input through a virtual character translation table). - MIDIMonitor is a useful debugging tool to see what kind of MIDI messages are being sent around the system.
- HexEdit is a good tool for looking at the contents of binary files. You may find it useful for debugging your MIDI files.
- To capture keystrokes, the easiest way is to probably create a Java Swing window and listen to keyboard events. No other GUI is required for this assignment.
To develop your program, you may use the command line Java tools or Eclipse, a popular Java IDE. If you are really feeling brave, you may also develop your program using XCode, Apple's IDE. You can launch a UNIX prompt by opening Applications -> Utilities -> Terminal.
This assignment is to be completed in groups of 2.
Some ideas for extra credit for this assignment:
- make the MIDI note play for as long as you hold down the key on the keyboard (this involves changing our skeleton class)
- preserve timing information in your recording to MIDI file
- support program changes in your recording to MIDI file
- make a nice GUI that allows users to choose the input- and output ports
- etc... (use your imagination!)
Email an archive of your assignment to
before the due date. The subject of your email should be "M3 Assignment 3"; be sure to use this exact subject line as it will be used to filter assignment submissions for grading.
Your assignment archive should include all files required to compile and run your Java code. Do not include compiled object (.class) files. Include a short plain text README
file that contains:
- the names and email addresses of all group members
- instructions on how to compile and run your code
- a short description of what your program does
- non-obvious things you did (if any)
- if you did any extra credit work, be sure to tell us what you did
Note: This is a major programming task just, just like the following assignment. We have scheduled two weeks for this assignment and an additional week for the next one. The sooner you finish the first task, the more time you have to spend on the next assignment.
Be prepared to discuss your solution in the next lab.
The assignment will be graded on the following rough scale:
- 1.0 - exceptional work that clearly went above and beyond what was given on the exercise
- 2.0 - exercise was completed satisfactorily as per the assignment specification
- 3.0 - exercise was completed, but has some problems
- 4.0 - incomplete exercise
- 5.0 - little or no effort was put into the exercise
Late assignments will be graded with a penalty of 0.5 per 24 hour period after the due date.