Skip to content

Latest commit

Β 

History

277 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

R∞N β€” RAIN v6

AI Audio Transformation, Mastering & Distribution Infrastructure

ThatGuy Productions Β· ARCOVEL Technologies International

"Rain doesn't live in the cloud." β€” The render engine runs on your machine. Audio never leaves your device during processing.

Python FastAPI React PostgreSQL License EU AI Act DDEX

RAIN is a full-stack, local-first AI mastering and distribution engine that brings studio-grade audio processing to independent artists and labels. It combines a deterministic C++/WASM DSP render engine with cloud-based AI inference, cryptographic provenance certificates, and direct streaming platform distribution β€” all in one product.

Beyond LANDR. Beyond iZotope. Beyond anything that came before.


Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Browser  (React 19 + Vite 7 + TypeScript 5.5 + Tailwind 4)        β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚ Web Audio API    β”‚  β”‚ ONNX Runtime Webβ”‚  β”‚ RainDSP  C++/WASM  β”‚ β”‚
β”‚  β”‚ 32-bit preview   β”‚  β”‚ WebGPU β†’ WASM   β”‚  β”‚ 64-bit Β· deterministicβ”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚ REST / WebSocket  (FastAPI)
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Backend  (Python 3.12 Β· FastAPI Β· Celery Β· Structlog)              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚ Master Engineβ”‚ β”‚ QC Engine  β”‚ β”‚ RAIN-CERT   β”‚ β”‚ DDEX ERN 4.3 β”‚  β”‚
β”‚  β”‚ 16-stage DSP β”‚ β”‚ 18 checks  β”‚ β”‚ Ed25519     β”‚ β”‚ AI disclosure β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚ Feature Ext. β”‚ β”‚ Heuristic  β”‚ β”‚ LabelGrid   β”‚ β”‚ Stripe       β”‚  β”‚
β”‚  β”‚ 43-dim vectorβ”‚ β”‚ 46 params  β”‚ β”‚ Distributionβ”‚ β”‚ Billing      β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
          β”‚                      β”‚                     β”‚
   PostgreSQL 18          Valkey 9.0            MinIO / S3
   (RLS enabled)          (BSD-3 Redis fork)    (paid tiers only)

Dual-Path Design

Path Engine Precision Purpose
Preview Web Audio API 32-bit float Real-time monitoring, < 50 ms latency
Render RainDSP WASM 64-bit double Deterministic, authoritative output

Determinism guarantee: Same input + same params + same WASM binary = bit-identical output, every time.


16-Stage Mastering Pipeline

Stage Name Description
01 Format Normalization Resample to 48 kHz, 64-bit float stereo
02 Provenance Record Ed25519 input hash, C2PA manifest init, AudioSeal seed
03 Feature Extraction 43-dim vector β€” Loudness (5), Dynamics (6), Spectral (16), Stereo (7), Transient (5), Tonal (4)
04 AI Inference RainNet v2 β†’ 46 ProcessingParams via sigmoid Γ— 10 macro mapping
05 Reference Matching Genre-aware spectral target matching
06 Spectral Repair HPF, sibilance reduction, rumble removal, spectral smoothing
07 Source Separation BS-RoFormer 4-pass cascade β†’ 12 stems
08 Per-Stem Repair Individual stem QC and spectral correction
09 Per-Stem Processing SAIL v2 stem-aware limiting, vocal protection, gain faders
10 Master Bus EQ β†’ Multiband compression β†’ Stereo widening β†’ Groove β†’ Life injection
11 Loudness Targeting 27 platform targets β€” Spotify βˆ’14, Apple βˆ’16, Atmos βˆ’18, CD βˆ’9, vinyl…
12 Spatial Rendering Dolby Atmos HRTF binaural, M/S stereo enhancement
13 QC Validation 18 automated checks with auto-remediation
14 Forensic Watermark 16-bit AudioSeal, Chromaprint fingerprint
15 Output Packaging 24-bit WAV @ 48 kHz + 320 kbps MP3 with TPDF dither; RAIN-CERT signed
16 Distribution DDEX ERN 4.3.2, LabelGrid API delivery, ISRC/UPC generation

7 Macro Controls

Emotionally-resonant, non-technical controls mapping to bounded subsets of the 46 DSP parameters. RainNet v2 outputs all 7 macros at indices 39–45 via sigmoid Γ— 10 β†’ [0.0, 10.0].

