NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

MusicMagus: Zero-Shot Text-to-Music Editing via Diffusion Models

Yixiao Zhang, Yukara Ikemiya, Gus Xia, Naoki Murata, Marco A. Martínez-Ramírez

Abstract

While text-to-music generation has advanced significantly, precise editing of generated audio remains a challenge due to data scarcity and the inherent sensitivity of diffusion models. We present MusicMagus, a framework for zero-shot text-to-music editing. MusicMagus allows users to modify specific attributes—such as timbre or style—using text prompts without further model training. By leveraging a robust latent editing direction derived from large language models and enforcing cross-attention constraints during denoising, the system achieves high-fidelity edits while preserving the original melody and rhythm.

Introduction

In professional music production, the creative process is inherently iterative. Creators often need to refine specific elements of a track, such as swapping a piano for an acoustic guitar or shifting a genre from jazz to classical, without altering the underlying composition. However, existing text-to-music diffusion models are highly sensitive; a minor prompt change typically results in a completely different output. Furthermore, the lack of paired audio datasets (the same song played with different attributes) hinders the development of supervised editing models. MusicMagus addresses these issues by enabling zero-shot editing on pre-trained models like AudioLDM 2.

Methodology

MusicMagus introduces two key technical innovations to bridge the gap between text-based editing and structural consistency.

Finding the Editing Direction (Δ)

Simply swapping words in a prompt often introduces semantic noise. To find a more stable representation of an attribute change, MusicMagus calculates a difference vector (Δ) in the latent space. The system uses InstructGPT to generate a diverse set of captions for both the source (e.g., "piano") and target (e.g., "guitar") attributes. These captions are encoded via FLAN-T5, and the mean difference between the two sets defines the editing direction. This centroid-based approach captures the "essence" of the instrument or style, making it more robust than single-word embeddings.

The process of calculating the editing direction Δ using LLM-generated captions and encoder embeddings.

Cross-Attention Constraints

To prevent the music's structure from collapsing during the edit, MusicMagus employs cross-attention maps as "structural anchors." During the initial generation, the model records these maps, which indicate how text tokens influence specific temporal and spatial features of the audio. During editing, an L2 loss is calculated between the new attention maps and the original "blueprints." A single-step optimization at each denoising timestep nudges the noise prediction to ensure the "where" and "when" of the notes remain consistent with the original piece.

The diffusion framework incorporating cross-attention constraints to maintain structural consistency.

Evaluation and Results

The framework was evaluated on Timbre Transfer and Style Transfer datasets using AudioLDM 2 as the backbone.

  • Objective Metrics: MusicMagus achieved a CLAP similarity score of approximately 0.33, indicating strong alignment with the target text. In style transfer tasks, it maintained a Chromagram similarity of 0.77, significantly outperforming supervised models like MusicGen (0.66) in preserving pitch and rhythm.
  • Subjective Evaluation: Human listeners rated MusicMagus higher than baselines in both relevance to the text prompt and structural consistency with the original audio.
  • Real-World Application: Using DDIM inversion, the authors demonstrated that MusicMagus can also edit real-world audio recordings by first inverting them into the latent noise space.

Conclusion

MusicMagus provides a powerful solution for zero-shot music editing by decoupling semantic content from structural form. While currently limited by the sampling rate of its backbone model and the complexity of multi-instrument tracks, it represents a significant step toward flexible, iterative AI-assisted music production. Future work will focus on scaling the method to higher-fidelity models and longer compositions.

Summary updated

BibTeX
@inproceedings{zhang2024musicmagus,
  author = {Yixiao Zhang and Yukara Ikemiya and Gus Xia and Naoki Murata and Marco A. Martínez-Ramírez},
  title = {{MusicMagus: Zero-Shot Text-to-Music Editing via Diffusion Models}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2024},
  url = {https://openreview.net/forum?id=YO9s7haPzV},
}
Figure