Music plays a crucial role in human life as a medium for emotional expression and entertainment. However, traditional music composition is time-consuming and requires expert skills, limiting accessibility for non-musicians. Recent advancement in artificial intelligence (AI) such as generative music enables the automatic creation of music, yet many models fail to incorporate explicit user preferences such as genre and composition length. This study proposed, user-guided Transformer XL, a genre-aware and user-guided music generation framework that worked on top of Transformer-XL. The system allowed users to specify desired genre and length, while a built-in genre classifier validated the stylistic accuracy of generated outputs. A genre classification module along with the number of bars was incorporated to ensure the generated outputs reflect the intended musical styles. The model was evaluated through a genre characteristic analysis and expert evaluation, revealing strong consistency in genre-specific features. Extensive experiments using the Lakh MIDI dataset demonstrated strong model performance, achieving an overall accuracy of 78.33%, with notable genre-specific strengths, particularly in jazz with recall 1.00 and classic with recall 0.88. In contrast, subjective evaluation using expert evaluation yielded a more moderate accuracy of 60%, highlighting the model’s ability to capture genre-relevant features even under more stringent, nuanced evaluative standards. Overall, this work demonstrates that integrating user preferences into generative modelling enhances flexibility and musical relevance, offering a robust foundation for future development in adaptive AI-driven composition.
Copyrights © 2026