Abstract
Transformers and variational autoencoders (VAE) have been extensively employed for symbolic (e.g., MIDI) domain music generation. While the former boast an impressive capability in modeling long sequences, the latter allow users to willingly exert control over different parts (e.g., bars) of the music to be generated. In this paper, we are interested in bringing the two together to construct a single model that exhibits both strengths. The task is split into two steps. First, we equip Transformer decoders with the ability to accept segment-level, time-varying conditions during sequence generation. Subsequently, we combine the developed and tested in-attention decoder with a Transformer encoder, and train the resulting MuseMorphose model with the VAE objective to achieve style transfer of long pop piano pieces, in which users can specify musical attributes including rhythmic intensity and polyphony (i.e., harmonic fullness) they desire, down to the bar level. Experiments show that MuseMorphose outperforms recurrent neural network (RNN) based baselines on numerous widely-used metrics for style transfer tasks.
Introduction
In symbolic music generation, researchers have traditionally faced a trade-off between sequence length and structural control. Recurrent Neural Network (RNN) based VAEs, such as MusicVAE, offer excellent control via latent spaces, allowing for smooth interpolation between musical phrases. However, they often struggle to maintain coherence beyond a few bars. Conversely, Transformers excel at modeling long-range dependencies required for full-length compositions but typically operate as "black boxes" that are difficult to steer at a granular level.
MuseMorphose addresses this gap by creating a Transformer-based VAE that accepts time-varying, bar-level controls—such as rhythmic intensity and polyphony—without sacrificing the structural integrity of a full-length song. By treating style transfer as a "filling-in-the-blanks" task guided by a high-level structural blueprint, the model maintains long-range coherence while adhering to precise user constraints.
Methods: In-Attention Conditioning
The core innovation of MuseMorphose is the in-attention conditioning mechanism. The authors explored three distinct methods for injecting segment-level conditions into a Transformer decoder:
- Pre-attention: Conditions are added only at the initial input layer.
- Post-attention: Conditions are blended into the final output layer.
- In-attention: Condition embeddings are summed into the hidden states before every self-attention layer.
The "in-attention" approach proved superior for long sequences because it repeatedly reinforces the user's constraints throughout the model's hierarchical processing. The full architecture consists of a bar-wise Transformer encoder that compresses musical content into latent vectors ($z_k$) and a full-sequence Transformer decoder that reconstructs the music based on these vectors and target attribute embeddings.
Fine-Grained Style Transfer
By partitioning a song into bars and providing independent conditions for each, MuseMorphose allows for highly granular editing. Users can specify the desired rhythmic density and harmonic fullness (polyphony) for every bar of a song. To ensure the model effectively utilizes these inputs, the researchers employed cyclical KL annealing and free bits to prevent posterior collapse in the VAE bottleneck.
Key Results
Experiments conducted on the AILabs.tw-Pop1K7 dataset demonstrated that MuseMorphose significantly outperforms RNN-based baselines like MIDI-VAE:
- Control Precision: The model achieved a Spearman correlation of 0.95 for rhythmic intensity and 0.88 for polyphony, indicating high fidelity to user instructions.
- Musical Integrity: It preserved the original "content" of the music (measured by Chroma similarity) better than previous models, even when attributes were pushed to extremes.
- Fluency: Generations exhibited lower Perplexity (PPL), suggesting the output sounds more like natural, human-composed music.
- Attribute Disentanglement: Changes to rhythm had negligible effects on polyphony, proving that these musical features were successfully separated in the latent space without requiring complex adversarial training.
Conclusion and Future Work
MuseMorphose represents a significant step toward controllable long-form music generation. While currently focused on rhythm and polyphony, future iterations could expand to control tonality, instrumentation, or emotional arousal. Additionally, the authors suggest that incorporating vector-quantized (VQ) latent spaces could improve the model's ability to track and repeat specific melodic motifs over time. This framework also holds potential for other domains, such as controlling sentiment or complexity in long-form natural language generation.
Summary updated