Design for a Microtone and Brain Wave Generator Wayne J. Kirby University of North Carolina at Asheville kirby@... There have been a number of attempts by software developers to create computer algorithms to facilitate the composition, performance, and teaching of music in tunings other than the traditional equal temperament system ubiquitous in our Western culture. Others have sought microtonal control of sound generators in order to facilitate sonic entrainment of the brain (Atwater, 1988). The general purpose of this study was to design and implement a computer-based system for generating microtonal tuning. First, I reviewed several MIDI technologies currently available for the generation of microtonal music. Second, I engineered and programmed a MIDI-based computer algorithm that would permit the user to create microtonal tuning using commonly available MIDI synthesizers. Finally, I designed and implemented a method for generating pairs of microtonally-related pitches to be used to induce hemispherically synchronized entrainment of the human brain. Several terms used in this study are defined as follows. Constant ratio tuning, means that the ratio between any two adjacent notes in a given scale does not change. An example would be the relationship between any two adjacent notes of an equally tempered scale, which remain constant at a ratio of 1:1.0594631. Variable ratio tuning has been used to denote those scalar arrays based on ratios that vary from one pair of adjacent scale tones to another. The term "binaural beats" has been used to indicate the "slow modulations . . . [that] are perceived when tones of different frequency are presented separately to each ear" (Oster, 1973). I assume that the reader is familiar with The Complete MIDI 1.0 Detailed Specification published by the MMA (MIDI Manufacturers Association, 1996). Since a discussion of sonic entrainment is beyond the scope of this study, you may wish to consult the following sources. For introductory information on the neuropsychology of binaural beat frequencies, consult Gerald Osters article entitled Auditory Beats in the Brain (1973). You will find relevant information on the theory of sonic entrainment in Jonathon Goldmans article entitled Sonic Entrainment (1991). Information on the phenomenon of hemispheric synchronization can be found at the World Wide Web site of the Monroe Institute (1998). My efforts to review MIDI technologies currently available for the generation of microtonal music began with a search over the Internet. The availability of information on microtonal music has steadily increased, particularly as the number of World Wide Web sites containing information on the subject has risen. John Starret (1997) has assembled one of the more comprehensive listings of microtonal music resources. In it he has provided links to over two hundred web sites. In the course of reviewing many of these sites it became apparent that there were four principal approaches used by MIDI developers in their efforts to create a satisfactory solution to the problem of microtonal control of MIDI systems. One method of microtonal control available to users of some MIDI systems is the utilization of preset tuning tables built into individual devices. The Proteus/2 digital sound module manufactured by E-mu Systems, for example, provides several preset tuning tables including Vallotti, Just, 19-tone Equal Temperament, and Gamelon. The resolution of this device is limited to 1.56 cents (1/64^th of a semitone). One of the more recently released samplers, the Kurzweil K2500, fares only slightly better at a resolution of one cent. An online listing of synthesizers and their corresponding tuning resolutions clearly indicates the paucity of instruments with a tuning resolution much better than one or two cents (Microtonal Synthesis Homepage, 1997). Another technology available to MIDI users is the user-definable tuning table. The user-definable tuning table available on the E-mu device mentioned above allows the user to upload a single tuning to the unit using System Exclusive messages. Again, the resolution is limited to 1.56 cents. Only one user-defined tuning at a time may be stored in the units RAM. However, it is possible to tune this device across the entire 128 MIDI note range. This is not the case with the Kurzweil K2500. This instrument will only allow the uploading of tunings that remain the same from octave to octave, which precludes the uploading of full-keyboard intonation tables. Probably the most promising, but least implemented approach to microtonality in MIDI systems is the bulk tuning dump introduced in 1992 by the MMA. This standard transmits tuning data to a resolution of 16,384 units per semitone. Unfortunately, very few manufacturers fully support this standard, if at all. The MMA specification indicates that "instruments may support the standard without . . . necessarily providing this resolution in their hardware; the standard simply permits the transfer of tuning data at any resolution up to this limit." One example of this limitation can be found in the E-mu Classic Keys sound module. This instrument will receive the high-resolution tuning dump data, but will actually tune the instrument to a resolution of 1.65 cents. Some attempts to microtonally control the tuning of MIDI systems have involved the use of MIDI Pitch Bend data which bend the equally tempered pitches to the desired tuning. This approach has, up until now, met with very limited success. The problems inherent in such a system are usually caused by the fact that Pitch Bend data is channel-specific. For this reason, multiple pitches transmitted on a single channel must all respond to the same Pitch Bend information, making discrete tuning of multiple pitches impossible. Attempts have been made to utilize multiple channels simultaneously; each channel assigned to a single note. This permits a sixteen note polyphonic tuning to be possible. This approach, while more effective than the single-channel approach, has its limitations. If the system sends a Note-Off followed by a Note-On message, the original notes decay, if there is one, will be detuned by the second notes Pitch Bend message. After reviewing the available information, I decided to develop a tuning algorithm based upon a variation of the Pitch Bend method described earlier. After some experimentationand wishing to eventually have some Pitch Bend range available for real-time musical expressionI decided to limit the Pitch Bend range for tuning purposes to two semitones in the receiving device. This default Pitch Bend range of two semitones yields a tuning resolution of 4096 units per semitone, i.e., the range between zero bend and maximum bend (one half step above the note being raised). The lower portion of the bend range (another 4096 bend units), used for bending pitches downward one semitone, was not used. One additional advantage of this bend range is that it coincides with the General MIDI Standard default value of two semitones. Users of computer sound card synthesizers reported that this two semitone default range obviated the sometimes cumbersome (or impossible) task of changing the bend range of a sound cards on-board synthesizer. As mentioned earlier, one of the challenges of using Pitch Bend messages in microtuning is to keep the Pitch Bend message for one note from interfering with the Pitch Bend messages intended for another note. This problem can only be addressed by sending each Note On message (preceded by the appropriate Pitch Bend message) over its own channel. There are two additional requirements needed to allow this strategy to be successful. First, a Note Off message must not be followed immediately by a Note On message over the same channel. To do so risks the possibility of the preceding notes decay (if there is one) being detuned by the new notes pitch bend data. The second requirement is that all channels being used must be set to the same Program (or "Patch") change value so that all notes are of the same timbre. To address the first requirement, I devised a "dynamic channel allocation" algorithm that significantly minimizes Pitch Bend interference among polyphonically generated pitches. When my program receives a Note-On message, it calculates the appropriate MIDI note number and Pitch Bend to achieve the desired frequency . It searches for a channel not currently in use then transmits the data over that channel. Until a Note-Off message is received for the original Note-On message, the respective transmission channel remains unavailable. When the next Note-On message is received, the system cycles to the next available transmission channel. The process is repeated for all incoming Note-On messages from the controller up to the sixteen channel limit of the MIDI system. When more than sixteen notes are played in very fast succession, there may be some Pitch Bend interference with patches that have a relatively long decay time. Usually there is sufficient masking under these circumstances to make these detuned decays inaudible. I addressed the second requirement, that of maintaining the same Program or "Patch" for all channels, in two ways. The first was to, upon receipt of a Program Change from the controller device, re-transmit that information to all channels in use for data output. As an alternative to inputting this information from a controller, an on-screen dialog box was provided for the user to input Program Bank and Program Numbers "on screen." This feature was provided for users not able to transmit Program Change commands directly from their master controller. One of the limitations of this approach is the number of programs that can be used simultaneously with Pitch Bend microtuning. If all sixteen channels are in use for tuning then, because of the "dynamic channel allocation" feature, only one timbre or Program can be used. To address this limitation, I devised a dual input controller function. This function allows input to be received over two independent, user-selectable channels. Each of these two input channels then transmit to the receiving device over channels one through eight and nine through sixteen respectively. Each of these two independent systems is then able to utilize and change its own separate Program. In testing this algorithm for dynamic allocation of channels, several users reported that their sound modules produced a percussion sound every sixteen notes (when using all sixteen channels) or every eight notes (when using two input controllers). The unwanted sound was produced by percussion Program voices which are to be assigned to channel ten according to the General MIDI Standard. To alleviate this problem, a switch was added to the software which, when activated, caused the channel allocation algorithm to disable channel ten for data transmission. The algorithm first requires the calculation of data that are loaded into five arrays. The first array contains the reference frequencies (corresponding to the 128 MIDI note numbers). The second array contains the output frequencies (the desired frequencies to be output by the MIDI receiver). The third array contains the Pitch Bend data (comprising the Most Significant Byte [MSB] and the Least Significant Byte [LSB] for each output frequency). Array four contains the brain wave frequencies. The fifth array contains the brain wave Pitch Bend data. The first array to be filled is the reference frequencies array. This 128 cell array contains all the frequencies of the equally tempered twelve note-per-octave scale (referenced to A = 440 Hertz.). The cell number of each frequency is the same as the MIDI note number to which that frequency corresponds, i.e., cell number 69 contains the 440 Hertz frequency data (transmitting MIDI note number 69 normally produces the "A" above "Middle C" ). These frequencies are calculated by multiplying each frequency at, and above, 440 Hertz by 2 1/12 to arrive at the next higher frequency. Frequencies below 440 Hertz are calculated by dividing by the same value. In this way, all adjacent frequencies in the array have the same frequency ratio of 1:1.0594631. The next step is to fill the output frequencies array. This 128 cell array contains all the frequencies of the desired tuning system arranged consecutively in the cells that correspond to the input MIDI note numbers that will ultimately trigger those frequencies during performance. For instance, if the algorithm receives a Note On message of MIDI note number 72 from the input controller, it will cause the frequency contained in cell 72 of the output frequencies array to be produced by the receiving device. The user may choose a tuning ratio or read in a list of frequencies from an ASCII text file. If a constant ratio preset is chosen, a sequence of 128 frequencies is calculated as follows. A reference frequency is selected and assigned to a MIDI note number. The default reference frequency is 440 Hertz and the reference MIDI note number is 69 (the A above Middle C), i.e., 440 Hertz is stored in the output frequencies array cell number 69. An array is then filled up with all the frequencies derived from either multiplying or dividing the reference frequency by the desired ratio repetitively. For example, to determine the frequency to be triggered when receiving an input MIDI note number 70 (derived from a ratio of 1.618), one must multiply 440 Hertz by 1.618 to arrive at a frequency of 711.92 Hertz. The frequency to be triggered by input note number 71 would then be calculated by multiplying 711.92 Hertz by 1.618. All notes above the reference frequency would be calculated in this way. To fill the array cells below the reference number, the reference frequency would then be divided by the ratio, i.e., input note number 68 would correspond to an output frequency array cell containing the frequency 271.94 Hertz (440/1.618). This process continues until all 128 cells have been filled with frequencies corresponding to the 128 MIDI note numbers to be received by the controller(s). The Pitch Bend data are the next to be calculated and loaded into memory. Each of the frequencies contained in the output frequencies array is compared to each datum in the reference frequencies array. If an output frequency is equal to a frequency contained in the reference frequencies array, then the output MIDI note number assigned is equal to the cell number of the reference frequency. The corresponding MSB of Pitch Bend data is then assigned the value of 64 (no bend) and the LSB equals 0 (no bend). These values are then stored in the Pitch Bend array cells corresponding to the output frequency array cell. If an output frequency is not equal to a frequency contained in the reference frequencies array, the MIDI note number corresponding to the nearest lower reference frequency is assigned to the output. The pitch bend data must then be calculated as follows. The closest lower reference frequency is multiplied by 2^1/4096 (this ratio of 1:10001692 is equal to the smallest Pitch Bend increment available within a two semitone range). The resulting product is then multiplied by the same ratio. The process continues until the target frequency is reached (or closely approximated). The number of repetitions of this process is counted. The Pitch Bend values are calculated by dividing the number of repetitions by 128. This quotient yields the MSB of the Pitch Bend message. The remainder of this operation yields the LSB of the Pitch Bend message. These values are stored in the Pitch Bend array cell number corresponding to the output frequency array cell. MIDI Pitch Bend messages each contain three bytes. The first, or Status Byte, contains the Pitch Bend status with the imbedded channel number. This byte is followed by two data bytes that indicate the amount of bend to be applied to the Note On message to follow. The second data byte is the Least Significant Byte. This value ranges from 0 to 127. Each value above 0 raises the pitch by 1/4096^th of the semitone bend range. The third byte to be transmitted is the Most Significant Byte and is equivalent to a coarse tuning adjustment. This value varies from 0 to 127. If no bend is required, the value equals 64. The method used for generating brain wave stimuli is simply an extension of the techniques just described. A 128-cell brain wave output frequencies array is created by adding the desired number of cycles-per-second (equaling the target brain wave) to each of the elements in the array containing the desired tuning frequencies. The Pitch Bend data for these frequencies are calculated and stored in the appropriate brain wave Pitch Bend array cells. When an incoming Note On message from the input controller is received, the original frequency and the corresponding difference frequency are transmitted to the receiving device simultaneously. In order to achieve the binaural beats, the Pitch Bend data for each pair of notes is preceded by a Pan Controller message. Pan data range from 0 (extreme left) to 127 (extreme right) with pan to the middle equaling 64. The original note is panned to the extreme left by immediately preceding its bend message with a Pan controller message of 0. Similarly, the difference frequency is panned to the extreme right by preceding its bend message with a Pan value of 127. The resulting difference frequency has been shown to cause a bilateral increase in the brain wave amplitude of the corresponding brain wave frequency. These conditions of hemispheric synchronization are associated with a spectrum of consciousness states (Atwater, 1988; Goldman, 1991). The Delta range (1-3 Hz.) of brain wave activity is most commonly associated with the sleep state and dreaming. The Theta range (4-7 Hz.) is commonly associated with deep meditation and other forms of deep relaxation. It has also been associated with increased memory and concentration. Alpha frequencies (8-12 Hz.) are generally associated with super learning and light relaxation. The Beta range (13-25 Hz.) is generally associated with our normal, everyday condition of alertness. It is also associated with anxiety and stress. The program enables microtonal variance from the standard equally tempered MIDI pitches in two principal ways. The first method utilizes the constant ratio approach. The program provides several pitch systems based on the Phi ratio (1:1.618). Also known as the "Golden Ratio," this ratio has been used for centuries in art, architecture, and music as a way to aesthetically define structural proportion. Composers, such as John Chowning, have also utilized Phi as the basis of an alternative tuning system. In his 1976 composition Stria, Chowning used Phi to define a quasi octave (Dodge, 1985). He then divided this Phi interval into a scale comprising twelve intervals. I have more recently developed constant ratio scales that include Phi and several subsets of Phi including pentatonic, decatonic, and the square root of Phi. Each of these scales represents a constant ratio tuning system. In addition to the preset ratios included in the program, I have provided a function that will allow the user to input any ratio "on-screen". This feature allows the user to create, for instance, a nineteen pitch octave, a fifty note scale within a semitone, and other existing or newly-invented tunings based on a constant ratio, such as the Alpha, Beta, and Gamma scales used by Wendy Carlos in her Beauty in the Beast recording (Carlos, 1987). The second manner in which my algorithm enables microtonal variance from the standard equally tempered MIDI pitches is by entering specific frequencies. This method permits tunings derived from variable ratio intervals. Examples include the commonly used tunings from earlier periods such as Mean-Tone, Just, Well-Tempered, and Pythagorean. In each of these systems, the ratio between successive intervals does not remain constant. Although the Pythagorean system is derived from a succession of fifths yielded from a single ratio, the scale pitches derived from the transposed fifths have variable ratio relationships. Of course, in modern times, microtonalists have investigated variable ratio tunings. One of the more famous Western tunings is Harry Partchs 43-tone scale (Wilkinson, 1988). The user of my program may calculate the desired frequencies, then type them into a text file. The program will import this data from disk. It will then calculate the appropriate MIDI note numbers and Pitch Bend values for output to the receiving sound module upon receipt of incoming Note-On data. In the process of developing the tuning algorithm, I created several original variable ratio tunings derived from scientific sources to test this function. The first tuning system was derived from a list of frequencies based on the periodic table of the elements. Created from a table of the X-ray atomic energy levels of the elements expressed in ev/s, I calculated the desired frequencies by dividing these values by Plancks Constant in ev/s (Lide, 1995). After transposing these values into the audible spectrum, a text file of these frequencies was created and read into the tuning algorithm for the Pitch Bend processing described earlier. A second tuning was derived from the Schumann Resonance (Cleary et al, 1997). This ever-fluctuating electromagnetic earth resonance was arbitrarily fixed at 7.83 Hertz for the purpose of this study. The first 128 harmonics of this fundamental frequency were calculated, then assigned to the output frequency array for Pitch Bend processing. In addition to the Pitch Bend tuning system described above, I have also implemented the MMAs Bulk Tuning Dump standard in the published version of this software (1998). As discussed earlier, however, there are very few MIDI sound modules currently available that fully implement this protocol. Perhaps future support of this technology by the major MIDI hardware manufacturers will obviate the need for the use of Pitch Bend messages to enable alternate tunings of a musically acceptable resolution. Unfortunately, at this point in time, there are few instruments commercially available that support this technology. Very few of the thousands of units currently in use in studios, clinics, and laboratories by musicians, researchers, and practitioners support this newer technology. For those people, the use of Pitch Bend appears to be a practical way to achieve accurate microtonal tuning. References Atwater, F.H. (1988). The Monroe Institutes Hemisync Process: A Theoretical Perspective. Faber, VA: Monroe Institute. Bearden, J. A. & Burr, A. F. (1995) X-Ray Atomic Energy Levels. In D. R. Lide (Ed.), CRC Handbook of Chemistry and Physics: 76^th Edition (pp. 10:268-10:273). Boca Raton FL: CRC Press, Inc. Carlos, Wendy (1987). Tuning: At The Crossroads. Computer Music Journal, 11(1), 29-43. Cleary, E. N., Fullekrug, M., Fraser-Smith, A. C., Berring, III, E. A., Few, A. A. (1996). Comparison of Atmospheric Electric Parameters Measured at South Pole with Schumann Resonance Parameters Measured Simultaneously at Arrival Heights, Antarctica. [Online]. Available: http://www.uh.edu/research/spg/agu96enc.html [1997, December 23].Dodge, C. & Jerse, T. (1985). Computer Music: Synthesis, Composition, and Performance. New York, NY: Schirmer Books. Goldman, Jonathan S. (1991). Sonic Entrainment. In D. Campbell (Ed.), Music: Physician for Times to Come (pp. 217-233). Wheaton, IL: Quest Books: The Theosophical Publishing House. Starrett, J. (1997). John Starretts Microtonal Music Page. [Online]. Available: http://www-math.cudenver.edu/~jstarret/microtone.html [1998, January 1]. Kirby, W. (1998). Phi-Music Microtone/Brainwave Generator [Online]. Available: http://www.seriouscomposer.com [1998, January 15]. Microtonal Synthesis Homepage [Online].Available: http://freeweb.pdq.net/jloffink/ [1997, December 23]. MIDI Manufacturers Association (1996). The Complete MIDI 1.0 Detailed Specification. Los Angeles, CA: Author. Monroe Institute. [Online]. Available: http://www.monroe-inst.com/ [1998, January 10]. Oster, G. (1973). Auditory beats in the brain. Scientific American, 229(4), 94-102. Wilkinson, Scott R. (1988). Tuning In: Microtonality In Electronic Music. Milwaukee, WI: Hal Leonard Books.