How to write melodies like Avicii: "A lot can be learned by studying Avicii’s melodies and using his composition ideas in your own tracks"

(Image credit: Getty Images)

The Swedish DJ producer Tim Bergling – aka Avicii – was one of those musicians whose careers were cut far too short. But he’ll always be remembered for crafting unforgettable melodies. 

A lot can be learned by studying Avicii’s melodies and using his composition ideas in your own tracks. From his interviews, it seems he started with the melodic line first and crafted the rest of the production around the melody. This type of approach differs from the typical electronic music process of beginning with the rhythmic components. 

He would often use one melody and repeat it, and add variations or short stutter notes. He worked with melody forms like AAAA (one melody is repeated four times), AAAB (repeated three times then varied) and more. 

Listen to Avicii’s melodies and see how many different melodic structures you can hear. Here, we’ll look at how to create the types of melodies and sounds Avicii used in SOS and Heaven.

Creating Avicii-style melodies 

Avicii melodies 1

(Image credit: Future)

Set the BPM in your DAW to 100, and create a MIDI track. Load up a soft synth and find a muted guitar-type sound  (we’re using Nexus, and the Mute Guitars 2 preset). Create a MIDI clip that’s one bar in length and write a catchy one-bar melody. Try an ascending pattern, then have the pattern descend on the same notes.

Avicii melodies 2

(Image credit: Future)

Copy the melodic pattern into bars two, three and four. Make a variation in the second half of the last bar. One idea is to have a pattern that repeats twice rather than a descending line. This type of melodic structure is called an AAAB melody as the first bar repeats three times, then changes to a new idea in the fourth bar.

Avicii melodies 3

(Image credit: Future)

Add some shorter ‘stutter’ notes to add rhythmic variations. In this example in bar one, the first note on 1.3 is broken into two smaller notes. The extra note helps add more movement and interest to the line. In bar two, add a small rhythmic variation at the start of the third beat, 1.3 . In bar three, copy the entire melody from bar one.

Avicii melodies 4

(Image credit: Future)

In the fourth bar, on beat three, try using a similar melodic or rhythmic phrase to that used for the variation in bar two. This will create both repetition and contrast throughout the melody. The four bars are now an A1, A2, A1, B melody pattern. The first bar plays, there’s a slight change, then the first idea repeats before the melody ends.

Avicii melodies 5

(Image credit: Future)

Create a return track and add your favourite reverb to it. Choose a medium hall, and send your synth to the reverb. We layer our muted guitar sound by creating a blank MIDI track, and add an instance of Mixed In Key’s Captain Play Epic to it, but you can use anything else to fatten up the sound. Turn down any global effects.

Avicii melodies 6

(Image credit: Future)

Send your fattening-up synth to a reverb. For the third layer, create a MIDI track and add a plucky-sounding preset from another synth, and adjust the decay if needed. Move to the Effects section and turn off reverb and delay. Send this synth to the reverb and add a delay plugin, like Soundtoys Echoboy. Use a ¼” delay to add movement. 

Get the Heaven lead sound 

Heaven lead sound 1

(Image credit: Future)

Create a MIDI track and load up a wavetable synth like Serum (which is what we’re using). For the first layer, create a simple lead by choosing the Analog BD Sine wave, and turning the WT Position all the way to the right. In ENV 1, set the attack to 0.5, Hold to 0.0, Decay to 983ms, Sustain to -8.1 and Release to 15ms. 

Heaven lead sound 2

(Image credit: Future)

In the effect section, turn on the compressor and multiband. Turn on the distortion, and filter. Drag ENV 1 to the FX Filter cutoff. Create a two-bar MIDI clip, write a short melody and repeat three times. Copy the phrase a fourth time, and change the notes so the melody closes with a different ending to create an AAAB melody. 

Heaven lead 3

(Image credit: Future)

Create a new MIDI track and add the same synth to create a second layer. On OSC A, choose a basic shape waveform. Increase the Unison to 7 and set Detune to 0.15. Set the wavetable position to 2. On OSC B, choose a vowel waveform (like Serum’s OOH_YAH_OO). Set the Unison to 7, Detune to 0.15 and Blend to 75. 

Heaven lead 4

(Image credit: Future)

In the same track, set Attack to 0.5, Hold to 0.0ms, Decay to 983, Sustain to -8.1 and Release to 273ms. In the FX section, turn on the compressor and the Multiband. Copy over the MIDI melody from track one to this MIDI track. Add an EQ and roll off the low end below 270Hz, and above 20kHz.

Heaven lead 5

(Image credit: Future)

For the third layer, create a big room supersaw lead. We add Nexus 3 and choose LD Accelerator, but a similar gnarly sound will work. Turn off the synth’s Delay and Reverb. Add a compressor like Teletronix LA-2 for some light compression, and an EQ to roll off the low end below 485Hz and above 19kHz. Paste the melody pattern.

Heaven lead 6

(Image credit: Future)

Create two MIDI tracks and copy the melody. Create a brass layer by adding Kontakt, selecting Trumpet Ensemble from the Kontakt Factory Library. Then, increase the sound’s width in the stereo field, and an EQ to roll off lows and highs. Lastly, you can add an M1-esque ‘dance piano’. Add an EQ to roll off below 268Hz and above 5200Hz.

Pro tip

Valhalla Room

(Image credit: Future)

Unite the lead layers by grouping and processing them together. Use an EQ like FabFilter Pro-Q 3 to roll off low frequencies below 150Hz, above 20kHz and add a small boost around 1200Hz. Glue sounds together by adding a compressor and set it so that there’s 3-5dB of gain reduction. 

Valhalla Vintage Verb

(Image credit: Future)

Lastly, add a compressor and sidechain it to a kick drum. Create three return tracks and add an algorithmic reverb like (Valhalla Room) on one, delay (like EchoBoy with Ping Pong Delay) on the second, and vintage-style reverb (like Valhalla Vintage Verb) on the third. 


(Image credit: Future)

Send the group to the Reverbs and Delay. Beyond sound design, one of the keys to writing Avicii-style melodies is repetition and variation. This is a powerful, yet simple technique to create memorable melodies. Avicii often closed out his phrases by changing the melody, surprising listeners with a fresh twist. 

To create great melodies like Avicii, focus on four-part melodic structures. Write a short melody and use a form such as AAAB or AAAA. Try adding short stutter notes and make small variations on each part of the melody. For example, a melodic structure like A1, A2, A1, B could be effective with a strong A section. Apply these concepts and you’ll hear your songs improving!


Avicii’s work existed in the dance realm but his reference points ran increasingly deep as he  developed his own preferences and style (Image credit: Getty Images)

1. Avicii - Fade Into Darkness

This gorgeous tune features a piano sample by Simon Jeffes and uses an AAAA pattern.

2. Avicii - Wake Me Up

The verse’s melody is an ABAC pattern while the chorus features an ABAB pattern.