  Emotion-driven melody harmonization aims to generate diverse harmonies for a
single melody to convey desired emotions. Previous research found it hard to
alter the perceived emotional valence of lead sheets only by harmonizing the
same melody with different chords, which may be attributed to the constraints
imposed by the melody itself and the limitation of existing music
representation. In this paper, we propose a novel functional representation for
symbolic music. This new method takes musical keys into account, recognizing
their significant role in shaping music's emotional character through
major-minor tonality. It also allows for melodic variation with respect to keys
and addresses the problem of data scarcity for better emotion modeling. A
Transformer is employed to harmonize key-adaptable melodies, allowing for keys
determined in rule-based or model-based manner. Experimental results confirm
the effectiveness of our new representation in generating key-aware harmonies,
with objective and subjective evaluations affirming the potential of our
approach to convey specific valence for versatile melody.
