Hi.
I am currently about to take the ABRSM grade 8 theory examination, and there's a component which includes melody writing. When I first started out, I merely stared at the 2 bars of given opening without a single idea how i should continue. Well now it's somewhat getting better, I'm actually coming up with short melodies. However, is there anyone who can give advice on good melody writing? Like the elements of a good melody etc. And any advice on composing atonal music? I seem clueless at that too. Thank you and all your help would be greatly appreciated.
20 Rules to Write Memorable Melodies
1. Centre on a pitch.
This means that you must choose a specific pitch to be your “home” pitch. Now start and end your melody on this pitch, and also make the notes of the melody play around that pitch, landing on it form time to time. This pitch does not need to be the tonic. In fact that is how modal melodies work: they are centred not on the tonic but on the final of the mode.
2. Make sure you end up at home.
Always finish on the home pitch (remember it does not need to be the tonic). Otherwise your melody will sound “unfinished”. Finishing on the home pitch gives a sense of resolving tension and completion.
3. Stay within the scale.
If you use notes that do not belong to the scale, they will sound wrong, out of place. Only the best composers can get away with using chromatic notes (that is, accidentals).
4. Use the big five.
Stick to the five most important degrees of the scale: The tonic, the supertonic, the mediant, the dominant and the submediant (C – D – E – G – A in C major). This creates a pentatonic sale. Because you are avoiding the subdominant and the leading note (F and B) you will not have dissonances, so whatever you play will sound good.
(this is the equivalent of playing only the black keys in the piano. Can you see why?)
5. Find the hook.
This is also called the “motif” – a bit of melody that “hooks” the listener, and that is repeated throughout the music.
6. Create variations.
Once you have a motif, you can vary it by inversion, augmentation, and retrograde. You can also develop the motif by playing it in different degrees of the scale.
7. Write in four, eight or sixteen.
Have your melody to be 4, 8, or16 bars long. Even if you have a long melody, try to divide it into segments 4 bars long. For instance a 32 bar melody could be made up of eight 4 bar phrases.
8. Make it move.
Music only exists in time. A single note is not music. That single note must go somewhere. You make a melody move either by rhythm (you play the same note with different rhythms) or the melody itself moves by going from one note to another. Most of the time you combine both movements.
So, if you want to create an upward movement, make the last note be at least a fifth higher than the first note. Likewise, to create a downward movement make the last note at least a fifth lower than the first note.
The famous Brazilian composer Heitor Villa Lobos created his melodies by making sketches of the mountains he could see from his window and making the notes follow his sketches.
9. Take small steps.
Singable, lyrical, melodies have small steps between notes. The more the melody jumps around the more difficult it is to sing or play.
10. Stay in range.
Try to keep the lowest and the highest notes in your melody within the space of an octave and a third (otherwise it may become impossible to sing).
11. Avoid unsingable intervals.
These intervals are particular difficult to sing, so try to avoid them:
i. Octaves
ii. Fourths
iii. tritones
iv. sixths
v. sevenths
12. Keep the rhythm simple.
Unless you are very experienced, stick to quavers and crochets and avoid syncopations.
13. Stay in time.
If you are a beginner stick to the simple key signatures and avoid the irregular ones (5, 7 & 9). You should be able to tell straightaway where the beats of your melody are.
14. Set up and resolve tension.
If your melody has two parts, make the first part set up a tension and resolve in the second part. The most common way to do that is to finish the first part on any note except the tonic (usually the dominant), and then on the second dpart to fininsh on the tonic.
15. Set up a call and response.
Set up a phrase on the first part of the melody , and then “answer” it on the second part. With practice you will know how to do naturally. But to start with, think of a real question and its answer: “How are you? I am fine, and you”
16. Establish symmetry.
Make the second part of your melody a mirror image of the first. You can do that with the rhythm alone, the pitches or both.
17. Balance repetition and variety.
There should be plenty of repetition in music. But too much can get boring.
18. Follow the chord progressions.
Fit the notes of the melody to the notes of the chords in the harmonic progression you want to use.
19. Follow the form.
After you choose a form, use it as a mould for the melody.
20. Follow the words.
Fit the melody to the rhythm implied by the words, and also to the rise and fall of the language. (e.g. questions go upward, so should the melody).
And finally: Rules exist so that they can be broken.

I hope this helps.
Best wishes,
Bernhard.