Many composers pour over melody but often times not in the way you're thinking. It's pretty common in pop and rock that the melody "writes itself" meaning the melody naturally settles into the chords. That doesn't mean it's easy to write a melody just that it's often the sum of it's parts.
Now, when you're composing for orchestra or film, its generally the case that the melody or the melodic line (being whatever is carrying the music) is written first. This is opposite most pop or rock where the melody comes after the riff and basic arrangement. It's not unheard of to have a melodic concept fly into your head and the rest unravel from there but, to be perfectly generalizing, the music is often written first. While I have plenty of experience writing for either style, I'm going to focus on orchestral writing since melody is generally the starter fluid.
Melody is where the metaphor starts. The metaphor is essential to classical music as it's the only way to convey the emotion in the piece. Its with that that we have to take into account some of the metaphorical impact of rhythm and intervallic relationships (I got to use that fancy word again). Let's take, for example, the classic melody starter: the fifth.
The basic consensus is that fifths bring up images of power or adventure or strength. They have a rich background in military bugle calls and such so they're historically associated with those ideas. Case in point:
That particular rhythmic lift up to the fifth has been used countless times to convey a grand entrance of royalty or someone of importance. The fifth has also been used as a classic call to arms or call to action which is why it's association with adventure is so strong. The Star Wars Main Title begins with a fifth, as does the secondary Jurassic Park theme, or E.T., or (just so you don't think John Williams is the only composer I know) The Avengers theme. Each of these is calling us to action. They invite you to dive into the world you're seeing. Particularly the Jurassic Park example which is begging you to join in so much it actually has two calls in a row. Using it is a power move and possibly overused but, really, are you going to argue its effectiveness? Nah. It's a conversation starter if there ever was one.
The point here being: your note choice will impact your intentions. Which isn't to say fifths are always powerful and always calls to action but you should know your intention before you go blaring away on them!
Melodies themselves have a few effective ways to stand out. First and foremost, orchestration is important. The type of orchestration used will determine how well your melody is received. The easiest and simplest solution is chord accompaniment.
A simple waltz melody. Nothing fancy, it kind of has a longing to it due to the rising and falling nature of it. Melodies like these tend to come across as nostalgic. A kind of bitter sweet memory or something to that effect. Lets fill in some chords.
This alone could be all we need. Especially if the melody is supposed to feel a little lonely. Too much movement will definitely change the mood we currently have. But, for argument's sake, I'll add in some different types of movement to demonstrate.
Not too drastic! The rhythm works well and doesn't detract from our intention too much. Although the emphasized waltz rhythm does conjure up a little royal court type imagery to me. I would probably shy away from this if I'm trying to convey a nostalgia trip.
Speaking of nostalgia trip, the eighth note rhythm definitely creates a flowing feeling underneath our melody allowing it to soar a little. This would be useful when we jump back into the melody for heightened excitement. It doesn't have the stuffy ballroom feel of the other rhythm (that ONE-two-THREE-ONE-two-THREE thing). Here's one particular way I would orchestrate this:
In keeping the lone flute on top and restraining strings in the mid range we create a very nice sense of longing. The melody is allowed to dip and breathe on its own but not unsupported. I might even consider ditching the violas and doing divisi chords between Violin I & II, which might allowed our flautist to dig in to the emotion a little more.
Finding the melody's place in the music is the most important job a composer has; this is just the tip of the iceberg too, there are many ways to color a melody that don't just involve the accompaniment and we'll be jumping into those next time!
Do you have a technique you like to employ? Do you completely disagree with everything I just said? Let me know below!