Page  00000001 A Realtime MIDI Library for an Inexpensive General-Purpose Microcontroller-Based Interactive Performance System Colby N. Leider Bregman Electronic Music Studio, Dartmouth College, colby Abstract Artists' demands for innovative, application-specific control interfaces for computer music performance and multimedia installations necessitate a powerful yet easy-to-use and inexpensive multipurpose system. The author proposes a library of MIDI routines for the Handy Board. The Handy Board, designed by Fred Martin of the MIT Media Laboratory as an MC68HC11 development platform for educational robotics use at the university level, is easily interfaced with sensors and actuators to transmit MIDI data. It is inexpensive (under US$300), battery-powered, lightweight, easily programmed, and widely used and supported. The Realtime Musical Instrument Digital Interface Library for the Handy Board and accompanying documentation facilitate the rapid creation of unique and expressive custom controllers and installations with little or no prior software or hardware skills, making it ideal for educational use. 1 Motivation The evolution of inexpensive, easy-to-program microcontrollers has in many instances blurred the division between artist/composer and design engineer in the creation of alternate controllers and interactive art. The purpose of this project was to implement a general-purpose data acquisition system that could be used to create interactive art with a minimum of time, money, and technical knowledge. Pressing [5] discusses the recent growth of "computer-based interactive music systems", and Mulder [4] outlines four scenarios in which a generalpurpose system would be useful: 1. interactive installations that respond to environmental phenomena; 2. interactive installations that respond to an audience; 3. non-immersive interactive performance systems that respond to a performer; and 4. immersive interactive performance systems that respond to a performer. Several commercial systems are available, notably the I-Cube from Infusion Systems [4] and the SensorLab from STEIM. Figure 1: The MIT Handy Board. The Handy Board is especially well-suited for educational use and small- to medium-scale, budgetconstrained projects. It is designed for ease of use, even for those without prior knowledge of programming or electronics. The Handy Board is used in computer science and robotics courses in several colleges in the United States in which students are given a specific time frame to construct a robot using Legos, motors, and several sensors. It is equally well-suited for undergraduate electronic and computer music courses in which students design and implement new instruments or interactive installations. The Handy Board possesses several features

Page  00000002 which make it suitable for interactive art, including 32K battery-backed RAM, four motor outputs, two programmable buttons and one knob, a 16x2 character LCD screen (accessible via standard C printf statements), powered header inputs for nine digital sensors and seven 8-bit analog sensors, infrared transmitter/receiver, and an expansion bus for adding multiplexers (enabling more sensors to be attached) [2]. Furthermore, the design is public domain and therefore freely modifiable and expandable. 2 Overview Figure 2 provides a system-level overview of the Handy Board in an interactive environment. 3 Realtime MIDI Library The Handy Board Realtime MIDI Library consists of a collection of functions written in Interactive C 3.1 which calibrate, scale, and format sensor inputs and produce MIDI messages. Interactive C is a subset of ANSI C that includes an integrated compiler/debugger and supports structures, multidimensional arrays, pointers, command-line execution, and multitasking [3]. Interactive C compilers exist for Macintosh, UNIX, and PC-compatible computers. The Realtime MIDI Library provides an application framework similar in functionality to that described by Linz [1]. Programs continuously poll sensors and call functions of the library to generate the appropriate MIDI output stream. The Handy Board is also capable of interrupt-driven processing, although the current library uses polling to keep programming as simple as possible. Using the library, the user can scale the input values from sensors attached to the Handy Board's digital and analog inputs and output the desired MIDI stream. Figure 3 illustrates code which drives an installation consisting of a sculpture equipped with a photoresistor and temperature sensor (about US$2 total). The code in Figure 3 continuously polls the light and temperature sensors and sends a MIDI note on message to channel 1 whenever the ambient light level in the room changes. In this simple example, the light level controls the MIDI note number, and the temperature controls the MIDI note velocity. 4 Design Examples To illustrate the simplicity and affordability of interactive projects with the Handy Board, this section discusses the design process for two simple controllers used in performance at Dartmouth College. 4.1 Light-Sensitive Drum Sticks Drum sticks are equipped with photoresistors on the tips. On one side of one of the sticks (where the player's thumb falls) is mounted a small force-sensing resistor (FSR) from Interlink Electronics, Inc. Standard RJ11 telephone cable is soldered to the leads of the photoresistors and the FSR and is connected to three analog inputs on the Handy Board. The user knob on the Handy Board controls the light threshold level above which MIDI note on messages are sent and below which MIDI note off messages are sent. The drum sticks are played in the air in the vicinity of a light source (e.g., the monitor of a computer screen), and the thumb pressure on the FSR controls Figure 2: The Handy Board in an interactive environment. Typically, the user writes code in the Interactive C environment (although other MC68HC11 assemblers and compilers work as well) and downloads it from a computer to the Handy Board. Then, the Handy Board is connected to sensors, actuators, and MIDI equipment and can be run from battery power without further use of the computer. Connection of sensors to the Handy Board is trivial. Internal pullup resistors allow direct connection of photoresistors, temperature sensors, force-sensing resistors, potentiometers, etc. without further circuitry. (Linz [1] provides an excellent overview of various sensors.) Furthermore, the onboard infrared transmitter/receiver allows a standard Sonycompatible remote control to communicate with the Handy Board, and mapping each button of such a remote control to transmit specific MIDI data is straightforward. The Handy Board can also be easily interfaced with sonar rangefinding devices, including the Polaroid 6500.

