Writing a theme or a melody for a piece for me is an intellectual work, a lot of analysis.
I think of a theme as of a person and search for a better way to describe its character. In music for that we have three basic tools: Melody. Harmony. Rhythm.
Where the second one can be seen as a melody: harmony notes played separately become a melody.
Let’s say we need to describe a character who is: powerful, dangerous and unpredictable.
We translate those qualities into Pitches (Harmony and Melody) :
– Powerful: strong and large intervals like fourths, fifths and octaves
– Dangerous: minor second, augmented fourth and major seventh
– Unpredictable: irregular use of those intervals will give uncertainty to the music
and Rhythms :
– Powerful: steady, accented and not too fast note duration.
– Dangerous: some sharp and sudden accents and rhythms.
– Unpredictable: irregular use of those tricks will give uncertainty to the music.
This is a pretty straightforward and easy way to create characters. But it works well and listeners will get your point.