squish7  .com /harmony

Harmony Composition Program

INTRO

Sometimes people ask me what I'm going to do with my life, considering the multitude of things I love to do. I usually reply, "everything." But one sad day, I put together my knowledge of algebra, trigonometry, calculus, and biology, and spent four full days going through a furiously complex set of tedious calculations and equations, and came to the conclusion that, given the estimated length of my lifespan, my average rate of learning and achieving, and the fact that I'm a complete lazy-ass to begin with, my lifespan is not of sufficient length to allow time for me to do everything there is to do in the world. I was very depressed.

To fix this problem, however, I plan on eventually becoming immortal. But, if that plan falls through, I'm at least going to squish everything i possibly can into life. And one of the most obvious first things for me to start with would be to mix together my two majors and write music software. Surprisingly enough (or not so suprising, if you impatiently jumped ahead in this sentence and have already read what I'm about to tell you), this is something I've already fiddled with.

So how have I started mixing CS and music? Well, I started by getting a big mixing bowl, and added two cups of flour (sifted), a cup and a half of fresh kiwi juice, and a handful of llama poo. Then I added my knowledge of basic 18th century music theory, my C programming skills, a squirt of squishiness (for flavor), and beat on high for three minutes. I baked for an hour, and out came SquishHarmony 1.0 beta!


MUSIC THEORY

What's Music Theory, you might now ask, if you don't happen to already know. (which is precisely why you might ask). Well, Music Theory is a nifty little subject that involves notes and chord progressions and harmonies and F tripple sharp half diminished seven chords and fun little things like that, and how these things interact in a piece of music. When you study Music Theory (in high school, or college), once you're past the basics, you start to learn about 18th century style four part harmonies. The harmonies involve four voices (vocal, or instrument) that play or sing simultaneously (hence creating the harmony of the "four part harmony" -- can you say harmony, boys and girls?). The parts are labeled alto, soprano, tenor, and base (from top). The harmoies usually aren't played; when Music Theory is studied it's done almost always on paper and the blackboard.

18th Century Music Theory imposes a strict, increasingly complex (as you learn more about it) set of rules on how the four voices of the harmony are allowed to play out. A simple example. If we're in C major, and a chord in the harmony on a certain beat is to be D minor (a "ii" (2), the second triad in the C major key) -- the four voices (traditionally) have to be notes of the D minor chord (for instance, a D, an F, an A, and another D, would be a jolly good choice for the four notes; so on this beat we'd be hearing a D minor chord, as we want).

On the next beat we might decide to move to a G major chord, and the voices would move appropriately to the notes of the G chord, following 18th century guidelines -- for instance, one guideline is that voices shouldn't take leaps; if the soprano voice was on D, it should stay on D or move to B, since D and B are the closest notes to D of those in the G major chord (G, B, and D). Another guideline is that all the voices shouldn't move in the same direction, i.e. there should be some contrary motion. The end result is a harmony that should flow smoothly.

Now the deeper you get into Music Theory, the more rules there are and the more your brain starts to feel like the fried egg in the famous anti-drug commercial. Properly writing out a whole four part harmony can sometimes be a tedious task. So, (I thought to myself), self, wouldn't it be cool if computers did this work for us. So I started writing my own program to do just this (though of course this is nowhere near a new concept; people have written software that compose complex classical music; this is just my personal attempt).

Now the majority of the assignments in Music Theory involve either taking a given four part harmony (with the voices written out) and analyzing it (what chords are being played, etc), or taking a given chord progression (i.e: C, F, G, C... otherwise written I, IV, V, I...., in roman numeral analysis) and writing out a proper four part harmony that follows that progression. The latter is the much more tedious task, and is done in a very orderly, progressive way (in theory anyway), and is the perfect task for a computer who can form the harmony within a fraction of a second instead of egg-sizzling minutes or hours, who won't complain and whine about how long the assignment is, and who, most importantly (if programmed correctly), won't make any mistakes!

THE PROGRAM

The program I came up with I wrote around 2000-ish  and haven't had the time to work on since. Right now it only handles very simple harmonies, but even simple harmonies, if long enough, could take a beginner theory student an hour to do, or an amature, minutes, whereas a computer does them in less than a second.

The current program just works in C major, asks for a simple chord progression as a string of numbers (i.e. C F G Am C would be "1 4 5 6 1" or I IV V vi I in roman numeral analysis), and crudely prints out via text an appropriate four part harmony following the basic 18th century rules.

Here's an example run of the program:

 

Welcome to SquishHarmony 1.0 beta.  This squishy program takes
a simple roman numeral analysis style chord progression and
prints a corresponding SATB four part harmony in 4/4,
generally following standard 18th century harmony rules (no
parallel 5ths, etc.).
 
The input is a string of numbers from 1 to 7, each number
representing a triad chord from the key of C major (1 = C, 2 =
Dm, 3 = Em, 4 = F, 5 = G, 6 = Am, 7 = Bdim). The output is an
appropriate harmony (dashes and o's represent notes inbetween
or on the staff lines, respectively).
 
Enter a chord progression starting with 1 and end it with 0.
Example: 1 4 5 1 1 4 5 7 1 0 <enter>.  Long strings of consecutive
numbers (i.e. 2 3 4 5 6 7) will not work.  The input string
may be of any length:
                                                             
