  Music as an emotional intervention medium has important applications in
scenarios such as music therapy, games, and movies. However, music needs
real-time arrangement according to changing emotions, bringing challenges to
balance emotion real-time fit and soft emotion transition due to the
fine-grained and mutable nature of the target emotion. Existing studies mainly
focus on achieving emotion real-time fit, while the issue of smooth transition
remains understudied, affecting the overall emotional coherence of the music.
In this paper, we propose REMAST to address this trade-off. Specifically, we
recognize the last timestep's music emotion and fuse it with the current
timestep's input emotion. The fused emotion then guides REMAST to generate the
music based on the input melody. To adjust music similarity and emotion
real-time fit flexibly, we downsample the original melody and feed it into the
generation model. Furthermore, we design four music theory features by domain
knowledge to enhance emotion information and employ semi-supervised learning to
mitigate the subjective bias introduced by manual dataset annotation. According
to the evaluation results, REMAST surpasses the state-of-the-art methods in
objective and subjective metrics. These results demonstrate that REMAST
achieves real-time fit and smooth transition simultaneously, enhancing the
coherence of the generated music.
