Skip to content

🎡 LLM-Orchestrated AI Music Production Platform - Generate professional-quality music using natural language

License

Notifications You must be signed in to change notification settings

csa7mdm/MusicForge

Repository files navigation

MusicForge AI 🎡

LLM-Orchestrated Music Production Platform - Generate professional-quality music using AI with natural language prompts.

CI codecov .NET Python Docker License


🎯 What is MusicForge?

MusicForge is an AI-powered music production platform that transforms natural language descriptions into full audio tracks. Using a hybrid C#/.NET 9 orchestration layer and Python AI workers, it combines the power of:

  • AudioCraft MusicGen - AI music generation
  • Bark - AI vocal synthesis
  • Demucs - Audio stem separation
  • LLM Orchestration - Intelligent task planning via Groq/OpenRouter
"Create an energetic electronic track with a catchy synth melody, 128 BPM"
                                    ↓
                        🎡 Full audio track + stems

✨ Features

Feature Description
🎹 Natural Language Control Describe music in plain English
πŸ€– LLM Orchestration AI plans and coordinates generation
🎚️ Stem Separation Separate vocals, drums, bass, melody
🎀 AI Vocals Generate realistic vocal tracks
πŸ“Š Real-time Progress SignalR streaming updates
🐳 Docker Ready One-command deployment
πŸ”Œ REST API Easy integration with any frontend

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                              MusicForge System                              β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚      C# .NET 9 API Layer        β”‚         Python AI Worker Layer            β”‚
β”‚         (Port 5001)             β”‚           (Port 50051 gRPC)               β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚   Minimal API + SignalR β”‚    β”‚    β”‚   gRPC Server (MusicWorkerSvc)  β”‚    β”‚
β”‚  β”‚   REST + WebSocket      β”‚    β”‚    β”‚                                 β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β”‚              β”‚                  β”‚                    β”‚                      β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚   MediatR CQRS Layer    β”‚    β”‚    β”‚   AI Components                 β”‚    β”‚
β”‚  β”‚   Commands & Handlers   │◄───┼────►   β€’ MusicGen (AudioCraft)       β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚    β”‚   β€’ Bark (Vocals)               β”‚    β”‚
β”‚              β”‚                  β”‚    β”‚   β€’ Demucs (Stems)              β”‚    β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚    β”‚   β€’ Theory Engine (music21)     β”‚    β”‚
β”‚  β”‚   Agent Orchestrator    β”‚    β”‚    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β”‚  β”‚   LLM-Powered Planning  β”‚    β”‚                                          β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚                                          β”‚
β”‚              β”‚                  β”‚                                          β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚                                          β”‚
β”‚  β”‚   SQLite Persistence    β”‚    β”‚                                          β”‚
β”‚  β”‚   EF Core + Repository  β”‚    β”‚                                          β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚                                          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Technology Stack

Layer Technology Purpose
API .NET 9 Minimal API REST endpoints, SignalR
Domain Clean Architecture DDD aggregates, value objects
Application MediatR CQRS command/query handling
Infrastructure gRPC, EF Core Worker communication, persistence
AI Workers Python 3.11 MusicGen, Bark, Demucs, music21
LLM Groq/OpenRouter Intent parsing, task planning
Database SQLite Project persistence
Container Docker Compose Multi-service orchestration

πŸš€ Quick Start

Prerequisites

  • Docker & Docker Compose
  • Groq API Key (free tier available)
  • 8GB+ RAM recommended
  • GPU optional (CPU fallback available)

1. Clone & Configure

git clone https://github.com/csa7mdm/MusicForge.git
cd MusicForge

# Set your API key
echo "GROQ_API_KEY=your_groq_api_key_here" > .env

2. Start Services

docker compose up -d

3. Create Your First Track

# Create a project
curl -X POST http://localhost:5001/api/projects \
  -H "Content-Type: application/json" \
  -d '{
    "name": "My First Track",
    "description": "An energetic electronic track",
    "genre": "Electronic",
    "mood": "Energetic",
    "tempoBpm": 128,
    "key": "C Minor",
    "durationSeconds": 60
  }'

# Generate music
curl -X POST http://localhost:5001/api/projects/{projectId}/generate \
  -H "Content-Type: application/json" \
  -d '{"prompt": "Create an uplifting intro with synth arpeggios"}'

