What is melody in music: A guide to pitch, scales, and keys

intro-melody-featured-image

Illustration: Filip Fröhlich

For many of us, the melody is what draws us to some of our favorite songs.

A catchy earworm can continue to bounce around in our heads long after we’re done listening, and a soaring tune can move us to tears. But exactly what is melody in music—a term we use all the time to describe many different things in both casual and creative contexts—and what are the building blocks that constitute the melodies we know and love? In this article, we’ll discuss the fundamental principles that are relevant to the idea of melody.

See the table of contents below to easily jump to a specific section:

What you’ll learn:

Feeling ready? Let’s dive in!


What is melody in music?

Put simply, a melody is a succession of musical tones that are grouped together as a single idea. While melodies come in all sorts of shapes, sizes, and moods, they’re often one of the most memorable parts of a piece of music (although not always—plenty of music exists that’s solely comprised of percussion instruments, for example, which may not have a super clear melody).

If you’re singing the tune to a song like “Mary Had a Little Lamb” or playing the gritty guitar solo in “Smells Like Teen Spirit,” you’re performing a melody.

Structurally, a melody is comprised of pitches that are in rhythm. In a previous article, we discussed what rhythm is and how it appears in music. But what is pitch, and how do we wield it to make melodies? Let’s explore further.


What’s pitch in music?

Melodies are made up of a combination of unique pitches, or musical tones, that are named using the first seven letters of the alphabet (A, B, C, D, E, F, and G), and repeat endlessly—i.e. once we reach G, the following letter is another A.

Let’s take a look at how pitches are organized across a few commonly-used mediums, starting with the keyboard:

A keyboard with each white key labeled with the corresponding letter (from "What is melody in music?" on the Splice blog).
White keys and octaves

As seen above, on the keyboard, each of the white keys conveniently corresponds to a letter of the musical alphabet. Two pitches that are labeled with the same alphabetical letter but are eight letter names apart make what we call an octave. Pitches that are an octave apart sound similar due to a principle known as octave equivalence; if you play the two Ds pictured above, you’ll find that although one sounds higher, they otherwise sound quite similar in character:

Two Ds played an octave apart

Your turn: Use the keyboard in your DAW (or this online keyboard) and try playing different pitches that are an octave apart. Then, try playing a few other pairs that aren’t separated by an octave (i.e. any two notes that have different letter names). Notice how the pitches that are an octave apart sound quite similar to one another, while the ones that aren’t sound more distinct from one another.

You can take the idea of octave equivalence further by playing a longer succession of pitches in different octaves. As long as you’re playing everything exactly an octave apart, the melodies will sound ‘the same’ aside from how high / low they are.

Black keys and accidentals

Black keys expand the variety of tones we have at our disposal by supplying pitches that are in between the pitches of adjacent white keys. Instead of using a new set of alphabetical letters to name them, we identify black keys in relation to their neighbors—the black key immediately to the right of a white key receives its letter plus a sharp (♯), and at the same time, the black key immediately to the left of a white key receives its letter plus a flat (♭). This means that every black key has two different names; this idea of having two or more possible names for a single pitch is known as enharmonic equivalence.

A picture is worth a thousand words—see how the black keys are labeled below:

Enharmonic pitches labeled on a keyboard (from "What is melody in music?" on the Splice blog).

The sharp (♯) and flat symbols (♭) are known as accidentals. While we won’t go into depth on its use cases just yet, there’s one more commonly-used accidental, a natural (♮), which cancels a sharp or flat and ensures the ‘white-key’ version of the note is played.

An audio example is worth a thousand pictures—let’s take a listen to how the black keys sound:

You may have noticed that there’s no black key in between B and C, as well as E and F. This is because those pairs are already as equally close in pitch as any black key is to an adjacent white key. This interval (the distance between any two notes) is known as a half step (or semitone), and represents the smallest increment in pitch possible, at least in most popular Western music. On the other hand, we have whole steps (or whole tones), which are an interval equivalent to two half steps.

Your turn: Write down whether you think the following pitches are separated by a half step or a whole step:
1. G and A
2. D and D♯
3. F and G♭
4. C# and D#
5. B and C

Think you got it? See the answers below.

