How to write and program a melody

SONGWRITING WEEK: What is a melody? The official definition is a sequence of notes perceived as a single phrase, often repeated throughout a piece of music in various forms.

In most cases, the melody is the tune at the forefront of the piece, and as such is usually sung by a vocalist or played by a lead instrument.

It's the focal point for most listeners - they might not recall the drum beat or the chords used, but they could be humming, whistling or simply thinking about the melody for days!

Songwriters and composers the world over will tell you that melodies are, in fact, ethereal, mysterious creatures that often leap out at us when we're least expecting it. They can come to you when you're doing the shopping, or even while you're asleep, drifting away infuriatingly as you make yourself ready to face the day.

One useful tip is to use a voice recorder app on your phone: it acts as a kind of digital butterfly net, allowing you to capture melody ideas in some tangible form as soon as they occur to you, so you don't struggle to remember them later.

The ability to pluck great melodies out of thin air is an enviable skill, but even if you're not so naturally gifted in this department, it's still possible to craft memorable tunes by sticking to one or two fundamental guidelines.

To start with, ensure that at the important structural points of the track (the downbeat of a bar or a significant syllable in the lyrics, for example), the melody lands on one of the notes in the current chord.

Any passing notes in between should be taken from the same scale as the key of the song. Following this basic formula should quite quickly establish a framework around which extra notes from outside the scale can then be woven into, adding interest to the basic tune.

All too often, we start with just a snatch of melody - a half-bar or two that comes to us as if in a dream. The question then becomes: where do I go from here?

How can I take this bundle of notes and turn it into a full, rounded melody? This is the conundrum we attempt to address in the four step-by-steps below, so that you'll always have some theory-based backup should you find yourself hopelessly bogged down during the writing process!

To learn more about putting all these tricks together, and for more on melody, check out last year's autumn issue of Computer Music (CM 183).

Deriving a melody from inverted chords

Step 1: Inverted chords can be used to reinforce a tune, as well as suggesting a melody where one doesn't exist yet. Let's start with this basic progression. All the chords are major triads in root position.

Step 2: Here's the progression again, but with first inversions at bars 1, 5 and 8 and second inversions at bars 3 and 6. Bars 2 and 4 remain the same, while bar 7 is still in root position, but played an octave lower. This gives the progression a more definite shape, from which we can start to discern a melody.

Step 3: To maintain playback of our chords in the background, copy and paste the part to another track playing a different sound. From the copied part, mute out or delete the lowest two notes from each chord, revealing a single-line melody defined by the top notes.

Step 4: Now we have the basic framework of our melody, we can shape it further by altering note lengths and inserting additional notes, thereby adapting the rhythm to fit a particular lyric or meter. Our example is a very well-known tune. Recognise it yet?

Using the one-degree overshoot

Step 1: When aiming to hit a particular note, briefly deviating above or below the target note by a single scale degree (ie, one note) before hitting the target can add a twist of flavour to your melody, as well as enhancing the rhythmic feel. Here we have a two-bar melody in the key of C major, playing the notes C, C, D, E, G.

Step 2: In the next two bars, we repeat the phrase, but instead of going directly from E to G, we overshoot the G by one scale degree to land on the higher A note. After that, we resolve the overshoot back to the G, giving us a line that goes C, C, D, E, A, G).

Step 3: Our second example is the same pattern but with the last note played one octave lower. In the first phrase, we go directly down to the low G, but in the second phrase, we hit the lower F first, coming back up to the G from there. This gives us a second phrase to add to the first, instantly doubling the length of the melody so far.

Six degrees of separation

Step 1: If you reach a point in the melody-writing process where you don't know where to go next, try applying this technique to inject some movement into proceedings. Start by working out the key and scale that you're working in. In the example above, we have a short melody in the key of C, based on the notes in the major scale.

Step 2: From the note you're stuck at, work out where six notes further up the scale would be, and jump to that note. In our example, the last note of the melody so far is G. Six degrees up the C major scale (counting G as well) takes us up to a higher E note (G,A,B,C,D,E). This dramatic jump takes you into a new area of the keyboard and can sound really effective.

Step 3: You can jump six degrees down as well as up. In our example, this takes us from G down to a low B (G,F,E,D,C,B). From this point, we can steer the melody back in the direction of the starting note, to round things off neatly.

Step 4: Here's an example using a minor scale. It's exactly the same method, just using different notes! Working in the key of F minor, we've ended up on a C note. From here, we could take it six degrees up the F minor scale to an Ab (C, D, Eb, F, G, Ab), or down to a low Eb (C, Bb, Ab, G, F, Eb). We've gone for the higher option here.

Repeated or sequenced motifs

Step 1: Repeating a phrase (or motif) within a melody is an extremely reliable technique for getting things moving when you're stuck. Here we have a simple one- bar phrase in C major that needs to go somewhere. We're going to try repeating the phrase at bar 2 but with a slightly different rhythm the second time around.

Step 2: We copy and paste the phrase into bar 2 and change the starting note to F, but keep all the intervals between the notes the same. This is a process known as imitation, with the second phrase being ab sequence of the first. Note that there is a B (a note from outside the scale) in the sequence. It sounds good, so we run with it. To finish, we insert an eighth-note rest in bar 2, breaking up the rhythm.

Step 3: For the third phrase, we carry out a process known as inversion (different to inversion of chords). Can you spot what we've done? We've turned the original phrase upside down in the musical score! You could also play an existing motif back to front - or alternatively mix the two techniques and turn the phrase both upside down and back to front, as shown at bar 4.

Computer Music

Computer Music magazine is the world’s best selling publication dedicated solely to making great music with your Mac or PC computer. Each issue it brings its lucky readers the best in cutting-edge tutorials, need-to-know, expert software reviews and even all the tools you actually need to make great music today, courtesy of our legendary CM Plugin Suite.