Macro DSP Mapping
BRIGHTEN High-shelf at 8 kHz + air peak at 16 kHz Β· 0 β†’ +4 dB
GLUE Multiband compression ratios/thresholds Β· 0 = transparent, 10 = bus glue 4:1
WIDTH M/S side-channel gain Β· bass mono below 200 Hz enforced regardless
PUNCH Mid-band transient shaping via attack/release Β· snare, kick, vocal presence
WARMTH Low-shelf at 200 Hz + analog saturation Β· 0 = clean, 10 = +3 dB + tube sat
SPACE Stereo decorrelation and M/S balance for depth Β· interacts with WIDTH
REPAIR Spectral repair intensity, HPF, de-essing, noise floor

12-Stem Source Separation

Protect your authentic human vocal recordings. Upload AI-reworked structures, separate the stems, and cleanly replace AI vocals with your original takes.

Pass Model Output
1 BS-RoFormer SW vocals Β· drums Β· bass Β· guitar Β· piano Β· other
2 MVSep Karaoke MelBand RoFormer lead vocals + backing vocals
3 Spectral band-split (LarsNet pending) kick Β· snare Β· hats Β· percussion
4 anvuew dereverb MelBand RoFormer room/ambience + dry FX

Per-stem gain faders, solo/mute, 12-stem waveform display. SAIL v2 (Stem-Aware Intelligent Limiting) with dedicated vocal protection.


Provenance & Compliance

Standard Status Notes
EU AI Act Article 50 βœ… Active C2PA v2.2 + DDEX AI disclosure Β· deadline 2026-08-02
DDEX ERN 4.3.2 βœ… Active Full AI involvement fields per September 2025 standard
C2PA v2.2 βœ… Active CBOR-encoded manifests, Ed25519 signed
RAIN-CERT βœ… Active Ed25519 provenance certificates on every render
AudioSeal βœ… Active 16-bit invisible watermarks (Meta, MIT licence)
Chromaprint βœ… Active Audio fingerprints in PostgreSQL
ISO 3901 (ISRC) βœ… Active Generated per standard with registrant code
AES17 True Peak βœ… Active 4Γ— oversampling limiter Β· βˆ’1.0 dBTP ceiling

AI Co-Master Engineer

Claude Sonnet integration via claude_service.py (model configurable; default claude-sonnet-4-20250514):

  • Natural language Intent Engine maps requests to bounded ProcessingParams deltas
  • 7 macro suggestions with confidence scores (JSON-validated, clamped 0–10)
  • Before/after mastering reports in plain language
  • Tension-pair conflict detection (e.g. BRIGHTEN + WARMTH)
  • Voice control via Web Speech API for hands-free mastering

Artist Identity Engine (AIE): 64-dimensional voice vector. Adaptive EMA (Ξ± = 0.90 stable, 0.60 cold-start). Personalizes after 5 sessions. Exportable as HMAC-SHA256 signed JSON.


Tech Stack

Layer Technology
Frontend React 19 Β· Vite 7 Β· TypeScript 5.5 Β· Tailwind 4 Β· Framer Motion 11
State Zustand 5 Β· TanStack Query 5
Render Engine RainDSP (C++20 / WASM via Emscripten) Β· 64-bit Β· deterministic
ML Inference ONNX Runtime Web 1.24 (WebGPU β†’ WASM fallback) Β· RainNet v2
Backend API FastAPI 0.109+ Β· Python 3.12 Β· Celery Β· Structlog Β· SlowAPI
Database PostgreSQL 18 with Row-Level Security on all tables
Cache / Queue Valkey 9.0 (BSD-3-Clause Redis fork)
Object Storage S3-compatible (MinIO in dev) Β· free tier = WASM-only, no S3
Provenance Ed25519 Β· C2PA v2.2 Β· AudioSeal Β· Chromaprint Β· CBOR (RFC 8949)
Separation BS-RoFormer SW Β· MelBand RoFormer Β· auto-download via pip
Distribution DDEX ERN 4.3 Β· LabelGrid API Β· ISRC / UPC-EAN-13
Desktop / Plugin Tauri 2.0 Β· JUCE 8 (VST3 / AU / AAX)

Getting Started

Prerequisites

  • Docker Desktop 4.x+
  • Node.js 20+
  • Python 3.12+