1. Whole step (G → G# → A)

2. Half step (D → D#)

3. Half step (F → G♭)

4. Whole step (C# → D → D#)

5. Half step (B → C; remember, these two white keys are only a half step apart)

 

Now that we have an understanding of pitches and related concepts like octaves, accidentals, half steps, and whole steps, let’s take a look at how they’re expressed in sheet music.


How pitches are expressed in sheet music

In sheet music, we draw notes (represented by various ovals) from left to right, on a series of five vertical lines and spaces called a staff:

Pitches displayed on a musical staff (from "What is melody in music?" on the Splice blog)..

As seen above, the higher we position a note on the staff, the higher its pitch. However, to know exactly what pitch a particular line or space represents, we need one more thing: a clef. Located on the far left of staves (the plural for ‘staff’), clefs tell us which space or line represents which exact pitch. While there are several clefs, we’re going to focus on the two most common ones: the treble clef and the bass clef.

Treble clef

Also sometimes referred to as the G-clef, the treble clef is generally used for things that perform relatively higher notes, like the piano’s right hand and the violin. It’s also usually the default clef for DAWs that have sheet music notation tools built into them.

The treble clef

If you see a treble clef on your staff, the pitches can be identified as follows:

Notes to the right of a treble clef are displayed and labeled across a staff (from "What is melody in music?" on the Splice blog).

Note that you can use ledger lines to add notes above or below the staff.

In the beginning, you’ll probably find that it takes a little bit of time to name pitches on a staff. As you use sheet notation more and more, you’ll eventually become able to look at a note on the staff and immediately identify what it is, just like how you can read a word without having to sound out each letter. There are a number of mnemonic devices that can also expedite this process; for example, notice how the spaces on the staff spell out ‘FACE when using the treble clef.

In order to notate sharps or flats, simply add the accidental to the left of the note:

Four sets of labeled whole steps and half steps laid across a staff (from "What is melody in music?" on the Splice blog).

Your turn: Write the letter names for each note below:

Think you got it? See the answers below.
  1. D
  2. D
  3. C♯
  4. A♭
  5. F♯

 

Bass clef

Also sometimes referred to as the F-clef, the bass clef is generally used for things that perform relatively lower notes, such as the piano’s left hand and the cello.

A bass clef on a staff

The bass clef

If you see a bass clef on your staff, the pitches can be identified as follows:

Notes to the right of a bass clef are displayed and labeled across a staff (from "What is melody in music?" on the Splice blog).

Your turn: Write the letter names for each note below:

Think you got it? See the answers below.
  1. A
  2. G
  3. D♭
  4. F♯
  5. A♭

 


How pitches are expressed in MIDI / the piano roll

With MIDI, the staff is replaced by a grid, where pitch is determined by the vertical positioning of a note.

In most DAWs, you’ll see a keyboard on the lefthand side that helps visually identify which pitch a note is representing. Clicking and holding any note should also reveal the note name and octave number (ex. C4), and you should be able to adjust the pitch by dragging the MIDI note up or down.

Note that MIDI defaults to using sharps over flats (ex. you’ll always see a pitch labeled as ‘C♯4’ over ‘D♭4’). This is partially because the piano roll has no way to decide which enharmonic spelling is correct, whereas we can make that call for ourselves when we’re writing our own sheet music.

You may be thinking to yourself, “I don’t know when to use which enharmonic spelling of a note myself.” Don’t worry—we’ll dive into scales next, which will help us gain an understanding around how to determine proper enharmonic spellings in different contexts.


What are scales in music?

Even if you’re new to creating music, you’ve probably heard of scales before. A scale is simply a collection of notes, arranged in a specific order.

The chromatic scale

Let’s start by looking at the most ‘inclusive’ of all scales. If we take all of the available keys on the keyboard and arrange them in ascending order, we get the chromatic scale.

Here’s what the chromatic scale sounds like, starting on C:

And here’s what the chromatic scale looks like, starting on C:

Each note of the chromatic scale is displayed and labeled on sheet music (from "What is melody in music?" on the Splice blog).

The chromatic scale expressed using sheet music (using both clefs as well as sharps and flats)

The chromatic scale, expressed in the piano roll

The chromatic scale expressed using MIDI

While it’s good to be acquainted with the chromatic scale, when first making music, you’ll probably find that using all of the white keys and black keys doesn’t yield the most musical-sounding melody. Other scales limit us to just a handful of notes, which allows us to create memorable melodies more easily. Today, we’ll be looking at the major scale and the minor scale.

The major scale

While there are 12 chromatic pitches available to us, the major scale contains just seven of them. We name major scales by their root note, or the first note in the sequence. We’re going to use the C major scale to introduce the major scale, because conveniently, the scale is simply composed of all of the white keys on the keyboard:

The C major scale

You’ve almost certainly heard this scale before—many people associate it with descriptors like ‘bright’ and ‘happy.’ How the whole steps and half steps are sequenced is what’s responsible for the major scale’s distinctive sound. As we mentioned earlier, the C major scale consists of all of the white keys: C, D, E, F, G, A, B, and C (an octave up from our first C). Below, we’ve identified the intervals from note to note, with W representing a whole step and H representing a half step:

The major scale displayed on a piano with WWHWWWH labeling (from "What is melody in music?" on the Splice blog).

The image above tells us that major scales are defined by the sequence of intervals that can be expressed in shorthand as WWHWWWH (‘whole whole half, whole whole whole half’).

How to spell different major scales

So, let’s say that we want to try writing out a different major scale—the D major scale, for example. We’d take the following steps:

1. Write one note per each line and space on the staff, spanning the root note to an octave above:

2. Label the whole and half steps according to what’s defined by the particular scale (in our case, WWHWWWH):

3. Go note-by-note and add an accidental to any note that needs one to correctly reflect each interval label:

Side note: Earlier, we discussed the idea of ‘proper’ enharmonic spellings. Essentially, for all major (and minor) scales, we want to make sure that every alphabetical musical letter is represented exactly once. Therefore, in the example above, it’s more correct to say that the D major scale contains an F♯ rather than a G♭, even though the two notes sound identical.

Your turn: Spell out the letters, with the correct accidentals, that constitute the E major scale.

Think you got it? See the answers below.

E, F♯, G♯, A, B, C♯, D♯, E

 

How to transpose to a different scale with MIDI / the piano roll

Notice how when we write out a major scale in MIDI, the WWHWWWH interval pattern becomes quite apparent visually, thanks to the contrast in the vertical distance between notes:

Intervals labeled on a major scale, expressed via MIDI

With MIDI, you can technically create any major scale by creating the C major scale, and then highlighting all of the notes and dragging them collectively up / down to the target destination:

Transposing from C major to D major using the piano roll

While this a neat trick that’s admittedly simpler than the process we outlined for sheet music, we encourage you to still practice using that system. Familiarizing yourself with what accidentals are needed in various keys will be useful in the long run, and will also enhance your understanding of the last major concept related to melody that we’ll cover: key signatures.

But before we get there, let’s quickly go over minor scales.

The minor scale

Like the major scale, we can also create a minor scale using all of the white keys. However, to do so we’ll have to use the root note of A, resulting in the scale known as the A minor scale:

The A minor scale

While the major scale is known for its ‘bright’ and ‘happy’ qualities, the minor scale is more often associated with ‘dark’ and ‘sad’ emotions (though these are both huge over-generalizations, since they can both also be used to convey way more emotions). The minor scale’s sound is defined by the sequence of intervals written in shorthand as WHWWHWW (‘whole half whole, whole half whole whole’):

The minor scale displayed on a piano with WHWWHWW labeling (from "What is melody in music?" on the Splice blog).

While the sequence of intervals is different, the process for spelling different minor scales is exactly the same as that of major scales.

Your turn: Spell out the letters, with the correct accidentals, that constitute the G minor scale.

Think you got it? See the answers below.

G, A, B♭, C, D, E♭, F, G

 

Scales are extremely useful tools for coming up with melodies. Try playing around with them—going up and down a scale, skipping notes, or doing a combination of the two—and you’ll find yourself coming up with little melodic ideas in no time.

We’re almost at the end—let’s wrap things up by discussing the idea of keys and key signatures.


What’s a key in music?

So far, we’ve been adding an accidental to each and every note that has needed one when spelling scales. However, when transcribing larger excerpts of music, all of the accidentals will make things look quite cluttered and messy (especially if a melody uses a scale with tons of accidentals):

Having an accidental on almost every note makes this melody look more complicated than it needs to be. While a few of the notes don’t have accidentals next to them, this is only because as a general rule, an accidental only needs to be added once for notes that are repeated multiple times in one measure.

We avoid the hassle of adding accidentals to each and every note via the use of key signatures. Positioned immediately to the right of the clef, key signatures tell us which pitches are to be consistently sharped or flattened throughout a piece of music.

Thanks to the key signature, our melody is now much more pleasant to look at. Notice how the music still sounds exactly the same as before.

The sharps and flats in key signatures are always written in a specified order:

A collection of all major and relative minor key signatures
Relative keys

Notice how each key signature has a major and minor key associated with it—this is because every major key has a minor key that shares the same number of sharps and flats (recall how C major and A minor both had no sharps or flats). These pairings are known as relative keys, and in popular music the line between the two is frequently blurred (ex. we might easily switch from being in A minor during one part of a song to C major in another).

To say a piece is ‘in’ a key simply means that its pitches are mainly derived from a single major or minor scale. Furthermore, the pitches will have some predictable relationships in regards to stability and tension. For example, the first note of the scale will generally be the most stable; when making a melody, we can count on it as a logical starting point, or end with it to create a feeling of resolution.


So, what is melody? | Wrapping up

From pitches to clefs to scales to keys, we covered a ton of ground related to melody today. While it’s a lot, all of it is incredibly important foundational knowledge for our journey as musicians, so definitely take your time with this article until you feel comfortable and confident with all of the concepts.

Once you feel good, start combining what you learned here (specifically around the major and minor scales) with what you know about rhythm, and you’ll find that you’re now able to read and write melodies.


If you’re reading this article as part of your journey towards creating your first track, go back to the curriculum that corresponds with your DAW and proceed to the next step:

October 12, 2022

Harrison Shimazu Harrison Shimazu is a composer, content strategist, and writer who's passionate about democratizing music creation and education. He leads the Splice blog and creates music as Namaboku.