Skip to content

TheManInTheBox/DirectAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

23 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

DirectAI Music Platform

AI-Powered Music Analysis & Generation Platform - Production-ready platform for music studios, producers, and enterprises.

πŸš€ Status: MVP Complete βœ… | Ready for Azure Deployment

A comprehensive music analysis and generation platform leveraging state-of-the-art AI models (Demucs, MusicGen) to analyze audio structure, separate stems, extract musical features, and generate new music programmatically.

πŸ“˜ Deployment Plan | πŸš€ Quick Start Guide | πŸ“‹ MVP Status

✨ Core Features

Audio Analysis

  • Stem Separation: Demucs v4 (htdemucs) - 4-stem isolation (vocals, drums, bass, other)
  • Musical Analysis: BPM detection, key/scale detection, chord extraction, beat tracking
  • Metadata Extraction: ID3 tags, album artwork, duration, format
  • Real-Time Updates: SignalR WebSocket notifications for job progress

AI Music Generation (MusicGen)

  • Model: Meta's MusicGen-small (300MB, 8-second load time)
  • Text-to-Music: Generate music from text prompts
  • Controllable Parameters: BPM, key, style, duration
  • Training Pipeline: Fine-tune on custom stems for personalized generation
  • Output: 32kHz generation, resampled to 44.1kHz WAV

Production Features

  • Async Job Processing: Service Bus queues with auto-scaling workers
  • Blob Storage: Azure Storage for audio files, stems, and training data
  • Database: PostgreSQL 16 with Entity Framework Core
  • API: .NET 8.0 REST API with Swagger documentation
  • Cross-Platform UI: .NET MAUI desktop app (Windows/Mac)

πŸ—οΈ Architecture

Technology Stack

  • .NET 8.0: Web API, Entity Framework, SignalR, MAUI
  • Python Workers: FastAPI microservices (analysis + generation)
  • AI Models: Demucs v4, MusicGen, librosa, essentia, madmom
  • Azure: Container Apps, PostgreSQL, Blob Storage, Service Bus
  • Containerization: Docker Compose (local), Azure Container Apps (production)

Local Development

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   .NET API  │────▢│  PostgreSQL  β”‚     β”‚  Blob Storage   β”‚
β”‚  (Port 5000)β”‚     β”‚  (Port 5432) β”‚     β”‚   (Azurite)     β”‚
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚                                           β”‚
       β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
       β”‚           β”‚                               β”‚
       β–Ό           β–Ό                               β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Analysis   β”‚ β”‚ Generation  β”‚          β”‚   Service   β”‚
β”‚   Worker    β”‚ β”‚   Worker    β”‚          β”‚     Bus     β”‚
β”‚ (Port 8001) β”‚ β”‚ (Port 8080) β”‚          β”‚   Queues    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Azure Production (Per Customer)

Customer Subscription
β”œβ”€β”€ Container Apps Environment
β”‚   β”œβ”€β”€ API (1-10 replicas, always-on)
β”‚   β”œβ”€β”€ Analysis Worker (0-5 replicas, auto-scale)
β”‚   └── Generation Worker (0-3 replicas, auto-scale)
β”œβ”€β”€ PostgreSQL Flexible Server (B2s)
β”œβ”€β”€ Blob Storage Account (LRS/GRS)
β”œβ”€β”€ Service Bus Namespace (Standard)
β”œβ”€β”€ Container Registry
β”œβ”€β”€ Application Insights + Log Analytics
β”œβ”€β”€ Key Vault (secrets management)
└── Managed Identity (RBAC security)

πŸš€ Quick Start

Prerequisites

  • Docker Desktop
  • .NET 8.0 SDK
  • Git

Run Locally

# Clone repository
git clone https://github.com/TheManInTheBox/DirectAI.git
cd DirectAI

# Start all services
docker compose up -d

# Check service health
docker compose ps
docker compose logs api --tail=20

# Access services
# API: http://localhost:5000
# Swagger: http://localhost:5000/swagger
# PgAdmin: http://localhost:5050

Deploy to Customer Azure Subscription

# Set customer context
azd env new customer-acme-music
azd env set CUSTOMER_NAME "acme-music"
azd env set AZURE_SUBSCRIPTION_ID "customer-sub-id"