Docker (recommended)

# Clone
git clone https://github.com/ThatGuy-Productions/RAIN-V6-AI-AUDIO-TRANSFORMATION-MASTERING-AND-DISTRIBUTION-INFRUSTRUCTURE.git
cd RAIN-V6-AI-AUDIO-TRANSFORMATION-MASTERING-AND-DISTRIBUTION-INFRUSTRUCTURE

# Configure environment
cp .env.example .env
# Edit .env β€” set ANTHROPIC_API_KEY, STRIPE_SECRET_KEY, LABELGRID_API_KEY, etc.

# Start full stack (PostgreSQL 18 + Valkey 9.0 + backend + frontend)
docker compose up --build -d

# Verify
curl http://localhost:8000/health

Local development

# Backend
cd backend
pip install -r requirements.txt
uvicorn app.main:app --reload --port 8000

# Frontend (separate terminal)
cd frontend
npm install
npm run dev

GPU worker (stem separation)

# Requires CUDA 12+ and SEPARATION_ENABLED=true in .env
docker compose -f docker-compose.gpu.yml up -d worker

API Routes

The backend exposes 18 mounted API routers under /api/v1/.

Router Prefix Auth Description
auth.py /auth Public / JWT Registration, login, JWT refresh, password reset
upload.py /upload JWT Audio file upload, S3 pre-signed URLs, file validation
master.py /master JWT Session creation, mastering pipeline trigger, status polling, parameter overrides
separate.py /separate JWT Β· Creator+ BS-RoFormer 12-stem separation jobs, stem download
download.py /download JWT Signed download URLs for rendered masters and stems
distribution.py /distribution JWT Β· Producer+ DDEX ERN 4.3.2 package generation, LabelGrid delivery, ISRC/UPC issuance
billing.py /billing JWT Stripe checkout sessions, subscription management, webhook receiver
aie.py /aie JWT Β· Artist+ Artist Identity Engine β€” vector query, export, reset
sessions.py /sessions JWT Session history, status, output metadata, RAIN Score retrieval
qc.py /qc JWT Manual QC re-run, 18-point check report
provenance_routes.py /provenance JWT RAIN-CERT retrieval, C2PA manifest query, Ed25519 verification
waitlist.py /waitlist Public Beta waitlist registration
assist.py /assist JWT Claude AI assistant β€” intent parsing, macro suggestions, mastering advice, voice command processing
lora.py /lora JWT Β· Enterprise Custom LoRA adapter training jobs, model version management, inference switching
suno_import.py /suno JWT Suno AI track import β€” fetch by song ID or URL, normalize, queue for mastering
whitelabel.py /whitelabel JWT Β· Enterprise White-label API key provisioning, partner branding config, usage metering
workspaces.py /workspaces JWT Β· Studio+ Multi-artist workspace management, collaborator roles, shared session access
score.py /score Public (10 req/hr/IP) Public RAIN Score endpoint β€” no auth required, returns 0-100 composite quality metric

Auth tiers: Public = no token required Β· JWT = any authenticated user Β· tier suffixes (Creator+, Artist+, etc.) = minimum subscription required.


Pricing

Tier Price Renders / mo Key Features
Casual Free Preview only Real-time WASM mastering preview, RAIN Score, no file export
Creator $9 50 downloads Full-res export, WAV / FLAC / MP3, Simple Mode
Independent Artist $29 10 renders Stem separation, Claude AI (10/mo), Artist Identity Engine
Producer $59 25 renders DAW plugin, Distribution Intelligence, RAIN-CERT
Studio $149 75 renders Dolby Atmos, DDEX / DDP, vinyl mastering, collaboration
Label / Distributor $349 300 renders Multi-artist roster, batch processing, LabelGrid direct
Enterprise Custom Unlimited Custom RainNet LoRA, white-label API, dedicated support

Annual billing: ~20% discount. Contact philippusbolke@gmail.com for enterprise licensing.


Architecture Rules

