# adnanfreezy/stemsplit architecture

> Architecture diagram of the GitHub repository adnanfreezy/stemsplit, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/adnanfreezy/stemsplit
- Repository: https://github.com/adnanfreezy/stemsplit

## Overview

StemSplit is an offline audio stem-separation app for Windows and Android. The main workflow is selecting an audio file and separation mode, running local HTDemucs/ONNX inference, saving stem WAVs, then optionally blending and exporting a custom mix. The graph preserves the desktop and Android workflows plus their documented mixer and background-processing capabilities. Android implementation details were not sampled, so unverified internal links are dashed; desktop GUI-to-engine linkage is also not shown as a call in the excerpt.

Main entry points: [`android/app/src/main/java/com/example/stemsplit/StemSplitService.kt`](https://github.com/adnanfreezy/stemsplit/blob/main/android/app/src/main/java/com/example/stemsplit/StemSplitService.kt) (Foreground Job), [`desktop/stemmer.py`](https://github.com/adnanfreezy/stemsplit/blob/main/desktop/stemmer.py) (Desktop Separator), [`android/app/src/main/java/com/example/stemsplit/ui/main`](https://github.com/adnanfreezy/stemsplit/tree/main/android/app/src/main/java/com/example/stemsplit/ui/main) (Android Screens), [`desktop/gui.py`](https://github.com/adnanfreezy/stemsplit/blob/main/desktop/gui.py) (Desktop UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Windows Desktop"]
  node_desktop_ui["Desktop UI<br/>[gui.py]"]
end

subgraph group_android["Android App"]
  node_android_ui["Android Screens"]
  node_android_activity["App Entry<br/>[MainActivity.kt]"]
  node_android_navigation["Navigation<br/>[Navigation.kt]"]
  node_android_vm["Screen State"]
  node_android_service["Foreground Job"]
  node_android_data["Data Repository<br/>[DataRepository.kt]"]
end

subgraph group_inference["Separation Engine"]
  node_desktop_engine["Desktop Separator<br/>[stemmer.py]"]
  node_android_engine["Android Separator<br/>[OnnxStemmer.kt]"]
  node_onnx{{"ONNX Runtime"}}
end

subgraph group_mixing["Live Mixing"]
  node_desktop_mix["Desktop Mixer<br/>[gui.py]"]
  node_android_mixer["Android Mixer<br/>[LiveMixerScreen.kt]"]
  node_stem_files[("Stem WAVs")]
end

node_user(("User"))

node_user -->|"selects audio"| node_desktop_ui
node_desktop_ui -.->|"starts separation"| node_desktop_engine
node_desktop_engine -->|"runs inference"| node_onnx
node_desktop_engine -->|"writes stems"| node_stem_files
node_user -->|"selects audio"| node_android_ui
node_android_activity -.->|"opens navigation"| node_android_navigation
node_android_navigation -.->|"routes screens"| node_android_ui
node_android_ui -.->|"requests separation"| node_android_vm
node_android_vm -.->|"starts background job"| node_android_service
node_android_service -.->|"runs separation"| node_android_engine
node_android_engine -->|"runs inference"| node_onnx
node_android_service -.->|"saves stems"| node_stem_files
node_desktop_mix -->|"loads stems"| node_stem_files
node_android_mixer -->|"mixes stems"| node_stem_files
node_user -->|"controls playback"| node_desktop_mix
node_user -->|"opens mixer"| node_android_mixer
node_android_data -.->|"manages output"| node_stem_files

click node_desktop_ui "https://github.com/adnanfreezy/stemsplit/blob/main/desktop/gui.py"
click node_desktop_engine "https://github.com/adnanfreezy/stemsplit/blob/main/desktop/stemmer.py"
click node_desktop_mix "https://github.com/adnanfreezy/stemsplit/blob/main/desktop/gui.py"
click node_android_ui "https://github.com/adnanfreezy/stemsplit/tree/main/android/app/src/main/java/com/example/stemsplit/ui/main"
click node_android_activity "https://github.com/adnanfreezy/stemsplit/blob/main/android/app/src/main/java/com/example/stemsplit/MainActivity.kt"
click node_android_navigation "https://github.com/adnanfreezy/stemsplit/blob/main/android/app/src/main/java/com/example/stemsplit/Navigation.kt"
click node_android_vm "https://github.com/adnanfreezy/stemsplit/blob/main/android/app/src/main/java/com/example/stemsplit/ui/main/MainScreenViewModel.kt"
click node_android_service "https://github.com/adnanfreezy/stemsplit/blob/main/android/app/src/main/java/com/example/stemsplit/StemSplitService.kt"
click node_android_engine "https://github.com/adnanfreezy/stemsplit/blob/main/android/app/src/main/java/com/example/stemsplit/OnnxStemmer.kt"
click node_android_data "https://github.com/adnanfreezy/stemsplit/blob/main/android/app/src/main/java/com/example/stemsplit/data/DataRepository.kt"
click node_android_mixer "https://github.com/adnanfreezy/stemsplit/blob/main/android/app/src/main/java/com/example/stemsplit/ui/main/LiveMixerScreen.kt"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_desktop_ui,node_user toneBlue
class node_android_ui,node_android_activity,node_android_navigation,node_android_vm,node_android_service,node_android_data toneAmber
class node_desktop_engine,node_android_engine,node_onnx toneMint
class node_desktop_mix,node_android_mixer,node_stem_files toneRose
```

## Components

### Windows Desktop

- [Desktop UI](https://github.com/adnanfreezy/stemsplit/blob/main/desktop/gui.py): `desktop/gui.py`

### Android App

- [Android Screens](https://github.com/adnanfreezy/stemsplit/tree/main/android/app/src/main/java/com/example/stemsplit/ui/main): `android/app/src/main/java/com/example/stemsplit/ui/main`
- [App Entry](https://github.com/adnanfreezy/stemsplit/blob/main/android/app/src/main/java/com/example/stemsplit/MainActivity.kt): `android/app/src/main/java/com/example/stemsplit/MainActivity.kt`
- [Navigation](https://github.com/adnanfreezy/stemsplit/blob/main/android/app/src/main/java/com/example/stemsplit/Navigation.kt): `android/app/src/main/java/com/example/stemsplit/Navigation.kt`
- [Screen State](https://github.com/adnanfreezy/stemsplit/blob/main/android/app/src/main/java/com/example/stemsplit/ui/main/MainScreenViewModel.kt): `android/app/src/main/java/com/example/stemsplit/ui/main/MainScreenViewModel.kt`
- [Foreground Job](https://github.com/adnanfreezy/stemsplit/blob/main/android/app/src/main/java/com/example/stemsplit/StemSplitService.kt): `android/app/src/main/java/com/example/stemsplit/StemSplitService.kt`
- [Data Repository](https://github.com/adnanfreezy/stemsplit/blob/main/android/app/src/main/java/com/example/stemsplit/data/DataRepository.kt): `android/app/src/main/java/com/example/stemsplit/data/DataRepository.kt`

### Separation Engine

- [Desktop Separator](https://github.com/adnanfreezy/stemsplit/blob/main/desktop/stemmer.py): `desktop/stemmer.py`
- [Android Separator](https://github.com/adnanfreezy/stemsplit/blob/main/android/app/src/main/java/com/example/stemsplit/OnnxStemmer.kt): `android/app/src/main/java/com/example/stemsplit/OnnxStemmer.kt`
- **ONNX Runtime**

### Live Mixing

- [Desktop Mixer](https://github.com/adnanfreezy/stemsplit/blob/main/desktop/gui.py): `desktop/gui.py`
- [Android Mixer](https://github.com/adnanfreezy/stemsplit/blob/main/android/app/src/main/java/com/example/stemsplit/ui/main/LiveMixerScreen.kt): `android/app/src/main/java/com/example/stemsplit/ui/main/LiveMixerScreen.kt`
- **Stem WAVs**

### Other components

- **User**

## Connections

- User → Desktop UI: selects audio (evidence: `README.md`)
- Desktop UI → Desktop Separator: starts separation (evidence: `desktop/gui.py`)
- Desktop Separator → ONNX Runtime: runs inference (evidence: `desktop/stemmer.py`)
- Desktop Separator → Stem WAVs: writes stems (evidence: `desktop/stemmer.py`)
- User → Android Screens: selects audio (evidence: `README.md`)
- App Entry → Navigation: opens navigation
- Navigation → Android Screens: routes screens
- Android Screens → Screen State: requests separation
- Screen State → Foreground Job: starts background job
- Foreground Job → Android Separator: runs separation
- Android Separator → ONNX Runtime: runs inference (evidence: `README.md`)
- Foreground Job → Stem WAVs: saves stems
- Desktop Mixer → Stem WAVs: loads stems (evidence: `desktop/gui.py`)
- Android Mixer → Stem WAVs: mixes stems (evidence: `README.md`)
- User → Desktop Mixer: controls playback (evidence: `README.md`)
- User → Android Mixer: opens mixer (evidence: `README.md`)
- Data Repository → Stem WAVs: manages output
