by Liam Mitchell

How to write a melody in 5 easy steps

how to write a melody

Music speaks through the language of melody. A melody can be instrumental or vocal, elaborate or as simple as a couple of notes.

Typically the hook or top line in a song, the melody is what grabs our attention. When writing melodies, we try to create something catchy, containing some excitement and emotion.

The process of writing melodies is partly intellectual and partly instinctual, as intervals and patterns of notes evoke different images and emotions. In today’s digital media, the value of a short, memorable, ear-worm hook has never been higher.

This article introduces the role of melody in music, breaking down how melodies are used with examples from different music genres. Then we’ll run through five steps for writing your own melodies.

Jump to these sections:

Get your songwriting juices flowing with a free copy of KOMPLETE START, a curated selection of studio-quality instruments, effects, utilities, loops, and samples.


What is melody?

A melody is a recognizable sequence of notes, a certain combination of pitch and rhythm that lingers in the memory. It is the main voice we hear in a piece of music. The term melody comes from the Greek word for singing or chanting.

The secret of how to make good melodies is controlling tension and release. Interesting melodies often play on our familiarity and expectations from music we’ve heard before, then add a unique twist to catch us off-guard in a pleasing way.

Contrasts give power to a melody—different note intervals, major or minor scales, repetition and variation, switching up timing from slow to fast, or ranging dynamics from quiet to loud.

A lot of popular music strikes a fine balance between the familiar and the unexpected. Too familiar and it sounds cliché, too experimental makes it challenging for the listener.

You might create a melody over chords played on a piano or guitar, or start with a single melodic line and build a song around it. Different music genres follow set formulas in their arrangements, such as the verse/chorus structure ubiquitous in pop and rock music.

Electronic music producers sequence beats and instruments in a DAW—a new, modern approach to creating melodies. Whether it’s a vocal, a synth pattern, a guitar solo, or a bass line, the important thing is a melody that is identifiable, memorable, and above all makes you feel something.

What makes a good melody?

There is magic in the process of writing music—something unconscious and unquantifiable, that makes it more difficult but also massively rewarding.

Just consider the breathtaking diversity of genres and styles of music that people have created over the years, around the world, drawing on individual cultures and experiences.

Although music is informed by rules and theory, there is no single rulebook for how to write a good melody. Whether you write your melody over chords or you’re starting from scratch, it’s good to get into the habit of listening actively to music and analyzing how it works and how melodies tell stories without words.

Let’s take a look at four examples from different corners of the musical landscape.

“Prelude” from Cello Suite No. 1 in G Major by J. S. Bach

This famous Bach prelude is three hundred years old and it continues to serve as a masterclass of melody and harmonic balance.

As you can hear in Yo-Yo Ma’s crisp performance, the piece is played on solo cello yet manages to evoke a full ensemble of bass, accompaniment, and topline melody all in one.

Bach achieved this effect using runs of repetitive arpeggios. Rapid, single-note patterns ring out on the open strings to make chords, which the piece gradually modulates through while retaining the sense of a guiding lead melody. It’s clever stuff!

If you’re interested in writing in a classical or cinematic direction, check out our introduction to composing music.

“B.O.T.A.” by Eliza Rose

This recent dance banger opens with some nostalgic 90s rave and UK garage samples, adds a thumping beat, then introduces an undeniable ear-worm of a topline.

The soft, ghostly quality of the vocal melody contrasts well with the bold, bass-heavy instrumental. This proved a killer combo and the track was a crossover hit, reaching the number one spot in the British singles chart.

The single-note bass in the verse sections of the track demonstrates a common trend in dance and EDM music – the melody is reduced to a single, monophonic bass or synth element, mixed in with the beat to blur the line between melody and percussion.

To learn more about making electronic beats with a computer, head to our beat making 101 guide.

“Stan” by Eminem

There are countless genius examples of tracks made by repurposing or ‘flipping’ a sample from an existing record—in this case, the song “Thank You” by Dido.

Hip-hop tracks use sampled hooks in this way to create chorus melodies, typically a vocal or instrumental refrain that we hear between each rap verse. Disco and other dance music genres make similarly heavy use of sampling.

“Stan” works so well because of how Dido’s melody complements Eminem’s rap sections. The drums and chords from the sample become the backing beat and bass in the verses.

Whereas Dido shifts into a major key and a more upbeat tone in the chorus of her song, here we are kept in a dark, haunting atmosphere. The sample is re-contextualized, as one section of the original is looped out into a full new composition.

“Black Summer” by Red Hot Chili Peppers

This song is particularly catchy because of the interplay between the lead melody and the accompanying chords.

Focus on Anthony Kiedis’s opening vocal. He begins on the tonic, (that is, the first note of the scale), rises in steps up to the fifth, then back down to the tonic. His next line floats upward for a moment, falls down below the tonic, then twists up again suddenly at the end. There’s an interesting shape to the melody.

When we hit the explosive chorus of the track, Kiedis blasts in with a note more than an octave higher than his range during the verse. The descending lead melody harmonizes with the backing vocal to produce warm third chords.

The lead guitar solo later repeats the verse melody from the vocals, riffing on a motif that sounds familiar to us by this point in the song.

Five tips for writing melodies

1. Listen and feel the music

The simplest way to learn how to write a good melody is to immerse yourself in the music you dream of making.

Listen widely and listen actively, studying how the structure and the different elements work together to convey emotions and stories like a language.

Taking inspiration from other music is perfectly legitimate. Practically all music draws on influences that came before, which is not the same as plagiarizing an idea wholesale.

2. Learn some music theory (or don’t)

Learning some basic music theory can really help if you’re struggling with how to write a melody over chords, or a topline over a beat.

Understanding the harmonic relationships between different notes and chords will inform how you write and shape your own melodies. All melodies are made from the building blocks of basic note intervals.

A potential start to writing your melody could be utilizing the pentatonic scale. It’s found in almost every style of music and is made up from five of the seven notes in a major or minor scale. The strongest notes of a pentatonic scale are the tonic, third, and fifth, and these can be used as foundations for melodies. Songs including “My Girl” by The Temptations and “Wake Me Up” by Avicii both use the pentatonic scale as building blocks of their melodies.

Write at a piano or keyboard and you will literally visualize and grasp the theory behind the music, laid out in physical shapes that you can see and feel. Things like octaves and triads, key signatures, and major/minor chords make more sense when you get hands on.

What’s more, digital keyboard controllers such as Native’s KOMPLETE KONTROL S-Series make for a seamless transition from improvising to recording, so you never need to break your flow.

3. Experiment with repetition

Popular melodies are simple, memorable, and repetitive. Repetition is a great way to reinforce the feeling and meaning of a song without needing to reinvent the wheel.

A powerful example of melodic repetition is Taylor Swift’s “Shake it Off.” Nearly every aspect of this GRAMMY-nominated song repeats itself. The verse melody sung during “I stay out too late,” is the same in the very next line, the “mmms” in the verses repeat, and the melody sung with the “play, play, plays” in the chorus are replicated over and over again.

The repetitive nature of the melody makes the song catchy, energetic, and playful.

Try experimenting with a repetitive word, a repetitive set of notes in the melody, or repetitive chord progressions as you write your song.

4. Change direction

Creative block affects most artists at some point. When it happens, a change of approach can be the antidote.

Try switching up the order and tackle a project from a different angle—write a synth melody before building a beat, or start with a chord pattern or the topline melody. Transpose something up or down to a different octave, or change the tempo or time signature for a new challenge.

Changing to a different instrument or sound can also help get things flowing. If you’re stuck on how to write a melody on piano, try a guitar or another instrument, use your voice, or sequence a pattern digitally.

Computer DAWs can automate melody in various ways, such as using an arpeggiator to transform one note across various scales and chords. For guitarists, GUITAR RIG boasts a wealth of amplifiers and effects from different periods and styles of playing, as well as realistic sampled guitars as virtual instruments.

5. Don’t stop working at it

The reality is that fans rarely see all the work, struggle, and bad discarded projects behind the best music of their favorite artists. The only way to really get better is to keep going, make new discoveries, learn from past mistakes, and gradually build confidence in your own method.

Collaboration and sharing production or songwriting credits is very common in the industry. A backing track or beat is often created first, with a topline melody added separately. Collaboration between artists is easier than ever online, and there’s always a new toy or tool you can add to inject some excitement into your music.

The process can be mystifying to beginners, but it’s a long-term project. There’s no hack to this. It’s simply time, practice, devotion, and love for the music.

If you want to learn more about the writing process, head to our songwriting guide.

Related articles