Music Generation Using RNN-LSTM with Self-Attention Mechanism


Abdelalim M., Bashar M., Nemer H., Elmasry V.

9th International Symposium on Innovative Approaches in Smart Technologies, ISAS 2025, Gaziantep, Turkey, 27 - 28 June 2025, (Full Text) identifier

  • Publication Type: Conference Paper / Full Text
  • Doi Number: 10.1109/isas66241.2025.11101751
  • City: Gaziantep
  • Country: Turkey
  • Keywords: Augmented Grand Piano, Deep Learning, Maestro MIDI, Music Generation, RNN-LSTM
  • Istanbul Kültür University Affiliated: Yes

Abstract

Music generation using artificial intelligence is a rapidly evolving domain that bridges the gap between creativity and computational intelligence, offering promising applications in entertainment, education, and therapy. In this paper, a Recurrent Neural Network (RNN) model with Long Short-Term Memory (LSTM) networks for music generation was employed, utilizing the Pretty Midi library. Features were extracted from MIDI files in the dataset and fed these notes into a model composed of three LSTM layers. To prevent overfitting, dropout layers were incorporated. The model was trained on a diverse set of MIDI files, allowing it to capture various musical styles and patterns. The trained model demonstrated high accuracy in music generation, producing coherent and stylistically consistent pieces. Experimental results show that the LSTM + Self-Attention model outperformed baseline RNN, LSTM, and BiLSTM models, achieving the lowest validation loss (0.47), confirming its effectiveness for the complex task of music generation.