Page  00000003 [ __J __ installation.c Lu void main() int last, current, temp; enable..midi0; overdriveonr); while (!start-button0); last = 0. current = 0; /* enable MIDI on the 6811 serial control interface */ /* turn off IR transmit/receive to increase sampling rate */ /* wait for start button on Handy Board to be pressed */ /* initialize the last and current values... /*...of the photoresistor to zero */ */ while (!stopbutton() { /* continue polling sensors until stop button pressed */ current = (127 - analog(0)); /* a photoresistor is connected to analog port 0 */ temp = analog(1) / 2; /* a temperature sensor is connected to analog port 1 */ if (last - current) ( noteon(1, current, temp); /* send a chi note on message when light changes */ last = current; I 1111 1 Figure 3: Example code in Interactive C for simple processing of photoresistor and temperature sensor data in an interactive sculpture. the MIDI volume level. Fewer than 40 lines of C code are required for basic MIDI functionality on this particular controller, and the total cost (apart from the cost of the Handy Board) is approximately US$11. 4.2 Pressure-Sensitive Data Glove Force-sensing resistors are attached to the fingertips of a glove, and standard RJ45 cable is soldered to the FSR solder tabs and connected to the analog inputs of the Handy Board. Each finger is assigned a different MIDI channel, and MIDI data is transmitted every time the user touches a surface. For example, touching the index finger on a surface triggers a note on event on channel 1, after which the finger pressure is interpreted as modulation depth. Approximately 50 lines of C code are required for basic functionality, and the total cost (apart from the cost of the Handy Board) is approximately US$25. 5 Conclusions The Handy Board, while not offering as many sensor inputs as other systems, is ideal for educational use and budget-constrained and portable interactive art projects. Using the Realtime MIDI Library, sensor data is easily formatted and mapped to MIDI data with a minimum of technical knowledge. 6 Acknowledgments The author would like to acknowledge the help and input of Kristine H. Burns, Larry Polansky, Charles Dodge, Jon Appleton, Scott Lawrence, Leslie Stone, Kevin Parks, and Empi Esguerra and the support of the Bregman Electronic Music Studio. References [1] Linz, R. 1996. "Towards the Design of a RealTime Interactive Performance Sound System", Leonardo Music Journal, Volume 6, pp. 99-107. [2] Martin, F. 1996. "The Handy Board", projects/handy-board. [3] Martin, F., A. Wright, R. Sargent, and C. Witty 1996b. "Interactive C User's Guide", [4] Mulder, A. 1995. "The I-Cube System: moving towards sensor technology for artists", /amulder/personal/infusion/ISEA95.html. [5] Pressing, J. 1990. "Cybernetic Issues in Interactive Performance Systems", Computer Music Journal, Volume 14, Number 1, pp. 12-25.