2. Learning Visually
3. What's a piano roll?
4. Getting Started
5. Scales
6. Application
Music--what's the point?
Music is often neglected in low-budget games because it is perceived to be a luxury in the eyes of game designers. After all, music is just the icing on the cake, right? There's no reason to waste valuable time or money on music when graphics and game play are obviously more important. Besides, well thought-out, original music can't possibly increase the playability of a game. It's only there to give players something to listen to other than the sound of their magic missiles, swords, and semi-automatics, right?
Right?
Wrong. Music can dramatically increase the playability of your game. Music has a direct impact on the mood of a game. Fast paced music will put the player at the edge of his seat as he pilots a fighter craft through an asteroid field. Well orchestrated music with soaring melodies will prepare the player and his party for their epic adventure! Dark, ambient music will make the player move cautiously through Hell's labyrinth, dreading the outcome of every corner.
But it takes a professional to invoke these kinds of feelings through music, doesn't it? Those guys can be expensive! It's a good thing you're going to learn to grow your own music, then!
It's doesn't take expert knowledge of music theory and composition. All you need is to know some basics and get creative. I know the terms can be daunting, but we're going to learn visually. That's right, we're not even going to get into technical terms at all. I promise.
Learning Visually
Musicians like to talk a lot of jargon because it can be easier to communicate ideas that way. This doesn't help when you are trying to learn the basics though. The jargon just gets in the way. You might think, "How the crap do those guys learn anything at first? I don't know what the heck a minor third is!" It seems impossible learn to create music without a teacher. The simple truth is that most musicians learn visually, at least at first. Learning about the relationship between notes is much easier when you play an instrument because you can see where each note lies. So how can you learn to write music without an instrument?
You have an instrument! It's on your computer, or at least it will be after you go download it. Anvil Studio is an excellent software suite for composing music. It is free, and it has everything you need to get started. It even has a piano roll.
What's a piano roll?

A piano roll is what we are going to use write music, duh. But why use a piano roll when there are a number of other ways to write music? The piano roll allows you place notes visually. You can see the notes and visualize what they will sound like without any knowledge of music. You don't have to use Anvil Studio to benefit from this article, but you will need to use a piano roll.
A piano roll is a method of representing music. It is somewhat like a graph, where the x-axis represents time and the y-axis represents various pitches.
Getting started
We're going to kick things off by creating a scale. Shoot, is that a technical term? I mean we're going kick things off by creating a group of notes--a sound pallet if you will. Why do we need a scale? A scale contains a group of notes that you work from to create your music. The scale is your pallet, the piano roll is you canvas, got it?
Good. Now open up your music maker and go to the piano roll. Here's how to get there in Anvil Studio.

Click "View" from the menu and select "Piano Roll Editor."
Ok, your screen should look like this:

Before we go any further, let's learn how to place notes. First, let's select our note duration. This is how long the note sustains. To edit a note's duration, simply click the right edge of the note and drag it.

Click the note drop down and select 1/16. What does this mean? If you look, there are 16 squares between each dark vertical grid line on the piano roll. We'll call the area between each dark line a "bar". 1/16 represents the amount of time the note takes up in the bar. 1/16 is one square, 1/8th is two, 1/4 is four, and so on. A whole note occupies the entire bar.

To place a note, click the area on the piano roll where you would like a note. If you click a note again, it will be erased. Let's place a note on C4. This is the note we are going to build our scale off from.
Scales
I mentioned earlier that scales are a group of notes. I didn't explain that the group of notes are in a sequence. We're going to define the sequence now.
It is: 2, 2, 1, 2, 2, 2, 1.
Each number represents the distance between two notes of the scale.

Count two squares up and one square right from the first note and place a note there. This is the 2nd note of the scale. Now count two squares up and one square to the right from the second note.

If you continue the pattern, your piano roll should look like this. You could then start the pattern over at c5, since the scale starts over once it reaches the original note.
OK. So now we have a scale, what do we with it? We write a melody of course. Most modern music is derived from this scale, so you should be have plenty to experiment with. Start on any note in the scale and start making movements. Often, the best sounding melodies only rise or fall 2 or 3 notes (of the scale) at a time.
Application

Listen
Take this melody for instance. The only place where the melody skips over more than 2 notes of the scale is the jump from the first to the second note. The less a melody jumps around, the more 'singable' it is. The more 'singable' it is, the more it sticks. Of course, large jumps in notes can sound neat too. To give your song a more "random" sound, try larger intervals.

Listen
This doesn't sound bad, and often this can be the desired effect. But the melody seems to have no direction. It's only real structure is that it is based in a scale we just created. Other than that, it sounds "lost." If you wanted to use this as a theme song, good luck.
A good, singable, melody needs direction. You should be able to listen to it once or twice and find yourself whistling it the rest of the day. Practice writing some catchy melodies and we'll talk about adding more instruments next time.