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.
DiffRythmix provides three main functionalities:
The API is built using FastAPI and provides both RESTful endpoints and a user-friendly web interface for testing.
Clone the repository:
git clone https://github.com/arslan-sb/RythMix.git
git switch backendv1
cd diffrhythm
Install dependencies:
pip install -r requirements.txt
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.
Generates a music track based on provided lyrics and style parameters.
Endpoint: POST /generate-music
Request Format: multipart/form-data
Parameters:
| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
| lrc | string | Yes | Lyrics in LRC format with timestamps | - |
| text_prompt | string | No | Text description of the desired music style | "" |
| prompt_type | string | Yes | Type of style prompt to use: "audio" or "text" | - |
| audio_prompt | file | No | Audio file to use as style reference (required if prompt_type is "audio") | null |
| seed | integer | No | Random seed for reproducibility | 42 |
| randomize_seed | boolean | No | Whether to use a random seed | false |
| steps | integer | No | Number of diffusion steps (higher = better quality but slower) | 32 |
| cfg_strength | float | No | Classifier-free guidance strength (higher = more adherence to prompt) | 4.0 |
| file_type | string | No | Output audio format: "wav" or "mp3" | "wav" |
| odeint_method | string | No | ODE integration method: "euler", "midpoint", "rk4", or "implicit_adams" | "euler" |
| music_duration | string | No | Duration of generated music | "95s" |
Response: Audio file stream in the requested format.
Generates time-synchronized lyrics based on a theme.
Endpoint: POST /generate-lrc/theme
Request Format: application/json
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| theme | string | Yes | Theme or topic for the lyrics |
| tags_gen | string | Yes | Style descriptors for the lyrics |
| language | string | Yes | "en" for English or "cn" for Chinese |
Response: JSON with generated LRC format lyrics
2 commits
Python
100.0%
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.
DiffRythmix provides three main functionalities:
The API is built using FastAPI and provides both RESTful endpoints and a user-friendly web interface for testing.
Clone the repository:
git clone https://github.com/arslan-sb/RythMix.git
git switch backendv1
cd diffrhythm
Install dependencies:
pip install -r requirements.txt
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.
Generates a music track based on provided lyrics and style parameters.
Endpoint: POST /generate-music
Request Format: multipart/form-data
Parameters:
| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
| lrc | string | Yes | Lyrics in LRC format with timestamps | - |
| text_prompt | string | No | Text description of the desired music style | "" |
| prompt_type | string | Yes | Type of style prompt to use: "audio" or "text" | - |
| audio_prompt | file | No | Audio file to use as style reference (required if prompt_type is "audio") | null |
| seed | integer | No | Random seed for reproducibility | 42 |
| randomize_seed | boolean | No | Whether to use a random seed | false |
| steps | integer | No | Number of diffusion steps (higher = better quality but slower) | 32 |
| cfg_strength | float | No | Classifier-free guidance strength (higher = more adherence to prompt) | 4.0 |
| file_type | string | No | Output audio format: "wav" or "mp3" | "wav" |
| odeint_method | string | No | ODE integration method: "euler", "midpoint", "rk4", or "implicit_adams" | "euler" |
| music_duration | string | No | Duration of generated music | "95s" |
Response: Audio file stream in the requested format.
Generates time-synchronized lyrics based on a theme.
Endpoint: POST /generate-lrc/theme
Request Format: application/json
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| theme | string | Yes | Theme or topic for the lyrics |
| tags_gen | string | Yes | Style descriptors for the lyrics |
| language | string | Yes | "en" for English or "cn" for Chinese |
Response: JSON with generated LRC format lyrics
2 commits
Python
100.0%