MusicAgent: An AI Agent for Music Understanding and Generation with Large Language Models

Dingyao Yu, Kaitao Song, Peiling Lu, Tianyu He, Xu Tan, Wei Ye, Shikun Zhang, Jiang Bian · DOI

Abstract

The field of AI-driven music processing is currently characterized by a fragmented ecosystem of specialized models and incompatible data formats. While significant progress has been made in individual domains such as timbre synthesis, music classification, and lyric generation, integrating these tools into a cohesive creative workflow remains a significant technical challenge. This paper introduces MusicAgent, an autonomous system powered by Large Language Models (LLMs) that acts as a central orchestrator for music AI. By leveraging the reasoning capabilities of LLMs to decompose complex user requests and manage a diverse toolset, MusicAgent bridges the gap between isolated research models and practical creative applications.

Introduction

Despite the proliferation of high-performance models for music processing, the "walled garden" nature of the field presents a high barrier to entry for musicians and developers. Chaining multiple tools—for instance, generating a melody from text, synthesizing a singing voice, and mixing the final audio—requires deep technical expertise in data engineering and model deployment. MusicAgent addresses this fragmentation by providing an autonomous workflow that handles task planning, tool selection, and execution, allowing users to focus on creative intent rather than technical implementation.

System Architecture

The core of MusicAgent is its Autonomous Workflow, which positions an LLM (such as ChatGPT) as a generalist controller. The system is structured into four primary components designed to handle the lifecycle of a musical task:

  1. Task Planner: Upon receiving a user request, the LLM utilizes in-context learning to break down the prompt into a structured Task Dependency Graph. For example, a request to "create a song in the style of Chinese poetry" is decomposed into sequential sub-tasks: lyric generation, melody generation, singing voice synthesis, and final audio mixing.
  2. Tool Selector: MusicAgent maintains a curated library of specialized AI tools. The LLM analyzes tool metadata—including descriptions, capabilities, and user ratings—to select the most appropriate model for each specific sub-task in the graph.
  3. Task Executor: This component manages the practical execution of the selected models. To optimize hardware usage, MusicAgent employs a strategy of storing model parameters on the CPU and loading them into the GPU only during active inference, enabling complex pipelines to run on hardware with limited VRAM.
  4. Response Generator: After the tools complete their tasks, the LLM aggregates the intermediate outputs (e.g., MIDI files, audio stems, or text analysis) and compiles them into a coherent final response for the user.

A critical innovation within this architecture is the enforcement of standardized input-output formats. By wrapping diverse tools in a unified interface, MusicAgent ensures that the output of a symbolic music generator can be seamlessly processed by an audio synthesizer without manual data conversion.

The MusicAgent Toolset

MusicAgent does not rely on a single monolithic model; instead, it integrates a comprehensive suite of specialized tools from various sources, including Hugging Face, GitHub, and external Web APIs. Key integrated tools include:

  • Generation: MuseCoco (text-to-symbolic), HiFiSinger (singing voice synthesis), and AudioLDM (text-to-audio).
  • Understanding: Wav2vec2 (classification), Demucs (source separation), and Whisper (lyric recognition).
  • Auxiliary Services: Integration with the Spotify API for track searching and the Google API for broader web-based information retrieval.

Key Insights and Results

The development of MusicAgent highlights the potential of LLMs as Generalist Orchestrators. While LLMs may not be the optimal choice for raw audio synthesis, their superior reasoning and planning capabilities make them ideal for managing complex workflows. By automating the "plumbing" of AI pipelines, MusicAgent democratizes access to sophisticated music technology.

Experimental scenarios have demonstrated the system's versatility:

  • Creative Generation: Successfully producing complete songs by chaining lyrics, melody, and synthesis models.
  • Music Analysis: Automating the process of searching for artists, separating vocal tracks from instrumentals using Demucs, and performing style analysis via Wav2vec2.
  • Timbre Transfer: Combining source separation with Differentiable Digital Signal Processing (DDSP) to convert vocal tracks into instrumental performances, such as a violin.

Limitations and Future Work

While MusicAgent represents a significant step toward unified music AI, several challenges remain. The system's performance is inherently limited by the quality of the underlying open-source tools it orchestrates. Furthermore, as workflows grow in complexity, the interaction history can approach the LLM's context window limits, necessitating more advanced truncation and memory management strategies. Future work will focus on expanding the toolset and improving the nuanced compatibility between musical tasks to provide even greater creative control.

Conclusion

MusicAgent provides a scalable, modular framework for music understanding and generation. By standardizing the interface between fragmented AI tools and leveraging the planning power of LLMs, it offers a powerful new paradigm for both technical researchers and creative practitioners in the field of computer music.

Summary updated

BibTeX
@inproceedings{yu2023musicagent,
  author = {Dingyao Yu and Kaitao Song and Peiling Lu and Tianyu He and Xu Tan and Wei Ye and Shikun Zhang and Jiang Bian},
  title = {{MusicAgent: An AI Agent for Music Understanding and Generation with Large Language Models}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2023},
  doi = {10.18653/v1/2023.emnlp-demo.21},
}
Figure