Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Facebookresearch Audiocraft MusicGenStyleApp

From Leeroopedia
Knowledge Sources
Domains Demo, Music_Generation
Last Updated 2026-02-14 01:00 GMT

Overview

Concrete tool for running an interactive Gradio web demo of the MusicGen-Style model for text-and-style-conditioned music generation.

Description

MusicGenStyleApp is a Gradio web application that provides an interactive interface for the MusicGen-Style model. It supports both text-only and text-plus-style-audio conditioned generation, allowing users to provide an audio clip as a style reference. The demo includes configurable generation parameters such as duration, temperature, top-k/top-p sampling, and classifier-free guidance coefficient.

Usage

Run this application to demonstrate MusicGen-Style's text-and-audio-conditioned music generation through a web browser interface.

Code Reference

Source Location

Signature

def predict_full(model, text, melody, duration, topk, topp, temperature, cfg_coef):
    """Generate music from text and optional style audio reference."""

Import

# Run as a standalone script
python demos/musicgen_style_app.py

I/O Contract

Inputs

Name Type Required Description
text str Yes Text description for music generation
melody tuple No Style audio reference (sample_rate, waveform)
duration float No Generation duration in seconds
model str Yes Model identifier to use

Outputs

Name Type Description
audio tuple(int, numpy.ndarray) Generated audio as (sample_rate, waveform)

Usage Examples

# Launch the demo
python demos/musicgen_style_app.py --share

# Or programmatically:
from audiocraft.models import MusicGen
model = MusicGen.get_pretrained('facebook/musicgen-style')
model.set_generation_params(duration=10)
wav = model.generate(['upbeat electronic dance music'])

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment