Accordion music generation and variation algorithm integrating knowledge graph and transformer
Accordion music generation remains challenging due to the complexity of its structural organization and the lack of explicit performance-related information. This study proposes an enhanced generation framework that integrates a Knowledge Graph (KG) with a Generative Pre-trained Transformer (GPT). A specialized accordion KG is constructed to represent fundamental music theory principles and instrument-specific performance characteristics, including the unique left-hand bass accompaniment patterns of the accordion. Based on this knowledge representation, several improvements are introduced into the Transformer architecture. A Graph-Guided Self-Attention (GGSA) mechanism is developed to dynamically regulate attention distributions using knowledge-based constraints. In addition, a Variation Feature Injection Module (VFIM) is incorporated to generate recursive variations while preserving essential thematic characteristics. The proposed framework further models accordion-specific performance factors, including bellows pressure variations and fingering patterns. The Nottingham Database is adopted as the experimental corpus. The original symbolic music data are enhanced through instrument-specific representation processing, in which pitch, duration, and chord sequences are extracted to construct a performance-aware musical representation. Experimental results demonstrate that the proposed model achieves a perplexity (PPL) of 3.42 and a harmonic validity rate of 94.8%. The generated melodies exhibit improved structural coherence, more natural coordination between left-hand accompaniment and right-hand melody, and stronger thematic consistency during variation generation. These findings indicate that integrating knowledge constraints with sequence modeling can effectively improve the structural quality and performance logic representation of accordion music generation. The proposed approach provides a potential technical foundation for automated composition, intelligent music education assistance, and the digital creation of instrument-specific music.
Authors
- 董梁飞
- Ming Zhao
Institutions
- Yanshan University (CN)
Publication Details
- Journal
- Discover Artificial Intelligence
- Published
- 2026-10-15
- DOI
- https://doi.org/10.1007/s44163-026-02151-w
- Primary Topic
- Music Technology and Sound Studies
- Type
- article
- Field-Weighted Citation Impact
- 0.00