πŸ“š API Reference

Endpoints

Method Endpoint Description
GET /api/health Health check
GET /api/health/worker Worker health
GET /api/projects List all projects
GET /api/projects/{id} Get project details
POST /api/projects Create new project
POST /api/projects/{id}/generate Start generation
POST /api/projects/{id}/iterate Iterate with feedback
DELETE /api/projects/{id} Delete project

Request/Response Examples

Create Project

Request:

{
  "name": "Summer Vibes",
  "description": "A chill summer track",
  "genre": "Electronic",
  "mood": "Chill",
  "tempoBpm": 110,
  "key": "F Major",
  "durationSeconds": 180,
  "hasVocals": true,
  "lyrics": "Feel the summer breeze..."
}

Response:

{
  "projectId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "message": "Project created successfully"
}
Generate Music

Request:

{
  "prompt": "Add a groovy bassline and soft pads"
}

Response:

{
  "success": true,
  "masterFilePath": "/output/summer-vibes-master.wav",
  "stemPaths": [
    "/output/stems/drums.wav",
    "/output/stems/bass.wav",
    "/output/stems/melody.wav"
  ]
}

πŸ§ͺ Testing

# Run all tests
dotnet test

# Run specific test suites
dotnet test tests/MusicForge.Domain.Tests      # 28 tests
dotnet test tests/MusicForge.Application.Tests  # 9 tests
dotnet test tests/MusicForge.Integration.Tests  # 5 tests

Test Coverage:

  • Domain Layer: Value objects, entities, aggregates
  • Application Layer: Command handlers, state machine
  • Integration: API endpoints, worker communication

🐳 Docker Configuration

Services

Service Port Description
api 5001 C# REST API
worker 50051 Python gRPC worker
ollama 11434 Optional local LLM

Environment Variables

Variable Required Description
GROQ_API_KEY Yes Groq API key for LLM
OPENROUTER_API_KEY No Alternative LLM provider
MusicWorker__Address No Worker address (default: http://worker:50051)

πŸ“ Project Structure

MusicForge/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ MusicForge.Domain/          # Domain entities, value objects
β”‚   β”œβ”€β”€ MusicForge.Application/     # CQRS commands, interfaces
β”‚   β”œβ”€β”€ MusicForge.Infrastructure/  # gRPC, EF Core, LLM clients
β”‚   β”œβ”€β”€ MusicForge.Api/             # REST API, SignalR hub
β”‚   └── MusicForge.Cli/             # Command-line interface
β”œβ”€β”€ tests/
β”‚   β”œβ”€β”€ MusicForge.Domain.Tests/
β”‚   β”œβ”€β”€ MusicForge.Application.Tests/
β”‚   └── MusicForge.Integration.Tests/
β”œβ”€β”€ workers/
β”‚   └── python/
β”‚       β”œβ”€β”€ src/
β”‚       β”‚   β”œβ”€β”€ components/         # MusicGen, Bark, Demucs wrappers
β”‚       β”‚   └── server.py           # gRPC server
β”‚       └── Dockerfile
β”œβ”€β”€ protos/
β”‚   └── worker.proto                # gRPC service definition
└── docker-compose.yml

🀝 Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines.

Quick Contribution Guide

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make your changes
  4. Run tests: dotnet test
  5. Commit: git commit -m 'Add amazing feature'
  6. Push: git push origin feature/amazing-feature
  7. Open a Pull Request

πŸ› Bug Reports

Found a bug? Please open an issue with:

  • Title: Clear, concise description
  • Steps to reproduce: Numbered list
  • Expected behavior: What should happen
  • Actual behavior: What actually happens
  • Environment: OS, Docker version, .NET version
  • Logs: Relevant error messages

Use the Bug Report Template.


πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ™ Acknowledgments

  • AudioCraft - Meta's audio generation
  • Bark - Suno's text-to-speech
  • Demucs - Meta's source separation
  • music21 - MIT's music theory toolkit

πŸ“Š Stats

GitHub stars GitHub forks GitHub issues


Built with ❀️ for the music creation community

Quick Start β€’ API Docs β€’ Contributing β€’ Issues

About

🎡 LLM-Orchestrated AI Music Production Platform - Generate professional-quality music using natural language

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •