Architecture

MixBox is an automated DJ pipeline carrying audio from source tracks to final mixed output; core pipelines use localized dependencies instead of mandatory global ServiceRegistries.

DJ Path

flowchart TD
    A["Entry: mixbox.cli.commands.main"] --> B["Validated Config (Pydantic)"]
    B --> C["Analysis / Service layer: AnalysisService, bounded asyncio.Semaphore"]
    C --> D["Planning and Transitions: RecipeService, MixPlanService, TimelinePreviewViewModel"]
    D --> E["Mixer (grid-aligned)"]
    E --> F["Outputs: audio + mix_report.json"]
#StageDetail
1Entrymixbox.cli.commands.main parses input paths and CLI overrides
2Validated Configmixbox.config.config.Config / models.py populated and validated via Pydantic
3Analysis / Service layerAnalysisService extracts BPM, key, and energy with caching, concurrency bounded by asyncio.Semaphore
4Planning & TransitionsRecipeService, MixPlanService, TimelinePreviewViewModel compute compatible transition windows, beats, and effect parameters
5MixerAudio segments aligned to a grid and transitioned seamlessly
6OutputsMix exported to output-dir plus a structured mix_report.json of timing and quality metrics
uv run mixbox mix track1.wav track2.wav --output-dir out/
uv run mixbox plan track1.wav track2.wav --output mix_plan.json

Conventions

ConventionRule
Asynchronous executionHeavy analysis runs via asyncio.gather with bounded semaphores offloading CPU-bound DSP, maintaining stability
Dependency injectionServices receive instantiated config objects and localized deps; ServiceRegistry is strictly for NiceGUI composition and ViewModels, while CLI and review runtimes construct services directly
UI splitNiceGUI drives reactive timeline previews (TimelinePreviewViewModel); the FastAPI review server serves a separate prebuilt static UI
Audio loadingNo repository-wide librosa ban; loading and mixing paths rely on the shared audio-core package
Error handlingAnalysis tasks return Track(path=track_path, error=str(e)) instead of halting the batch