This article was originally published to GameDev.net back in 2000 as a 4-part series. It was revised and combined by the original author into a single article in 2008 and published in the book Design and Content Creation: A GameDev.net Collection, which is one of 4 books collecting both popular GameDev.net articles and new original content in print format.
Basic Music Theory
NotesMusic, in the classical sense, is at first nothing more than a collection of notes. The note is the atom of a musical piece. These notes each have a different pitch (frequency) and are held for a certain amount of time. So, in theory, that's basically what you're reading when you look at a sheet of music: what pitch to play the notes at, how long to hold them, and at what volume. As you can see, there are different kinds of notes:
RestsWell of course, you can't play notes forever! Whenever you see a rest, it's the opposite of a note, it tells you not to play. So then, rests have beats. Here are some kinds of rests:
Measures, the Staff and ClefsThe staff (plural is staves) is what all music is put on. It consists of five horizontal lines. The staff is split up into sections called measures. The vertical lines that separate measures are called measure bars. Here's a staff split up into three measures:
AccidentalsOkay, take a deep breath and let's move on. There are some pitches in between some of the pitches we described above, like one in between C and D. To notate those, you either sharp or flat a note. Making a note sharp moves it up, and making it flat moves it down. A sharp looks like a number sign ( # ) and a flat looks like a lower-case letter b. When actually drawing the note, the sign goes before the note, but when writing the actual letter (like in this text) it goes after. So A# (A sharp) is the note in between A and B. It can also be called Bb (B flat). A note that has been sharped or flatted (or is that "sharpened" and "flattened"?) is called an Accidental. So, that in mind, here are all the notes in an octave, in order from lowest to highest: A A#/Bb B C C#/Db D D#/Eb E F F#/Gb G G#/Ab A As you can see, some letters don't have a sharp or flat note in between them. So then what happens when you sharp or flat those notes? Nothing different happens, it still moves up. So if you wrote the note B#, it would be the same as writing C, as they are exactly the same pitch. If you wrote the note Fb, it would be the same pitch as E. Moving up or down one position on that scale above is called moving up or down one half step. A half step above D is D#. A half step below F is E. On a piano, each key represents a note. The C closest to the center of the piano is the middle C. To tell which key is which on the piano, look at the black keys. The black keys are the sharps and flats. The pattern of black keys and no black keys goes, black key, black key, no black key, black key, black key, black key, no black key, and starts all over. So look at the piano, and you'll see the pattern: two black keys, no black key, and then three black keys. The white key to the right of the two black keys is a C. So here's a piano with the notes written on it:
Time SignaturesActually, time signatures aren't that hard. It is just two numbers at the beginning of each song that tells you about the measures and notes. You've probably seen them, one number on top of the other. Here's a time signature:
Volume LevelsThere are basically two different kinds of music levels: Piano, and Forte. Piano means soft, and Forte means loud. Yes, Piano is also what we call the instrument you can play, but try not to confuse the two. You see... (harp plays and we travel back in time) When the piano was invented, it was a revolutionary keyboard where you could control the volume just by pressing soft or pressing hard. Since it could be both soft (piano) and loud (forte), it was called the pianoforte. Eventually it was shortened to piano. Okay, that's the story. Back in modern times, all you have to do is remember these four things and you'll be fine: Piano - Soft Forte - Loud Mezzo - Medium Issi - A word that pretty much means "very." The more "issi"s there are, the more "very"s there are. The last "issi" ends in "mo." (That sounds quite simple-ississimo, right?) Okay, Forte means loud. So then what does fortissimo mean? It means "very loud." Then, what does fortississimo mean? Very very loud. Get it now? Same thing applies to piano, pianissimo, pianississimo, etc. Regarding the word mezzo: Loosely translated, it means medium. So if I order you to play a song at the volume level "mezzo-forte", think "medium-loud." That's the volume level in between mezzo-piano (medium soft) and forte. So then here's a basic succession of volume levels, from softest to loudest: Pianississimo Pianissimo Piano Mezzo-Piano Mezzo-Forte Forte Fortissimo Fortississimo Of course, you can create more volume level descriptions than that, like fortississississississimo, but these are practically more than you'll need. It's hard to describe exactly how loud the volume levels are since you're just reading an article; I can't yell at you in writing. (OR CAN I...?) For the purpose of computer-generated music, we can let the software worry about that. The volume level "piano" is represented by the letter p. Pianissimo is represented by pp. So that means pianississimo is represented by ppp, etc. The volume level "forte" is represented by an F. The word "mezzo" is represented by an m. So if you wanted to write the volume mezzo-forte, you would write MF. Here's a sample picture:
The Crescendo, Decrescendo, and other tricksIn the picture above, measure one is played piano. (Not the instrument, the volume level.) All four notes in each staff are played at the same volume level. Then, all of a sudden, when you reach the second measure, it becomes louder, at the volume level mezzo forte. Very abrupt. What if you want to make it a gradual change? For example, instead of having piano the first measure, mf the second measure, and fff the third measure, what if you just wanted it to start at piano, and gradually change to fff until the third measure? Then you use a crescendo. A crescendo sort of looks like a "less than" sign in math. ( < ) The only difference is that it is a lot wider. Here is the same picture as above, except this time there is a crescendo:
Intermediate Level Music TheoryWhoa....you just read "intermediate level music theory." But don't be intimidated. We've already dealt with the basics of how to read and write notes. Now that you can read and write, let's put some words together. Maybe even some sentences! Sweet!
ScalesNo, not those things on fish, I'm talking about a musical scale. (lol? No? Tough crowd.) Let's talk about major scales first. Recall the Middle C. It's the C that's one leger line below a treble clef staff, or one leger line above a bass clef staff. On a piano, it's the C that's closest to the center of the piano. Now, put your musically talented fingers on the middle C. Now, play that note, and play every single white note until you get to the next C up. When you finish, you should have played eight notes. From middle C to the next C, that was an entire octave. (abbreviated as "8va".) Just FYI, each note is twice the frequency of the note one octave below. So if you played middle C and somehow multiplied its frequency by two, you would be playing the next C up. Anyway, when you played those eight white keys, you just played the C Major Scale. The notes, played in that order, should have sounded natural and aesthetically pleasing. Each note was the right pitch above the one before it, and all those pitch changes together created what we call the major scale. A major scale is eight notes, expanding over one octave. If you try to play all the white keys from one G to the next G up, you'll notice that the second to last note (the F) sounds weird. Now, try it again, but when you play F, instead of playing F, play F#. Ahh you say, that fixed it, and now it sounds natural. Anyway, now try playing all the white keys from one A to the next. The weirdness is back! And worse! To understand why, you need to understand what an interval is. Once again, the succession of notes is: A A#/Bb B C C#/Db D D#/Eb E F F#/Gb G G#/Ab A If you start on one of these notes and move one to the left or right, that would be moving one half-step. So if I moved from C#/Db to D, that would be regarded as moving one half-step. If I moved from C to B, or from B to C, or from E to Eb, or from D# to E, each one of those would be regarded as a half step. Okay, you get the picture. So what if I moved two to the right or left? You guessed it - it would be moving a whole step. So from F to G is one half step, from A to B is a half step, from C to Bb is one half step, et cetera. These are called intervals. So the interval between F and G, for example, is a whole step. The interval between B and C is a half step. The interval between B and D is a one and a half step, or 1 1/2 step. The pattern of intervals, or formula for a major scale is: whole, whole, half, whole, whole, whole, half Or (1, 1, 1/2, 1, 1, 1, 1/2). Using this formula, you can create a major scale starting from any note. Take a look at your piano and let's play the C scale again. Start on C. According to the formula, the next note would be one whole step up. The next key would be a whole step up. The next key would be a half step up. So if you play the entire scale, you would see that you are playing each white key for the C major scale. Any other scale has at least one black key in it. Now try it with the A major scale. Using the formula above, you will find that the A major scale is: A, B, C#, D, E, F#, G#, A And once you've recovered, we can continue. Let's look at some scales just to make sure we all understand.
The Key SignatureWhy do they call sharps and flats accidentals? Because they weren't included in the key signature! I guess only a musician would laugh at that. No...they wouldn't either. Remember how accidentals only last for one measure? Key Signatures are a bunch of sharps or flats that are in front of the time signature that make those notes flat or sharp for the entire song, or until a new key signature is made. Let's look at the D scale with and without a key signature:
Minor KeysOkay, you already know how to play major keys. Now let's go on to minor keys. Remember the formula for a major key? (1, 1, 1/2, 1, 1, 1, 1/2) Here's the formula for a harmonic minor key: 1, 1/2, 1, 1, 1/2, 1 1/2, 1/2 That second-to-last interval is a one and a half step. Now play the C harmonic minor key. Sounds weird, doesn't it? Listen to MIDI3-1.mid in the downloadable file - it just plays the C minor scale going up, and then down. Some of you might be thinking, "are there key signatures for minor keys?" Well, yes and no. Let me explain. Every major key has a relative minor key. This minor key is the one that's three half steps below it. So the relative minor key of C major is A minor. (Since the note A is three half steps below C.) The relative minor key of Eb major is C minor, etc. The relative minor key of any key has the same key signature as its relative major. So then if you wanted to write a song in C minor, you would make the key signature the same as the key of Eb major. (Eb major has three flats: Bb, Eb, and Ab.) There is one kind of minor key which is the most commonly used, and that is the harmonic minor key. I've made reference to this before, but haven't really explained what this was. Let's say we wanted to write a song in the key of G minor. Since G minor's relative major key is Bb major, we would make the key signature the Bb major key signature. (Two flats: Bb, and Eb.) When we play the scale going up, we use the formula for a harmonic minor key, which I've given above. But wait, the second-to-last note before the last G is not an F, like the key signature says. Instead, it's an F sharp! And that's the partially confusing part. When playing a song in a harmonic minor key, whenever you play the second-to-last note of that key, (in the G scale that key is F.) it is raised one half step. Unfortunately, we can't include that fact in the key signature. It would be easier if we would just add an F# to the key signature, but we can't. (some of you might be thinking, why not put a Gb? Well, that wouldn't solve our problem, because that would change the note G, and what we want to change here is the note F.) Just to make sure we're all clear, here are some pictures of minor scales:
The I, IV, and V7 patternsMake sure all of the previous sections soak into your brain and stay there permanently, because we're moving fast here. Okay, before we move on, you must know that a chord is three or more notes played at the same time. Specifically three notes played at once is a triad, and two played at once is a dyad. Each major key has three primary chords. These are three triads that sound beautiful and are absolutely essential to harmonics (try not to confuse harmonics with harmonica...). The first primary chord is the I chord. This is the first note of the scale, the third note, and the fifth note. So the I chord for the C scale consists of the notes C, E, and G played at the same time. Go ahead, try it. Play those three notes at the same time. Don't it just sound heavenly? The IV chord consists of the first note, the fourth note, and the sixth note played at the same time. For the C scale, those notes would be C, F, and A. Finally, the V7 chord consists of the fourth note, the fifth note, and (pay attention to this one now.) the note one note below the first note. So for the C scale, those notes would be B(the one below the first note, not the one before the last note), F, and G. Got it? Now you can make up your own happy song with these chords. Go ahead, try it. Try playing the chords in this order: I, IV, V7, I The same basic rules apply to minor keys. So for the C minor key, the I triad would be C, Eb, and G. The IV triad would be C, F, and Ab. Finally, the V7 triad would be B(B natural, the one below the first note.), F, and G.
Patterns and broken chordsThis part might as well be called "Advanced Music Theory." Instead I present you with a watered down version of chords and harmony, by describing it the way I originally learned it. Now, each note on the scale has at least one chord that it "harmonizes" with. A chord harmonizes with a note if that note is in the chord. So notes that match with the I chord in the C scale are C, E, and G, because those are the notes that make up the chord. Try it. Sit on a piano, and with your right hand, play either one of the notes I mentioned, and with your left hand, at the same time, but one octave lower, play a I chord in the C scale. Sounds beautiful, eh? Now try playing the same thing, but with the right hand, play one of the notes that are not part of the scale, like D, or F. It gives you a completely different sound. Not bad, keep in mind, just a different type of harmony than the one I'm trying to describe here. Now, like I said earlier, each note has at least one chord it matches with. So let's stick with the C scale again. Let's look at the note C, first. What chords have the note C in them? The I chord, and the IV chord. (The I chord is C, E, and G, and the IV chord is C, F, and A.) Now let's look at the note A. Unlike the note C, the note A has only one chord that harmonizes with it, and that is the IV chord. (Actually, there are lots of more chords that fit in with these notes, but you don't know all of the chords yet.) Go ahead, try it. Sit at the piano, and explore. By the way, you might think that the note D in the C major scale has no chord that it harmonizes with. For now, just play the V7 chord with that note. Now here's a song that consists of two different instruments playing at the same time. The one on the top is playing the melody, and the one on the bottom is playing the harmony. It is also MIDI3-2.mid, which you can find in the downloadable file. Here's what the music looks like:
Composition and Theme Development
The Basic ThemeStop. Before even touching this section, keep in mind that it assumes an intuitive understanding and familiarity with the previous one. Very important! If you feel you're ready, then now I'm going to talk about how to write a basic theme and then how to change it into a song. When you want to write a song, rarely does the opportunity come when you have an entire song, completed, in your head. (with all instruments, notes, etc.) So what I do is, write down the basic theme of a song first. The file MIDI2-1.mid plays this theme. To get an idea of how simplified it is, let's look at the notes:
Opening a song - How to introduce the themeTake a look at any song over three minutes. Notice anything? It doesn't take musical training to realize that many songs consist of one or more themes, repeated over and over and in different ways. This is why I suggested you write the theme first. Once you've got the theme, then you should get started on the beginning. (Some people, including myself, write a beginning first and just wait until a theme comes to them. It doesn't really matter, different people do different things. Once again, I want to stress how writing music is almost absolute freedom, unless the type of music you can write is restricted by the people you are writing the music for.) Here are some types of introductions, described as abstractly as possible:
- Building up: This type of beginning is one where you start with something simple, say a drum solo, and then slowly the background to the theme comes in, and then more background, and then eventually the theme itself comes in. Sometimes the background (the music that would be playing in the background while the theme would be playing) is just playing by itself, then comes the bass and/or drums, then comes the main theme. MIDI4-1.mid is an example of one of those songs. The main theme comes in, played usually by different instruments from those that were used in the introduction. That way it more clearly distinguishes itself.
- Introducing an alternate theme: Here, you start with a different theme and slowly introduce the other theme. For example, you play another theme, and then play a part of the theme, and then play the other theme, and then play the main theme, and then the other theme, and then again, and each time you play the main theme you play it louder and place more emphasis on the main theme and less on the alternate theme. Eventually the alternate theme stops and you play the main theme all the time. These intros are usually pretty long.
- No playing around: In here, you don't do any stuff in the beginning; instead you just play the theme, with all of the background and everything, starting from the beginning. This isn't really an intro, but for some themes, it works better than any of the others. This is what you will probably use if there is no ending to your song; if it will repeat over and over. Often this is done in fanfares and other formal themes. Think military marches or graduations.
- Teasing: When the theme is already one that is familiar to most of the listeners, it helps to use a combination of introduction styles (1) and (2). For example: Build up an introduction, then play some notes that are similar to the theme. Similar enough so that they can remind the listener of the main theme, but distorted enough so that it's not satisfying. Then perhaps, play another theme, and tease with another distortion of the theme. Then build up, get loud and play the actual theme in full force, without distortion. This works great with long introduction screens, where the main theme finally plays when the game's hero appears or the start screen shows.