# Deploy infrastructure + apps
azd up --subscription "customer-sub-id"

# Verify deployment
azd show
azd monitor --logs

πŸ“˜ Full Deployment Guide

πŸ“Š Current Status (MVP Complete)

βœ… Backend Infrastructure

  • .NET 8.0 API with async job processing
  • PostgreSQL database with EF Core migrations
  • Blob storage integration (Azurite local, Azure production)
  • SignalR real-time job updates

βœ… Analysis Worker

  • Demucs v4 stem separation (~30s per track)
  • BPM detection, key/scale analysis
  • Chord extraction with timeout handling
  • Beat tracking and metadata extraction
  • MP3 album artwork support

βœ… Generation Worker

  • MusicGen-small integration (8s startup)
  • Text-to-music generation
  • 32kHz β†’ 44.1kHz resampling
  • Compatible with analysis worker output

βœ… Deployment Ready

  • Docker Compose for local development
  • Azure Container Apps deployment plan
  • Bicep infrastructure-as-code templates
  • Per-customer isolation architecture

πŸ”„ In Progress

  • Training pipeline for MusicGen fine-tuning
  • Stem selection UI for dataset creation
  • Parameter-controlled generation (key, BPM, bars)
  • Customer onboarding automation

πŸ“‹ Detailed MVP Status | πŸ§ͺ Testing Guide

πŸ“š Documentation

πŸŽ“ Key Capabilities

For Music Producers

  • Upload tracks β†’ Get separated stems in 30 seconds
  • Analyze chord progressions and key signatures
  • Extract BPM and beat grids for remixing
  • Generate new stems matching your musical style

For Developers

  • RESTful API with OpenAPI/Swagger
  • Real-time WebSocket updates via SignalR
  • Async job processing with retry logic
  • Comprehensive logging and telemetry

For Enterprises

  • Isolated Azure deployment per customer
  • Managed identity security (no credentials)
  • Auto-scaling workers (cost-efficient)
  • Centralized monitoring via Azure Lighthouse

️ Development

Project Structure

DirectAI/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ MusicPlatform.Api/          # .NET 8.0 REST API
β”‚   β”œβ”€β”€ MusicPlatform.Domain/        # Core business logic
β”‚   └── MusicPlatform.Infrastructure/ # Data access, external services
β”œβ”€β”€ workers/
β”‚   β”œβ”€β”€ analysis/                    # Python FastAPI (Demucs, analysis)
β”‚   └── generation/                  # Python FastAPI (MusicGen)
β”œβ”€β”€ infrastructure/
β”‚   β”œβ”€β”€ main.bicep                   # Azure IaC templates
β”‚   └── kubernetes/                  # K8s manifests (optional)
β”œβ”€β”€ database/
β”‚   └── schema.sql                   # PostgreSQL schema
β”œβ”€β”€ .azure/
β”‚   └── plan.copilotmd              # Deployment plan
└── docker-compose.yml              # Local development

Running Tests

# .NET API tests
dotnet test tests/DirectML.AI.Tests/

# Test analysis worker locally
docker compose up -d analysis-worker
curl http://localhost:8001/health

# Test generation worker locally
docker compose up -d generation-worker
curl http://localhost:8080/health

Building for Production

# Build all Docker images
docker compose build

# Push to Azure Container Registry
az acr login --name <registry-name>
docker tag directai-api <registry>.azurecr.io/directai-api:latest
docker push <registry>.azurecr.io/directai-api:latest

🀝 Contributing

This is a commercial product under active development. For partnership opportunities, licensing, or technical inquiries:

  • GitHub Issues: Bug reports and feature requests
  • Discussions: Architecture and design conversations
  • Pull Requests: Welcome for bug fixes (requires CLA)

πŸ“„ License

Proprietary - All rights reserved. Commercial licensing available.

Contact: GitHub Profile


Built with: .NET 8.0 β€’ Python 3.10 β€’ Azure β€’ Docker β€’ PostgreSQL β€’ MusicGen β€’ Demucs

Powered by: Meta AI (MusicGen) β€’ FAIR (Demucs) β€’ MTG (Essentia) β€’ madmom

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published