arslan-sb/RythMix

0

stars

2

commits

Python

primary language

May 4, 2025

updated

README

DiffRythmix API Documentation

DiffRythmix Logo Version License

DiffRythmix is a powerful music generation API that utilizes diffusion models to create high-quality music based on lyrics, audio style references, or text prompts. This API allows developers to generate custom songs with fine-grained control over various parameters.

Table of Contents

Overview

DiffRythmix provides three main functionalities:

  1. Music Generation: Create original music based on lyrics, style prompts, and other parameters
  2. LRC Generation from Theme: Generate time-synchronized lyrics based on a theme
  3. LRC Generation from Lyrics: Convert plain lyrics to time-synchronized LRC format

The API is built using FastAPI and provides both RESTful endpoints and a user-friendly web interface for testing.

Installation & Setup

Prerequisites

  • Python 3.10+
  • CUDA-compatible GPU (for optimal performance)
  • Required packages (see requirements.txt)

Installation

  1. Clone the repository:

    git clone https://github.com/arslan-sb/RythMix.git
    git switch backendv1
    cd diffrhythm
    
  2. Install dependencies:

    pip install -r requirements.txt
    
  3. Start the API server:

    python main.py
    

The server will start, loading models on startup. This may take a few moments as it prepares the DiffRythmix model, tokenizer, MuQMuLan encoder, and VAE models.

API Endpoints

Generate Music

Generates a music track based on provided lyrics and style parameters.

Endpoint: POST /generate-music

Request Format: multipart/form-data

Parameters:

ParameterTypeRequiredDescriptionDefault
lrcstringYesLyrics in LRC format with timestamps-
text_promptstringNoText description of the desired music style""
prompt_typestringYesType of style prompt to use: "audio" or "text"-
audio_promptfileNoAudio file to use as style reference (required if prompt_type is "audio")null
seedintegerNoRandom seed for reproducibility42
randomize_seedbooleanNoWhether to use a random seedfalse
stepsintegerNoNumber of diffusion steps (higher = better quality but slower)32
cfg_strengthfloatNoClassifier-free guidance strength (higher = more adherence to prompt)4.0
file_typestringNoOutput audio format: "wav" or "mp3""wav"
odeint_methodstringNoODE integration method: "euler", "midpoint", "rk4", or "implicit_adams""euler"
music_durationstringNoDuration of generated music"95s"

Response: Audio file stream in the requested format.

Generate LRC from Theme

Generates time-synchronized lyrics based on a theme.

Endpoint: POST /generate-lrc/theme

Request Format: application/json

Parameters:

ParameterTypeRequiredDescription
themestringYesTheme or topic for the lyrics
tags_genstringYesStyle descriptors for the lyrics
languagestringYes"en" for English or "cn" for Chinese

Response: JSON with generated LRC format lyrics

Contributors

arslan-sb

2 commits

arslan-sb/RythMix

0

stars

2

commits

Python

primary language

May 4, 2025

updated

README

DiffRythmix API Documentation

DiffRythmix Logo Version License

DiffRythmix is a powerful music generation API that utilizes diffusion models to create high-quality music based on lyrics, audio style references, or text prompts. This API allows developers to generate custom songs with fine-grained control over various parameters.

Table of Contents

Overview

DiffRythmix provides three main functionalities:

  1. Music Generation: Create original music based on lyrics, style prompts, and other parameters
  2. LRC Generation from Theme: Generate time-synchronized lyrics based on a theme
  3. LRC Generation from Lyrics: Convert plain lyrics to time-synchronized LRC format

The API is built using FastAPI and provides both RESTful endpoints and a user-friendly web interface for testing.

Installation & Setup

Prerequisites

  • Python 3.10+
  • CUDA-compatible GPU (for optimal performance)
  • Required packages (see requirements.txt)

Installation

  1. Clone the repository:

    git clone https://github.com/arslan-sb/RythMix.git
    git switch backendv1
    cd diffrhythm
    
  2. Install dependencies:

    pip install -r requirements.txt
    
  3. Start the API server:

    python main.py
    

The server will start, loading models on startup. This may take a few moments as it prepares the DiffRythmix model, tokenizer, MuQMuLan encoder, and VAE models.

API Endpoints

Generate Music

Generates a music track based on provided lyrics and style parameters.

Endpoint: POST /generate-music

Request Format: multipart/form-data

Parameters:

ParameterTypeRequiredDescriptionDefault
lrcstringYesLyrics in LRC format with timestamps-
text_promptstringNoText description of the desired music style""
prompt_typestringYesType of style prompt to use: "audio" or "text"-
audio_promptfileNoAudio file to use as style reference (required if prompt_type is "audio")null
seedintegerNoRandom seed for reproducibility42
randomize_seedbooleanNoWhether to use a random seedfalse
stepsintegerNoNumber of diffusion steps (higher = better quality but slower)32
cfg_strengthfloatNoClassifier-free guidance strength (higher = more adherence to prompt)4.0
file_typestringNoOutput audio format: "wav" or "mp3""wav"
odeint_methodstringNoODE integration method: "euler", "midpoint", "rk4", or "implicit_adams""euler"
music_durationstringNoDuration of generated music"95s"

Response: Audio file stream in the requested format.

Generate LRC from Theme

Generates time-synchronized lyrics based on a theme.

Endpoint: POST /generate-lrc/theme

Request Format: application/json

Parameters:

ParameterTypeRequiredDescription
themestringYesTheme or topic for the lyrics
tags_genstringYesStyle descriptors for the lyrics
languagestringYes"en" for English or "cn" for Chinese

Response: JSON with generated LRC format lyrics

Contributors

arslan-sb

2 commits

Languages

Python

100.0%