Music Theory

How to Write a Melody

Discover how to write memorable melodies using scales, contour, rhythm, and repetition, with practical steps to turn a hummed idea into a finished tune.

A songwriter humming into a phone while sketching notes at a wooden table
Photograph via Unsplash

A melody is the part of a song people hum in the shower, the line that lodges in memory long after the music stops. Writing one can feel mysterious, as if good tunes simply arrive for the lucky few. In reality, memorable melodies follow understandable principles, and once you know them you can write tunes deliberately instead of waiting for inspiration.

Choose a scale and a key to live in#

A melody is a sequence of single notes played one at a time, and almost every melody draws its notes from a scale. A scale is simply a chosen set of pitches that sound good together, and it acts like a palette for your tune. The major scale sounds bright and resolved, the natural minor scale sounds darker and more reflective, and the pentatonic scale, a five-note subset, is famously forgiving because almost any order of its notes sounds pleasant.

For your first melodies, the pentatonic scale is a gift. Because it removes the two notes most likely to clash, you can wander freely and still land on something musical. Pick a key, find the five pentatonic notes, and improvise over a held chord or a simple loop until phrases start to emerge. This low-stakes playground is where most melodic instincts are born.

Staying within one scale gives your melody coherence. The notes feel related because they are, and that sense of belonging is part of what makes a tune feel finished rather than random. You can break the scale later for a moment of surprise, but establish the home palette first.

Shape the line with contour and rhythm#

The notes you choose matter, but so does their shape over time, which musicians call contour. A melody that only steps gently up and down feels calm and singable, while one that leaps to a high note creates excitement and emphasis. Great melodies usually mix the two: smooth stepwise motion that is easy to sing, punctuated by the occasional leap that grabs attention and marks an important moment, such as the peak of a chorus.

Rhythm is the other half of melody and is often underrated by beginners. The same handful of pitches can feel like a nursery rhyme or a soulful hook depending purely on how they are spaced in time. Long, held notes create weight and emotion, while quick clusters of short notes build energy and momentum. Pay attention to where your melody breathes, because the silences between phrases are as expressive as the notes themselves.

A melody is not just which notes you play. It is when you play them, how high you leap, and where you let the music breathe.

Try singing a simple phrase, then sing it again with one note held twice as long. That single rhythmic change can transform an ordinary line into something that feels intentional and alive.

Use repetition, then surprise#

The single most powerful tool in melody writing is repetition. Listeners need to hear an idea more than once to remember it, so the hooks that stick are usually built from a short motif, a tiny musical phrase, that returns throughout the song. Repetition is what makes a melody feel familiar on a second listen, and familiarity is the seed of a song people love.

But pure repetition becomes dull, so the craft lies in repeating with variation. State a motif, repeat it almost exactly, then change its ending or shift it to start on a different note. This balance of the expected and the surprising is the heartbeat of memorable writing. Consider how often a verse melody repeats a phrase three times and then resolves the fourth differently, creating a small, satisfying payoff.

A reliable structure for a phrase is call and response. Write a short opening idea that feels like a question, then answer it with a related phrase that resolves the tension. The answer can echo the rhythm of the call while moving to a more settled note, giving the listener both connection and closure. Building melodies from these matched pairs keeps long sections from feeling aimless.

Start by singing, not by theorizing#

The most natural melodies usually come from the human voice, even for instrumentalists. Your voice instinctively avoids awkward leaps and gravitates toward phrases that feel good to sing, which is exactly what makes a melody catchy. Hum or sing freely over a chord progression and record everything on your phone, because the best ideas often arrive unannounced and vanish just as fast.

Do not judge while you generate. Sing dozens of rough phrases without stopping to evaluate them, then listen back later and keep the two or three fragments that made you feel something. This separation of creating and editing is how professionals stay productive, since the critical mind that polishes a melody is terrible at inventing one. Capture first, refine second.

When you do refine, sing your melody out loud repeatedly and trim anything that feels hard to remember. If you cannot recall your own tune an hour later, your listeners certainly will not. Simplicity is almost always your friend, and the courage to cut a clever note in favor of a memorable one separates strong writers from busy ones.

Marry melody to harmony#

Melody and harmony are partners, and each shapes the other. The chords beneath a melody color how its notes feel, so the same line can sound joyful over one progression and aching over another. As you develop a tune, loop a simple chord progression underneath and notice which melody notes feel like they land and which create tension that wants to resolve. The notes that belong to the underlying chord tend to feel stable, while notes outside the chord create a pull that you can use deliberately.

You can write the melody first or the chords first, and both approaches are valid. What matters is letting them inform each other rather than treating them as separate jobs. A melody that pauses on a chord tone at the end of a phrase feels resolved, while one that lingers on a tense note keeps the listener leaning forward, hungry for the next move.

You now have a clear path from blank silence to a tune worth singing: choose a scale, shape it with contour and rhythm, build it from repeated motifs, sing your ideas freely, and wed the result to harmony. Pick up your phone, loop a chord or two, and hum until something makes you smile. The more melodies you chase, the more readily they come, so make more music and trust that your next unforgettable tune is only a few hums away.

Nina Cole
Written by
Nina Cole

Nina is a producer and beatmaker who teaches home recording and music theory to people who'd rather make tracks than read textbooks. She demystifies DAWs, mixing, and the circle of fifths in plain English, and she's convinced that theory is just a map for ideas you already feel.

More from Nina