Emotionally consistent music melody generation algorithm integrating prompt perception and hyper-network optimization
摘要
This paper proposes a stable emotion-consistent music melody generation algorithm (ECM-HPO) that integrates cue-awareness and hyper-network optimization. The algorithm is optimized to address three core challenges in intelligent melody generation: emotion consistency defects, insufficient understanding of user intent, and dynamic adaptability limitations. The algorithm contains three core innovations: (1) Emotion consistency enhancement mechanism. The algorithm constructs a unified emotion space by combining audio features, text cues, and historical melody windows, and optimizes the macro-emotional profile and micro-note expression based on differentiable music theory constraints; (2) Cue-aware melody-guided generation module. The algorithm establishes a unified encoding framework for heterogeneous cues and uses multi-scale cross-attention to achieve semantic alignment. At the same time, the cue vector is injected into the generation process as prior information through a conditional decoder; (3) Hyper-network-optimized dynamic generation architecture. The algorithm adopts a three-level hyper-network (context-aware → parameter generation → dynamic loading) to achieve on-demand prediction of generator weights. At the same time, the model introduces a music-specific search space to take into account music theory constraints such as harmony and rhythm density. Experiments on the constructed EMD-Melody dataset show that ECM-HPO significantly outperforms baseline methods (TGM, Transformer, EAM, CDM, and LSOTAM) in multiple indicators. Numerical results show excellent performances of melody contour smoothness (PCS) of 0.910, rhythm consistency (RC) of 0.891, and emotion recognition accuracy (ERA) of 92.4%. Ablation experiments verify the contribution of each module and the PCS of the complete model is improved by 15.19% compared with the basic model. Cross-style tests further confirm the robustness of the algorithm.