1 3 5 2 4 6 7 7 3 6 2 5 3 6 1 4 2 3 4 6 5 7 2 5 4 4 6 2 1 3 1 7
3 2 4 5 6 5 4 2 4 7 6 1 5 2 4 3 4 5 1 0
 
                                                             
 
                                                                              
 
--->
 
 
 
  |\   ---------|---------|---------|---------|---------|---------|---------|
  |/   -_-------|-------O-|---------|-----_---|-O-------|---------|-_-------|
 /|_   ---O-O-_-|-_-_-O---|-O-_-_-O-|-O-_---_-|---O-_-_-|-O-O-_-O-|---_-_-_-|
| | |  ---------|-------_-|---------|---------|-_-------|---------|-_-------|
 \|/   -O-O-_-_-|-----_---|-O---_-_-|-O---O---|---O-----|-_-_-_-_-|-------_-|
  |              -O-O-       -O-       -O- -O-     -O-O-             -O-O-
 
 
 
 
                        _
 ___   -_-_-_---|---------|-_-----_-|-_---_---|-O-_-----|-_-----_-|-O-------|
/   |: -------O-|-O-_-O---|---_-O---|---_---O-|-----O-_-|---O-O---|---O-_-O-|
   /   -_-------|-_-------|-----O-O-|-----_-_-|-----_---|-------O-|-_-_-----|
  /    ---O---_-|-----O-O-|-O-------|-O-------|-_-O---_-|---O-_---|-----_-_-|
 /     -----O---|---------|---------|---------|---------|-O-------|---------|
 
                                                             
                                                                              
 
                                                             
<hit enter HARD for next page>
--->
 
 
 
  |\   ---------|---------|---------|---------|-------_-|---------|---------|
  |/   -_---_---|---O-_---|-----_-O-|-------_-|---O-_---|-_---_---|---------|
 /|_   ---O---O-|-O-----O-|-_-O-----|-_-O-_---|-O-------|---O-----|---------|
| | |  ---------|---_-_---|-----_-_-|---------|---_-_-O-|-_-------|---------|
 \|/   -O-O-O-_-|-O-----_-|---_-----|---_---O-|-_-------|---_-O---|---------|
  |                        -O-       -O- -O-
 
                                                                              
                                                              
 
                                                      _
 ___   -_-_-_---|-_-O-O-_-|---_-O-O-|-------_-|-_-O-O---|-O-_-_---|---------|
/   |: -------O-|---------|-_-------|-O-O-_---|---------|---------|---------|
   /   ---------|-----_-O-|---O-_---|-_-----_-|-O---_---|-_-O-_---|---------|
  /    ---O---O-|-O-_-----|-------_-|---O-----|---_---O-|---------|---------|
 /     -O---O---|---------|---------|---------|---------|---------|---------|
 
 
                                                     
                                                             
Tah-dah!  There's your super-squishy harmony.
Now hit enter.  Quick, before it's too late!!

 

 

Now about the future ("no, not the past, Marty, the FUTURE!"), clearly I'd love to work more on this program, make it deal with more complex stuff, etc, but time, as they say, is the fire in which we all burn. That of course has no relevence to the point I was trying to make, that i don't have much time, and hence have no time to work on this program, but damnit I like the quote and if you have a problem with it -- if you can't take the heat -- get out of the frying pan, off my web page, and out of the time continuum!

Now what the hell was I saying? Oh yes, the future! This program is only one tiny step in the direction I'd like to go. Certainly one thing I could do is advance the program endlessly to accomodate higher and more complex levels of Music Theory. Another is actual sound! Recently I've been studying how to program with MIDI; the result is that soon SquishHarmony could actually play the harmonies it writes through the soundcard, or -- hey why not -- through my Alesis QS8.1 synthesizer.

I can see myself in ten years, enveloped in my own room of entangled computers and keyboards and guitars and speakers and wires, face close to a computer screen, eyes narrowed, annoyed, frustrated, intriguied, striving to find the right note or function or idea which will bring me one tiny step closer to the goals in the distance horizon.... Imagine, a program that could write (and play) a breathtaking passionate flute melody, an extraordinary hour-long symphony, endless soul-pumping dance music, a dark raging metal song....

But those are simply goals; and life doesn't lie in reaching those goals or failing to reach them, but in the walking towards them. Ultimately I don't hope to achieve anything by mixing computer science and music, I just hope to have fun, and live, frustrated and intrigued, hovering over my keyboard or monitor, my head wildly spinning, just a drop of water in the sea of human life all trying to understand the universe just a little bit better...

------------------------

You can download SquishHarmony 1.0 for Win95/98 by clicking here, provided you've read and agreed to the terms below.

SquishyHarmony 1.0 may be distributed freely with no obligation to register. However, if you use it for more than thirty days and wish to continue using it, you are required to register your copy by sending me 7.5 million dollars. With your registration comes full 24-hour phone support for troubleshooting, and a bright yellow "SquishyHarmony" sticker. Squish, Inc. takes no responsibility for students who use SquishHarmony to cheat on their theory assignments. If you have information about any such improper use of SquishHarmony, please report it to your local police department immediately.

 

squish7