These constraints are immutable. See CLAUDE.md for the full specification.

  1. Local-First Processing β€” RainDSP WASM is the sole render engine. Audio never reaches S3 on the free path. Free renders live in WASM memory and are discarded on session close.

  2. Dual-Path Architecture β€” Preview (Web Audio API, 32-bit) and Render (RainDSP, 64-bit) are always separate codepaths. Never merge them.

  3. Multi-Tenant Isolation β€” Every DB query includes WHERE user_id = $user_id. Row-Level Security enabled on all tables. No exceptions.

  4. K-Weighting Sign Convention β€” y = b0Β·x + b1Β·x₁ + b2Β·xβ‚‚ βˆ’ a1Β·y₁ βˆ’ a2Β·yβ‚‚. a1 stored negative, subtracted. ITU-R BS.1770-4 convention β€” never change this.

  5. NORMALIZATION_VALIDATED Gate β€” RAIN_NORMALIZATION_VALIDATED=true β†’ gate OPEN β†’ RainNet inference active. Closed by default. Sign-off authority: Phil BΓΆlke.

  6. WASM Binary Integrity β€” rain_dsp_wasm_hash verified at session start via SHA-256. Mismatch = RAIN-E304, render blocked. Set RAIN_EXPECTED_WASM_HASH in production.

  7. Provenance Before Output β€” Output hash verified against RAIN-CERT before session marked complete. RAIN-E305 on mismatch. RAIN-E306 on unsigned cert. No exceptions in production.


Project Structure

RAIN-V6-AI-AUDIO-TRANSFORMATION-MASTERING-AND-DISTRIBUTION-INFRUSTRUCTURE/
β”œβ”€β”€ backend/                   FastAPI application
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ api/routes/        19 routers β€” see API Routes table above
β”‚   β”‚   β”œβ”€β”€ core/              config, database, security, observability, audio_io
β”‚   β”‚   β”œβ”€β”€ models/            SQLAlchemy ORM models (PostgreSQL 18 + RLS)
β”‚   β”‚   β”œβ”€β”€ schemas/           Pydantic request / response schemas
β”‚   β”‚   └── services/          master_engine, qc_engine, rain_score_v2, separation…
β”‚   └── tests/                 pytest async test suite
β”œβ”€β”€ frontend/                  React 19 SPA (Vite 7 Β· TypeScript Β· Tailwind 4)
β”œβ”€β”€ rain-dsp/                  C++20 DSP engine β€” Emscripten WASM build
β”œβ”€β”€ rain-desktop/              Tauri 2.0 desktop wrapper
β”œβ”€β”€ rain-plugin/               JUCE 8 VST3 / AU / AAX plugin
β”œβ”€β”€ ml/                        PyTorch training, ONNX export, RainNet v2
β”œβ”€β”€ docker/                    Dockerfiles (backend, frontend, gpu-worker)
β”œβ”€β”€ monitoring/                Prometheus + Grafana dashboards
β”œβ”€β”€ docs/                      Architecture docs, pipeline specs
β”œβ”€β”€ CLAUDE.md                  Immutable architecture specification
β”œβ”€β”€ RAIN-BLUEPRINT.md          Full technical blueprint
└── .env.example               All required environment variables documented

Error Code Reference

Code Meaning Action
RAIN-E100 JWT authentication failure Re-authenticate; check token expiry
RAIN-E304 WASM binary hash mismatch Set RAIN_EXPECTED_WASM_HASH to deployed hash
RAIN-E305 Output hash mismatch in RAIN-CERT Re-render; check CERT signing key
RAIN-E306 Session completed without signed cert Check C2PA key paths in config
RAIN-E503 Public score rate limit exceeded 10 requests/hour per IP β€” wait or authenticate
RAIN-E620 Separation disabled Set SEPARATION_ENABLED=true and provision model checkpoints
RAIN-E621 demix() not available Install music-source-separation-training on GPU worker
RAIN-E900 Claude API auth failure Check ANTHROPIC_API_KEY in env
RAIN-E901 Claude API timeout / exhausted retries 3 retries with exponential backoff β€” check network
RAIN-E902 Claude response parse failure Invalid JSON from model β€” check logs for raw response

License

Proprietary β€” Β© 2026 ThatGuy Productions. All rights reserved.

Contact philippusbolke@gmail.com for licensing enquiries.


RAIN v6 Β· Engine stamp: RAIN v6 β€” BS-RoFormer 12-stem Β· LLM advisory layer: configurable Claude Sonnet (claude-sonnet-4-20250514 default) Β· Publisher: ThatGuy Productions

image

About

RAIN-MASTERING-DISTRIBUTION-ENGINE

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages