An Introduction to Melody and Harmony
A Feature by Camdog
This article is intended to serve as a starting point for those who would like to compose for their game, but have no idea where to begin. Like any other art, intangibles like inspiration play a part when coming up with something great, and this is intimidating to a lot of people who dive into a composition program and end up with something that sounds like a mess. Fortunately, there are also rules that can be followed which ensure a song will sound "right", even if it isn't the product of a flash of inspiration. In other words, you don't need to be a Beethoven to write decent sounding music, only a knowledge of the fundamentals of music theory. A composer is you!
For this tutorial, we'll use Notate for examples. Notate isn't the greatest program for composing, especially now that the OHR has MIDI support. If you're serious about writing songs, I'd suggest downloading a good Midi composition program. However, Notate comes with the OHR, so everyone has it, and it will be sufficient for examples.
(Since Notate is an old DOS program, it uses the key combination alt+space, which is also a Windows shortcut. You need to turn this off if you wish to enter tutorial examples in Notate. To do so, right click Notate, click on Properties, go to the Misc tab, and at the bottom under Windows Shortcut Keys, uncheck alt+space.)
First, open Notate. That flashing bar you see is used to determine note placement. At the upper left-hand corner of the screen, you can see (among other things) the name of the note the bar will place. It will be a letter from a to g. If you hit up or down on the keyboard, the letter of that note will change accordingly. If you hold alt, the word "sharp" will appear next to the letter name (this is generally written in music as "#", and I will refer to it this way for the rest of the tutorial). These letters and symbols indicate the distance, in pitch, between notes. A letter difference indicates what's called a whole step, and a sharp indicates a half step difference. For instance, the pitch difference between a c and a d is a whole step, whereas the pitch difference between a c and a c# is half a step. This rule holds when the sequence of notes repeats. For example, the note a whole step above a g is an a.
But wait! It's not quite that easy. Some notes don't have sharps, and the distance between them and the next letter is a half step, not a whole step. These note pairs are b and c, and e and f. So, the distance between a b and a c is just a half step, and there is no b#! I know it's confusing and non-sensical, but this is a legacy system that's hundreds of years old and so widespread that it will never change, so get used to it. (You'll note that if you hold alt in Notate while on a b or an f to get their sharp, nothing will happen.)
Here is a visual example of how notes form octaves on a piano. Those black keys in between the white ones are the sharps. So, the black key just above and to the right of the c is the c#. Note how there are no black keys between the b and the c or the e and the f!

So why is learning how much "space" there is between each note so important? Because that is how we determine how scales are formed. The basis of all western music is the scale. A scale is a selection of notes from the 12 notes which make up an octave. These 12 notes are: a a# b c c# d d# e f f# g g#. After g#, the sequence of notes repeat again at a higher octave. Notes in a higher octave are harmonically equivalent to their counterparts in lower octaves. Obviously, they sound different, but they function the same. In other words, if a d# in one octave sounds good at a certain place in a song, d#s from all other octaves will sound just as good, though they may be higher or lower notes.
If you played these twelve notes in order, it wouldn't sound very tuneful. This is where scales come in. A scale is esentially a series of intervals (which is the technical term for the "spaces" between notes we've been talking about). If you start at a note and play a sequence based on a predetermined series of intervals, that's a scale! Depending on what that sequence of intervals was, you'll get a different feel. Different sequences are what differentiate scales from one another. This is called "tonality", and is one part of what makes a scale. The other part is "key", which is simply where you started playing your sequence of intervals (as shorthand, people often refer to the key and tonality together as the key, as in "the key of a minor"). Confused yet? Let's have an example.
We'll start with an e major scale. That means the tonality of this scale is major (which is a happy sounding scale), and the key is e. If we define the word "root" as the note you start your scale on, the set of intervals that defines the major key is this: root, whole step, whole step, half step, whole step, whole step, whole step, half step. Based on this, can you figure out what notes are in an e major scale? You'll need to look at the sequence of notes in an octave, and then determine what note goes after your previous note by counting upward the right amount based on the list of intervals I gave earlier. Here's the octave again and the scale again. Try to figure it out! Remember, the space between each note in an octave is half a step!
Octave: a a# b c c# d d# e f f# g g#
Major Scale: root, whole step, whole step, half step, whole step, whole step, whole step, half step
Got it? Ok, let's check your work. The scale is in e, so we start at e. From there, we go up a whole step, so the second note is an f#. From there, another whole step, which birngs us to g#. From there, we go up a half step. Remember, an octave repeats after it's done, so a half step up from a g# is an a. From there, we need another whole step, which brings us to b. Another whole step brights us to c#. Yet another whole step brings us to d#. From there, a half step brings us back to e. A scale should always end on the same note it started on. From there, you can repeat it at a higher (or lower) octave. If you enter in this sequence of notes in Notate and listen, you'll find that it still isn't quite a tune, but it is much more tuneful than all 12 notes played in sequence. You'll also note that it has a happy character to it, similar to a lot of children's songs.
So, to review, here is an e major scale:
E Major scale: e f# g# a b c# d# e
And here is a picture of that scale on a piano, with the appropriate notes colored green:

The other tonality you should be familiar with is minor. There are many tonalities scales can have, but learning them all would be a massive undertaking. Major and minor are by far the most common, comprising probably 90% of the songs you've heard, so for now it is sufficient to learn only those. Minor has a much sadder sound than major. The intervals in minor are:
Minor scale: root, whole step, half step, whole step, whole step, half step, whole step, whole step
Got it? Now, using what you've learned above, try to figure out what notes are in a d minor scale. Continue reading when you're ready to check your work.
D Minor scale: d e f g a a# c d
And here's a picture of what a d minor scale would look like on a piano.

Make sure you understand what we've covered so far. It's a lot, but once you are able to construct scales, you're well on your way to composing great music. Try making scales starting with other notes and playing them in Notate to make sure they sound good. You should be able to notice if you include an incorrect note. It will sound "off". Once you have it down pat, you're ready to try constructing a melody. A technical discussion about creating a melody is beyond the scope of this article (not to mention the fact that ideas of what constitutes a good melody have changed drastically thoughout history), but with knowledge of scales, you should know enough to mess around and come out with something that sounds good. Essentially, you want to create a sequence of repeating notes inside the scale you have chosen. Anything inside the scale should sound good, and anything outside of it will not (this isn't a hard and fast rule, but it's good to stick to it when you're just starting out). Writing a melody is a skill like anything else, and you'll improve with practice, but even at the very beginning following these rules will help keep you from producing something that sounds like a random cacophany.
Once you have a melody, you'll want something to accompany it. A naked melody usually doesn't go too far. The accompaniment is called "harmony", and you'll create it using the same skill you just learned: scales. You can play pretty much anything as a harmony for your melody, as long as it's using the same scale, and it shouldn't sound too off (at least compared to playing something using a different scale). However, just throwing random notes together in the right scale obviously isn't the best choice. There are some common ways to construct a harmony, and the easiest way is with chords. Chords are essentially a group of notes meant to be played together. The most common way to construct a chord is by picking a root note, and then including the 3rd and the 5th note above it in the scale. For example, if I wanted to play a d chord in my d minor scale, I would start at d, and include the notes a 3rd and a 5th above it in a scale (keeping in mind that the d counts as 1, so a 2nd is 1 note above the d in the scale). Let's take a look at the d minor scale again...
D Minor scale: d e f g a a# c d
The red notes are the ones used in this chord. If you assign a number to each note starting at d, you'd give d a 1, f a 3, and a a 5, hence the terms 3rd and 5th. If you wanted a g chord, you'd do the same thing, but start counting at g instead of d. You can construct a chord based off of any note in a scale using this method. Remember, constructing chords is based off the notes in the scale you're writing in, not all of the notes, so an a chord in an a minor scale will sound different than an a chord in a a major scale, even though their both based off the first note in the scale!
There are other ways to build chords too. For example, try including the 7th note above your root note in a chord to give it a bluesier sound. Some additions will sound better to you than others, so you'll need to experiment. However, the method detailed above will usually produce something pleasing to the ear.
The only thing left to do with chords is figure out the best way to put a bunch of them together. A grouping of chords is called a chord progression, and it can be used to form a harmony for your melody. Like writing melodies, writing chord progressions is more of an art than a science, but there are very common chord progressions that you can almost always count on to sound good. For instance, a very common chord progression in rock music is a chord based on the 1st note in the scale, a chord based on the 4th note in the scale, and a chord based on the 5th note in the scale (this is often abbreviated as I - IV - V, for one, four, and five). Try playing those chords under a simple melody; the result should sound pretty good. I'm partial to I - III - VII myself, but your mileage may vary. Practice, experiment, and have fun!
Tune in next time for a discussion on the finer points of rhythm.