Spaces:
Paused
Paused
v0.7: Unified Studio (BASS/NOISE lanes, compensated stem graph) – keeps Demucs, /data bucket, Docker port 7860
Browse files- README.md +48 -10
- app/server.py +96 -21
- app/static/app.js +5 -3
- app/static/arrangement.css +68 -0
- app/static/arrangement.js +102 -12
- app/static/index.html +49 -7
- app/unified.py +207 -0
- docs/RELEASE_0.7.md +54 -0
- pyproject.toml +1 -1
- tests/test_unified.py +193 -0
README.md
CHANGED
|
@@ -11,7 +11,7 @@ short_description: Forensic audio lab – HPSS + Demucs stems, arrangement mixer
|
|
| 11 |
|
| 12 |
> **Hugging Face Space note:** Public demo instance, no authentication. Demucs htdemucs v4 runs on CPU (max. 120 s audio per job); HPSS has no duration limit. Upload limit 200 MiB. Projects are stored in an attached HF Storage Bucket at `/data` if mounted, otherwise in `/tmp` (lost on restart). Do not upload private/confidential audio.
|
| 13 |
|
| 14 |
-
# ABSOLUTION Ω — v0.
|
| 15 |
|
| 16 |
**Lokales Fullstack-Audiostudio.** Enthält alle Funktionen aus v0.4 (BASS-CORE, NOISE-CORE,
|
| 17 |
Virtual Bass, HPSS, optional Demucs) und zusätzlich ein farbiges Mehrspur-Arrangement.
|
|
@@ -21,14 +21,18 @@ Virtual Bass, HPSS, optional Demucs) und zusätzlich ein farbiges Mehrspur-Arran
|
|
| 21 |
1. ZIP entpacken. **Python 3.11+** muss installiert sein.
|
| 22 |
2. Windows: `start_windows.bat` ausführen. macOS/Linux: `bash start.sh`.
|
| 23 |
3. Browser: **http://127.0.0.1:8000**.
|
| 24 |
-
4.
|
| 25 |
-
5.
|
| 26 |
-
6.
|
| 27 |
-
7. **
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
**Beispiel direkt starten, ohne Startskript:**
|
| 34 |
```bash
|
|
@@ -40,7 +44,41 @@ python -m pytest -q
|
|
| 40 |
python -m uvicorn app.server:app --host 127.0.0.1 --port 8000
|
| 41 |
```
|
| 42 |
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
- Mehrspur-Arrangement mit einzelnen Instrumenten-/Signalstems je nach verfügbarem Modell.
|
| 46 |
- Jedes *tatsächlich* verfügbare Audio-Stem erhält eigene Farbe und samplebasierte
|
|
|
|
| 11 |
|
| 12 |
> **Hugging Face Space note:** Public demo instance, no authentication. Demucs htdemucs v4 runs on CPU (max. 120 s audio per job); HPSS has no duration limit. Upload limit 200 MiB. Projects are stored in an attached HF Storage Bucket at `/data` if mounted, otherwise in `/tmp` (lost on restart). Do not upload private/confidential audio.
|
| 13 |
|
| 14 |
+
# ABSOLUTION Ω — v0.7 · Unified Multitrack Studio · BASS/NOISE Lanes
|
| 15 |
|
| 16 |
**Lokales Fullstack-Audiostudio.** Enthält alle Funktionen aus v0.4 (BASS-CORE, NOISE-CORE,
|
| 17 |
Virtual Bass, HPSS, optional Demucs) und zusätzlich ein farbiges Mehrspur-Arrangement.
|
|
|
|
| 21 |
1. ZIP entpacken. **Python 3.11+** muss installiert sein.
|
| 22 |
2. Windows: `start_windows.bat` ausführen. macOS/Linux: `bash start.sh`.
|
| 23 |
3. Browser: **http://127.0.0.1:8000**.
|
| 24 |
+
4. Im **Ω STUDIO** oben **Datei importieren** oder **Demo laden**.
|
| 25 |
+
5. Optional **Mini-KI analysieren** → Hypothesen prüfen und **Plan speichern**.
|
| 26 |
+
6. **Separation starten** (HPSS ist immer verfügbar; Demucs benötigt lokale Modellgewichte).
|
| 27 |
+
7. In der **Element-Kontrolle** auf **Kick & Bassline als Spuren** klicken.
|
| 28 |
+
8. **Störungen scannen**, verdächtige Stellen manuell auswählen und **Auswahl reparieren**.
|
| 29 |
+
Nur nach einer solchen Freigabe entsteht eine echte, separate **STÖRSPUR**.
|
| 30 |
+
9. Bestehende Stems werden dabei rechnerisch kompensiert. Alle Spuren zusammen
|
| 31 |
+
ergeben beim neutralen Mix wieder das Original, soweit der Ausgangsseparator
|
| 32 |
+
numerisch konsistent ist. **Die Störspur bleibt zunächst hörbar**.
|
| 33 |
+
10. Für die gezielte Entfernung bestätigter Klickanteile die Störspur mit **M** stummschalten.
|
| 34 |
+
11. Für jede Spur Gain, Mute, Solo, Stereo-Fader und Effekte einstellen →
|
| 35 |
+
**Mix berechnen**, anhören und WAV/ZIP exportieren.
|
| 36 |
|
| 37 |
**Beispiel direkt starten, ohne Startskript:**
|
| 38 |
```bash
|
|
|
|
| 44 |
python -m uvicorn app.server:app --host 127.0.0.1 --port 8000
|
| 45 |
```
|
| 46 |
|
| 47 |
+
|
| 48 |
+
## v0.7 — Debugging: BASS-CORE + NOISE-CORE sind echte zusätzliche Arrangement-Lanes
|
| 49 |
+
|
| 50 |
+
- **KICK** (`kick_core`): tiefes, transient-orientiertes Bassband; keine sichere Kick-Isolation.
|
| 51 |
+
- **BASSLINE** (`bassline_core`): tiefes, tonales Bassband; keine sichere Instrument-Isolation.
|
| 52 |
+
- **STÖRSPUR** (`noise_difference`): genau die **explizit freigegebenen** Reparaturdifferenzen
|
| 53 |
+
(`Original − repariert`). Ohne freigegebene Klickreparatur gibt es diese Spur nicht.
|
| 54 |
+
- **Kompensierte Basisstems**: das System zieht die drei zusätzlichen Signalanteile von
|
| 55 |
+
den tatsächlichen Basisstems ab. Die Zusatz-Lanes **verdoppeln niemals** die Bassenergie.
|
| 56 |
+
- Bei HPSS werden Bassline und Kick aus `harmonic` bzw. `percussive` kompensiert, die
|
| 57 |
+
Stördifferenz aus `residual`. Mit Demucs werden `bass`, `drums` und `residual` verwendet.
|
| 58 |
+
Ohne Grundseparation wird der Originalmix als `source_body` herangezogen.
|
| 59 |
+
- Eine neutrale Summe aller Lanes bleibt die Originalmischung. Nichtdestuktive Bearbeitung;
|
| 60 |
+
ein neuer Stereo-Mix wird nur auf ausdrücklichen Wunsch gerendert.
|
| 61 |
+
- **Klangschutz:** Noise-Lane ist nicht stumm. `M` auf NOISE bewirkt erst nach manueller
|
| 62 |
+
Freigabe die tatsächliche Korrektur. `S` ermöglicht differenzbasiertes Abhören.
|
| 63 |
+
- Die bestehenden Bass-Optimierungs-Ausgaben (mit optional synthetischen Obertönen)
|
| 64 |
+
bleiben separate Audition/Exports und werden **nicht** automatisch in den neutralen
|
| 65 |
+
Gesamtmix addiert.
|
| 66 |
+
- **Kdenlive/FFmpeg Virtual Bass** bleibt separater 2.1-LFE-Export. Kein Import in
|
| 67 |
+
den Stereo-Mixer, weil dieser eine andere Kanalbelegung hat.
|
| 68 |
+
|
| 69 |
+
### Technische Grenzen
|
| 70 |
+
- Kein Stems-„Magie“: HPSS ist eine spektrale Abschätzung; Demucs braucht geprüfte,
|
| 71 |
+
lokal bereitgestellte Gewichte. Mini-TAG benennt nur Hypothesen.
|
| 72 |
+
- NOISE-CORE extrahiert bisher nur manuell akzeptierte Reparaturdifferenzen,
|
| 73 |
+
nicht zuverlässig jede Art von Umgebungsrauschen.
|
| 74 |
+
- Der Mixer rechnet mit WAV Float32, kann bei starken Gain-/FX-Änderungen >0 dBFS
|
| 75 |
+
ausgeben und meldet das ausdrücklich.
|
| 76 |
+
- Das Bauen zusätzlicher Spuren legt WAV-Dateien im `omega_data`-Ordner ab.
|
| 77 |
+
Alte Graphgenerationen werden für laufende Projekte nicht automatisch gelöscht.
|
| 78 |
+
- Das lokale Backend hat weder Mehrnutzer-Authentifizierung noch dauerhafte Jobs.
|
| 79 |
+
Nicht ungeschützt ins öffentliche Internet stellen.
|
| 80 |
+
|
| 81 |
+
### Funktionen und Komponenten
|
| 82 |
|
| 83 |
- Mehrspur-Arrangement mit einzelnen Instrumenten-/Signalstems je nach verfügbarem Modell.
|
| 84 |
- Jedes *tatsächlich* verfügbare Audio-Stem erhält eigene Farbe und samplebasierte
|
app/server.py
CHANGED
|
@@ -27,6 +27,7 @@ from .noise import RepairParams, inspect_noise_file, repair_noise_file
|
|
| 27 |
from .virtualbass import available as virtualbass_available, render_virtualbass
|
| 28 |
from .mini_model import inspect_file as inspect_mini, MODEL_FILE
|
| 29 |
from .mixer import render_mix, sampled_peaks, rubberband_available
|
|
|
|
| 30 |
|
| 31 |
from .audio import (
|
| 32 |
AudioError, align_and_resample, analyze_file, hpss_separate_file,
|
|
@@ -37,8 +38,6 @@ from .audio import (
|
|
| 37 |
# Configure ABSOLUTION_MAX_UPLOAD_MIB to fit your available storage.
|
| 38 |
MAX_UPLOAD_MIB = max(1, min(4096, int(os.environ.get("ABSOLUTION_MAX_UPLOAD_MIB", "1024"))))
|
| 39 |
MAX_UPLOAD_BYTES = MAX_UPLOAD_MIB * 1024 * 1024
|
| 40 |
-
# Demucs on shared CPU hardware: cap input duration (0 = unlimited).
|
| 41 |
-
DEMUCS_MAX_SECONDS = float(os.environ.get("ABSOLUTION_DEMUCS_MAX_SECONDS", "0"))
|
| 42 |
ALLOWED_EXTENSIONS = {".wav", ".flac", ".aif", ".aiff", ".mp3", ".ogg"}
|
| 43 |
|
| 44 |
|
|
@@ -53,6 +52,10 @@ def check_id(raw: str) -> str:
|
|
| 53 |
raise HTTPException(status_code=404, detail="Project not found.") from exc
|
| 54 |
|
| 55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
class ProjectCreate(BaseModel):
|
| 57 |
name: str = Field(default="Untitled project", min_length=1, max_length=80)
|
| 58 |
|
|
@@ -158,21 +161,64 @@ class Service:
|
|
| 158 |
"id": project_id, "name": name, "created_at": timestamp(),
|
| 159 |
"asset": None, "analysis": None, "stems": {},
|
| 160 |
"separation": None, "report": None, "bass": None, "noise": None, "virtualbass": None,
|
| 161 |
-
"inventory": None, "plan": [], "mixer": None,
|
| 162 |
}
|
| 163 |
self.write_manifest(project_id, manifest)
|
| 164 |
return manifest
|
| 165 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 166 |
def create_mixer_job(self, request: MixerRequest) -> dict:
|
| 167 |
project_id=check_id(request.project_id)
|
| 168 |
with self.lock:
|
| 169 |
manifest=self.manifest(project_id)
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
|
|
|
| 173 |
if unknown:
|
| 174 |
raise HTTPException(status_code=422,detail="Unknown real stems: "+", ".join(sorted(unknown)))
|
| 175 |
-
if len(
|
| 176 |
raise HTTPException(status_code=422,detail="More than 128 stems not supported for one render.")
|
| 177 |
if (request.tempo!=1 or request.pitch_semitones!=0) and not rubberband_available():
|
| 178 |
raise HTTPException(status_code=422,detail="FFmpeg with rubberband is required for independent tempo/pitch.")
|
|
@@ -191,7 +237,11 @@ class Service:
|
|
| 191 |
try:
|
| 192 |
self.update_job(job_id,status="running",progress=3)
|
| 193 |
manifest=self.manifest(project_id);folder=self.folder(project_id)
|
| 194 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 195 |
output=folder/"mixer"/(job_id+".wav")
|
| 196 |
result=render_mix(sources,settings,output,
|
| 197 |
progress=lambda r:self.update_job(job_id,progress=3+int(r*90)))
|
|
@@ -219,7 +269,7 @@ class Service:
|
|
| 219 |
"id": "demucs", "name": "Demucs HT v4 · neural (local weights)",
|
| 220 |
"ready": configured, "type": "neural_network",
|
| 221 |
"stems": ["drums", "bass", "other", "vocals", "residual"],
|
| 222 |
-
"limitations": ("Requires trusted local htdemucs weights/config (official checkpoint 955717e8) and "
|
| 223 |
"demucs/torch dependencies. No automatic downloads."),
|
| 224 |
},
|
| 225 |
]
|
|
@@ -309,7 +359,10 @@ class Service:
|
|
| 309 |
with self.lock:
|
| 310 |
updated = self.manifest(project_id)
|
| 311 |
updated["bass"] = result
|
|
|
|
| 312 |
self.write_manifest(project_id, updated)
|
|
|
|
|
|
|
| 313 |
self.update_job(job_id, status="done", progress=100)
|
| 314 |
except Exception as exc:
|
| 315 |
self.update_job(job_id, status="failed", error=f"{type(exc).__name__}: {exc}")
|
|
@@ -371,6 +424,8 @@ class Service:
|
|
| 371 |
"tracks":tracks,"report":report,
|
| 372 |
}
|
| 373 |
self.write_manifest(project_id,updated)
|
|
|
|
|
|
|
| 374 |
self.update_job(job_id,status="done",progress=100)
|
| 375 |
except Exception as exc:
|
| 376 |
self.update_job(job_id,status="failed",error=f"{type(exc).__name__}: {exc}")
|
|
@@ -459,7 +514,13 @@ class Service:
|
|
| 459 |
"preview_format": "WAV PCM 16-bit (separate listening copies)",
|
| 460 |
}
|
| 461 |
updated["report"] = report
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 462 |
self.write_manifest(project_id, updated)
|
|
|
|
| 463 |
self.update_job(job_id, status="done", progress=100)
|
| 464 |
except Exception as exc:
|
| 465 |
self.update_job(job_id, status="failed", error=f"{type(exc).__name__}: {exc}")
|
|
@@ -512,7 +573,7 @@ def create_app(data_root: Path | None = None) -> FastAPI:
|
|
| 512 |
if data_root is None:
|
| 513 |
data_root = writable_dir(default, Path(os.environ.get("ABSOLUTION_FALLBACK_DIR", "/tmp/omega_data")))
|
| 514 |
service = Service(data_root)
|
| 515 |
-
app = FastAPI(title="ABSOLUTION Ω", version="0.
|
| 516 |
description="Local-first audio forensic vertical slice")
|
| 517 |
app.state.service = service
|
| 518 |
static_dir = Path(__file__).parent / "static"
|
|
@@ -532,7 +593,7 @@ def create_app(data_root: Path | None = None) -> FastAPI:
|
|
| 532 |
|
| 533 |
@app.get("/api/v1/health")
|
| 534 |
def health():
|
| 535 |
-
return {"status": "ok", "version": "0.
|
| 536 |
"network_downloads": False, "auth": False,
|
| 537 |
"max_upload_bytes": MAX_UPLOAD_BYTES,
|
| 538 |
"duration_limit_seconds": None, "streaming_hpss": True}
|
|
@@ -746,15 +807,26 @@ def create_app(data_root: Path | None = None) -> FastAPI:
|
|
| 746 |
if not manifest.get("asset"):raise HTTPException(status_code=404,detail="No audio")
|
| 747 |
path=folder/manifest["asset"]["stored_name"]
|
| 748 |
else:
|
| 749 |
-
|
|
|
|
|
|
|
| 750 |
raise HTTPException(status_code=404,detail="Unknown stem")
|
| 751 |
-
path=folder/"
|
| 752 |
if points<64 or points>1000:
|
| 753 |
raise HTTPException(status_code=422,detail="points must be 64..1000")
|
| 754 |
try:return sampled_peaks(path,points)
|
| 755 |
except (ValueError,RuntimeError) as exc:
|
| 756 |
raise HTTPException(status_code=422,detail=str(exc)) from exc
|
| 757 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 758 |
@app.post("/api/v1/jobs/mix",status_code=202)
|
| 759 |
def start_mix(request:MixerRequest):
|
| 760 |
return service.create_mixer_job(request)
|
|
@@ -775,8 +847,8 @@ def create_app(data_root: Path | None = None) -> FastAPI:
|
|
| 775 |
@app.get("/api/v1/projects/{project_id}/stems")
|
| 776 |
def get_stems(project_id: str):
|
| 777 |
manifest = service.manifest(project_id)
|
| 778 |
-
return {"stems": manifest
|
| 779 |
-
"separation": manifest["separation"]}
|
| 780 |
|
| 781 |
@app.get("/api/v1/projects/{project_id}/audio/{stem}")
|
| 782 |
def get_audio(project_id: str, stem: str, preview: bool = False):
|
|
@@ -787,10 +859,11 @@ def create_app(data_root: Path | None = None) -> FastAPI:
|
|
| 787 |
raise HTTPException(status_code=404, detail="Audio not found.")
|
| 788 |
path = folder / ("original_preview.wav" if preview else manifest["asset"]["stored_name"])
|
| 789 |
else:
|
| 790 |
-
|
|
|
|
| 791 |
raise HTTPException(status_code=404, detail="Stem not found.")
|
| 792 |
key = "preview" if preview else "master"
|
| 793 |
-
path = folder / "
|
| 794 |
if not path.is_file():
|
| 795 |
raise HTTPException(status_code=404, detail="Audio not found.")
|
| 796 |
return FileResponse(path, media_type="audio/wav" if preview or path.suffix == ".wav" else "application/octet-stream",
|
|
@@ -800,8 +873,9 @@ def create_app(data_root: Path | None = None) -> FastAPI:
|
|
| 800 |
def export_stems(project_id: str):
|
| 801 |
folder = service.folder(project_id)
|
| 802 |
manifest = service.manifest(project_id)
|
| 803 |
-
|
| 804 |
-
|
|
|
|
| 805 |
target = folder / "absolution_export.zip"
|
| 806 |
# Build only from controlled server-side names. Atomic replace.
|
| 807 |
tmp = folder / f".{uuid.uuid4().hex}.zip"
|
|
@@ -809,8 +883,9 @@ def create_app(data_root: Path | None = None) -> FastAPI:
|
|
| 809 |
archive.write(folder / "manifest.json", "manifest.json")
|
| 810 |
original_path = folder / manifest["asset"]["stored_name"]
|
| 811 |
archive.write(original_path, "source" + original_path.suffix)
|
| 812 |
-
for item in
|
| 813 |
-
|
|
|
|
| 814 |
tmp.replace(target)
|
| 815 |
return FileResponse(target, media_type="application/zip",
|
| 816 |
filename=f"absolution_{project_id[:8]}.zip")
|
|
|
|
| 27 |
from .virtualbass import available as virtualbass_available, render_virtualbass
|
| 28 |
from .mini_model import inspect_file as inspect_mini, MODEL_FILE
|
| 29 |
from .mixer import render_mix, sampled_peaks, rubberband_available
|
| 30 |
+
from .unified import build_unified_graph
|
| 31 |
|
| 32 |
from .audio import (
|
| 33 |
AudioError, align_and_resample, analyze_file, hpss_separate_file,
|
|
|
|
| 38 |
# Configure ABSOLUTION_MAX_UPLOAD_MIB to fit your available storage.
|
| 39 |
MAX_UPLOAD_MIB = max(1, min(4096, int(os.environ.get("ABSOLUTION_MAX_UPLOAD_MIB", "1024"))))
|
| 40 |
MAX_UPLOAD_BYTES = MAX_UPLOAD_MIB * 1024 * 1024
|
|
|
|
|
|
|
| 41 |
ALLOWED_EXTENSIONS = {".wav", ".flac", ".aif", ".aiff", ".mp3", ".ogg"}
|
| 42 |
|
| 43 |
|
|
|
|
| 52 |
raise HTTPException(status_code=404, detail="Project not found.") from exc
|
| 53 |
|
| 54 |
|
| 55 |
+
# Demucs on shared CPU hardware: cap input duration (0 = unlimited).
|
| 56 |
+
DEMUCS_MAX_SECONDS = float(os.environ.get("ABSOLUTION_DEMUCS_MAX_SECONDS", "0"))
|
| 57 |
+
|
| 58 |
+
|
| 59 |
class ProjectCreate(BaseModel):
|
| 60 |
name: str = Field(default="Untitled project", min_length=1, max_length=80)
|
| 61 |
|
|
|
|
| 161 |
"id": project_id, "name": name, "created_at": timestamp(),
|
| 162 |
"asset": None, "analysis": None, "stems": {},
|
| 163 |
"separation": None, "report": None, "bass": None, "noise": None, "virtualbass": None,
|
| 164 |
+
"inventory": None, "plan": [], "mixer": None, "unified": None,
|
| 165 |
}
|
| 166 |
self.write_manifest(project_id, manifest)
|
| 167 |
return manifest
|
| 168 |
|
| 169 |
+
def active_tracks(self, manifest: dict) -> dict:
|
| 170 |
+
graph = manifest.get("unified")
|
| 171 |
+
if graph and graph.get("mix_consistent"):
|
| 172 |
+
return graph["stems"]
|
| 173 |
+
return manifest.get("stems") or {}
|
| 174 |
+
|
| 175 |
+
def refresh_unified(self, project_id: str) -> dict | None:
|
| 176 |
+
"""Called only from worker or explicit user action. Never overwrites source."""
|
| 177 |
+
manifest = self.manifest(project_id)
|
| 178 |
+
graph = build_unified_graph(self.folder(project_id), manifest)
|
| 179 |
+
with self.lock:
|
| 180 |
+
latest = self.manifest(project_id)
|
| 181 |
+
latest["unified"] = graph
|
| 182 |
+
latest["mixer"] = None
|
| 183 |
+
self.write_manifest(project_id, latest)
|
| 184 |
+
return graph
|
| 185 |
+
|
| 186 |
+
def create_unified_job(self, project_id: str) -> dict:
|
| 187 |
+
project_id = check_id(project_id)
|
| 188 |
+
with self.lock:
|
| 189 |
+
manifest = self.manifest(project_id)
|
| 190 |
+
if not manifest.get("asset"):
|
| 191 |
+
raise HTTPException(status_code=409, detail="Import audio before building tracks.")
|
| 192 |
+
if any(j["project_id"]==project_id and j["status"] in ("queued","running")
|
| 193 |
+
for j in self.jobs.values()):
|
| 194 |
+
raise HTTPException(status_code=409, detail="Project already processing.")
|
| 195 |
+
job={"id":str(uuid.uuid4()),"project_id":project_id,
|
| 196 |
+
"kind":"unified", "model":"canonical_track_graph",
|
| 197 |
+
"status":"queued","progress":0,"created_at":timestamp(),"error":None}
|
| 198 |
+
self.jobs[job["id"]]=job
|
| 199 |
+
self.executor.submit(self.run_unified_job,job["id"])
|
| 200 |
+
return dict(job)
|
| 201 |
+
|
| 202 |
+
def run_unified_job(self, job_id: str):
|
| 203 |
+
pid=self.jobs[job_id]["project_id"]
|
| 204 |
+
try:
|
| 205 |
+
self.update_job(job_id,status="running",progress=10)
|
| 206 |
+
self.refresh_unified(pid)
|
| 207 |
+
self.update_job(job_id,status="done",progress=100)
|
| 208 |
+
except Exception as exc:
|
| 209 |
+
self.update_job(job_id,status="failed",error=f"{type(exc).__name__}: {exc}")
|
| 210 |
+
|
| 211 |
def create_mixer_job(self, request: MixerRequest) -> dict:
|
| 212 |
project_id=check_id(request.project_id)
|
| 213 |
with self.lock:
|
| 214 |
manifest=self.manifest(project_id)
|
| 215 |
+
tracks = self.active_tracks(manifest)
|
| 216 |
+
if not tracks:
|
| 217 |
+
raise HTTPException(status_code=409,detail="Run separation or build BASS/NOISE tracks first.")
|
| 218 |
+
unknown=set(request.tracks)-set(tracks)
|
| 219 |
if unknown:
|
| 220 |
raise HTTPException(status_code=422,detail="Unknown real stems: "+", ".join(sorted(unknown)))
|
| 221 |
+
if len(tracks)>128:
|
| 222 |
raise HTTPException(status_code=422,detail="More than 128 stems not supported for one render.")
|
| 223 |
if (request.tempo!=1 or request.pitch_semitones!=0) and not rubberband_available():
|
| 224 |
raise HTTPException(status_code=422,detail="FFmpeg with rubberband is required for independent tempo/pitch.")
|
|
|
|
| 237 |
try:
|
| 238 |
self.update_job(job_id,status="running",progress=3)
|
| 239 |
manifest=self.manifest(project_id);folder=self.folder(project_id)
|
| 240 |
+
graph = manifest.get("unified")
|
| 241 |
+
if graph and graph.get("mix_consistent"):
|
| 242 |
+
sources={name:folder/data["master"] for name,data in graph["stems"].items()}
|
| 243 |
+
else:
|
| 244 |
+
sources={name:folder/"stems"/data["master"] for name,data in manifest["stems"].items()}
|
| 245 |
output=folder/"mixer"/(job_id+".wav")
|
| 246 |
result=render_mix(sources,settings,output,
|
| 247 |
progress=lambda r:self.update_job(job_id,progress=3+int(r*90)))
|
|
|
|
| 269 |
"id": "demucs", "name": "Demucs HT v4 · neural (local weights)",
|
| 270 |
"ready": configured, "type": "neural_network",
|
| 271 |
"stems": ["drums", "bass", "other", "vocals", "residual"],
|
| 272 |
+
"limitations": ("Requires trusted local htdemucs weights/config (official checkpoint 955717e8) and optional "
|
| 273 |
"demucs/torch dependencies. No automatic downloads."),
|
| 274 |
},
|
| 275 |
]
|
|
|
|
| 359 |
with self.lock:
|
| 360 |
updated = self.manifest(project_id)
|
| 361 |
updated["bass"] = result
|
| 362 |
+
updated["unified"] = None
|
| 363 |
self.write_manifest(project_id, updated)
|
| 364 |
+
self.update_job(job_id, progress=94)
|
| 365 |
+
self.refresh_unified(project_id)
|
| 366 |
self.update_job(job_id, status="done", progress=100)
|
| 367 |
except Exception as exc:
|
| 368 |
self.update_job(job_id, status="failed", error=f"{type(exc).__name__}: {exc}")
|
|
|
|
| 424 |
"tracks":tracks,"report":report,
|
| 425 |
}
|
| 426 |
self.write_manifest(project_id,updated)
|
| 427 |
+
self.update_job(job_id,progress=94)
|
| 428 |
+
self.refresh_unified(project_id)
|
| 429 |
self.update_job(job_id,status="done",progress=100)
|
| 430 |
except Exception as exc:
|
| 431 |
self.update_job(job_id,status="failed",error=f"{type(exc).__name__}: {exc}")
|
|
|
|
| 514 |
"preview_format": "WAV PCM 16-bit (separate listening copies)",
|
| 515 |
}
|
| 516 |
updated["report"] = report
|
| 517 |
+
# Bass estimates tied to a prior separation must not survive re-separation.
|
| 518 |
+
if updated.get("bass") and updated["bass"].get("mode") in ("hpss", "demucs"):
|
| 519 |
+
updated["bass"] = None
|
| 520 |
+
updated["unified"] = None
|
| 521 |
+
updated["mixer"] = None
|
| 522 |
self.write_manifest(project_id, updated)
|
| 523 |
+
self.refresh_unified(project_id)
|
| 524 |
self.update_job(job_id, status="done", progress=100)
|
| 525 |
except Exception as exc:
|
| 526 |
self.update_job(job_id, status="failed", error=f"{type(exc).__name__}: {exc}")
|
|
|
|
| 573 |
if data_root is None:
|
| 574 |
data_root = writable_dir(default, Path(os.environ.get("ABSOLUTION_FALLBACK_DIR", "/tmp/omega_data")))
|
| 575 |
service = Service(data_root)
|
| 576 |
+
app = FastAPI(title="ABSOLUTION Ω", version="0.7.0",
|
| 577 |
description="Local-first audio forensic vertical slice")
|
| 578 |
app.state.service = service
|
| 579 |
static_dir = Path(__file__).parent / "static"
|
|
|
|
| 593 |
|
| 594 |
@app.get("/api/v1/health")
|
| 595 |
def health():
|
| 596 |
+
return {"status": "ok", "version": "0.7.0", "unified_stem_graph": True, "arrangement_studio": True, "mini_tag_model_ready": MODEL_FILE.is_file(), "rubberband_ready": rubberband_available(), "basscore": True, "noisecore": True, "virtualbass_ready": virtualbass_available(), "job_backend": "process-local", "data_dir": str(service.data_root), "persistent_storage": str(service.data_root).startswith("/data"), "demucs_max_seconds": DEMUCS_MAX_SECONDS or None,
|
| 597 |
"network_downloads": False, "auth": False,
|
| 598 |
"max_upload_bytes": MAX_UPLOAD_BYTES,
|
| 599 |
"duration_limit_seconds": None, "streaming_hpss": True}
|
|
|
|
| 807 |
if not manifest.get("asset"):raise HTTPException(status_code=404,detail="No audio")
|
| 808 |
path=folder/manifest["asset"]["stored_name"]
|
| 809 |
else:
|
| 810 |
+
graph=manifest.get("unified")
|
| 811 |
+
active=service.active_tracks(manifest)
|
| 812 |
+
if stem not in active:
|
| 813 |
raise HTTPException(status_code=404,detail="Unknown stem")
|
| 814 |
+
path=folder/active[stem]["master"] if (graph and graph.get("mix_consistent")) else folder/"stems"/active[stem]["master"]
|
| 815 |
if points<64 or points>1000:
|
| 816 |
raise HTTPException(status_code=422,detail="points must be 64..1000")
|
| 817 |
try:return sampled_peaks(path,points)
|
| 818 |
except (ValueError,RuntimeError) as exc:
|
| 819 |
raise HTTPException(status_code=422,detail=str(exc)) from exc
|
| 820 |
|
| 821 |
+
@app.post("/api/v1/jobs/unify", status_code=202)
|
| 822 |
+
def start_unified(project_id: str):
|
| 823 |
+
return service.create_unified_job(project_id)
|
| 824 |
+
|
| 825 |
+
@app.get("/api/v1/projects/{project_id}/unified")
|
| 826 |
+
def get_unified(project_id: str):
|
| 827 |
+
m = service.manifest(project_id)
|
| 828 |
+
return {"unified": m.get("unified"), "active_stems": service.active_tracks(m)}
|
| 829 |
+
|
| 830 |
@app.post("/api/v1/jobs/mix",status_code=202)
|
| 831 |
def start_mix(request:MixerRequest):
|
| 832 |
return service.create_mixer_job(request)
|
|
|
|
| 847 |
@app.get("/api/v1/projects/{project_id}/stems")
|
| 848 |
def get_stems(project_id: str):
|
| 849 |
manifest = service.manifest(project_id)
|
| 850 |
+
return {"stems": service.active_tracks(manifest), "report": manifest["report"],
|
| 851 |
+
"separation": manifest["separation"], "unified": manifest.get("unified")}
|
| 852 |
|
| 853 |
@app.get("/api/v1/projects/{project_id}/audio/{stem}")
|
| 854 |
def get_audio(project_id: str, stem: str, preview: bool = False):
|
|
|
|
| 859 |
raise HTTPException(status_code=404, detail="Audio not found.")
|
| 860 |
path = folder / ("original_preview.wav" if preview else manifest["asset"]["stored_name"])
|
| 861 |
else:
|
| 862 |
+
active = service.active_tracks(manifest)
|
| 863 |
+
if stem not in active:
|
| 864 |
raise HTTPException(status_code=404, detail="Stem not found.")
|
| 865 |
key = "preview" if preview else "master"
|
| 866 |
+
path = folder / active[stem][key] if (manifest.get("unified") or {}).get("mix_consistent") else folder / "stems" / active[stem][key]
|
| 867 |
if not path.is_file():
|
| 868 |
raise HTTPException(status_code=404, detail="Audio not found.")
|
| 869 |
return FileResponse(path, media_type="audio/wav" if preview or path.suffix == ".wav" else "application/octet-stream",
|
|
|
|
| 873 |
def export_stems(project_id: str):
|
| 874 |
folder = service.folder(project_id)
|
| 875 |
manifest = service.manifest(project_id)
|
| 876 |
+
active = service.active_tracks(manifest)
|
| 877 |
+
if not active:
|
| 878 |
+
raise HTTPException(status_code=409, detail="Separate audio or build BASS/NOISE lanes before exporting.")
|
| 879 |
target = folder / "absolution_export.zip"
|
| 880 |
# Build only from controlled server-side names. Atomic replace.
|
| 881 |
tmp = folder / f".{uuid.uuid4().hex}.zip"
|
|
|
|
| 883 |
archive.write(folder / "manifest.json", "manifest.json")
|
| 884 |
original_path = folder / manifest["asset"]["stored_name"]
|
| 885 |
archive.write(original_path, "source" + original_path.suffix)
|
| 886 |
+
for name,item in active.items():
|
| 887 |
+
path = folder/item["master"] if (manifest.get("unified") or {}).get("mix_consistent") else folder/"stems"/item["master"]
|
| 888 |
+
archive.write(path, "stems/" + name + ".wav")
|
| 889 |
tmp.replace(target)
|
| 890 |
return FileResponse(target, media_type="application/zip",
|
| 891 |
filename=f"absolution_{project_id[:8]}.zip")
|
app/static/app.js
CHANGED
|
@@ -9,7 +9,7 @@ const state = {
|
|
| 9 |
projectId: null, projectName: "", asset: null, analysis: null,
|
| 10 |
stems: {}, report: null, separation: null, bass: null, noise: null, virtualbass: null, virtualReady: false,
|
| 11 |
model: "hpss", models: [], busy: false, playing: "original",
|
| 12 |
-
view: "
|
| 13 |
};
|
| 14 |
let toastTimer = null;
|
| 15 |
let maxUploadBytes = 1024 * 1024 * 1024;
|
|
@@ -132,7 +132,7 @@ function loadManifest(project) {
|
|
| 132 |
state.projectName = project.name || "Unbenannt";
|
| 133 |
state.asset = project.asset;
|
| 134 |
state.analysis = project.analysis;
|
| 135 |
-
state.stems = project.stems || {};
|
| 136 |
state.report = project.report;
|
| 137 |
state.separation = project.separation;
|
| 138 |
state.bass = project.bass || null;
|
|
@@ -508,7 +508,7 @@ async function runBass() {
|
|
| 508 |
if(now.status==="done")break;
|
| 509 |
}
|
| 510 |
const project=await api(`${BASE}/projects/${state.projectId}`);
|
| 511 |
-
|
| 512 |
renderBass();
|
| 513 |
toast("BASS-CORE abgeschlossen! Vergleiche Bassband vorher/nachher mit deinem Gehör.");
|
| 514 |
} catch(error){
|
|
@@ -662,6 +662,7 @@ async function startNoiseScan() {
|
|
| 662 |
await pollNoiseJob(job.id,"Musikalische Impulse werden vorsichtig untersucht …");
|
| 663 |
const response=await api(`${BASE}/projects/${state.projectId}/noise`);
|
| 664 |
state.noise=response.noise;renderNoise();
|
|
|
|
| 665 |
toast("Scan beendet. Nichts wurde verändert. Bitte jeden Kandidaten einzeln prüfen.");
|
| 666 |
}catch(error){toast(`NOISE-CORE: ${error.message}`,true)}
|
| 667 |
finally{setBusy(false);renderNoise();}
|
|
@@ -681,6 +682,7 @@ async function startNoiseRepair() {
|
|
| 681 |
await pollNoiseJob(job.id,"Nur freigegebene Einzelstellen werden behutsam bearbeitet …");
|
| 682 |
const response=await api(`${BASE}/projects/${state.projectId}/noise`);
|
| 683 |
state.noise=response.noise;renderNoise();
|
|
|
|
| 684 |
toast("Reparatur gerendert. Bitte die Differenzspur anhören.");
|
| 685 |
}catch(error){toast(`NOISE-CORE: ${error.message}`,true)}
|
| 686 |
finally{setBusy(false);renderNoise();}
|
|
|
|
| 9 |
projectId: null, projectName: "", asset: null, analysis: null,
|
| 10 |
stems: {}, report: null, separation: null, bass: null, noise: null, virtualbass: null, virtualReady: false,
|
| 11 |
model: "hpss", models: [], busy: false, playing: "original",
|
| 12 |
+
view: "arrangement",
|
| 13 |
};
|
| 14 |
let toastTimer = null;
|
| 15 |
let maxUploadBytes = 1024 * 1024 * 1024;
|
|
|
|
| 132 |
state.projectName = project.name || "Unbenannt";
|
| 133 |
state.asset = project.asset;
|
| 134 |
state.analysis = project.analysis;
|
| 135 |
+
state.stems = project.unified?.mix_consistent ? project.unified.stems : (project.stems || {});
|
| 136 |
state.report = project.report;
|
| 137 |
state.separation = project.separation;
|
| 138 |
state.bass = project.bass || null;
|
|
|
|
| 508 |
if(now.status==="done")break;
|
| 509 |
}
|
| 510 |
const project=await api(`${BASE}/projects/${state.projectId}`);
|
| 511 |
+
loadManifest(project);
|
| 512 |
renderBass();
|
| 513 |
toast("BASS-CORE abgeschlossen! Vergleiche Bassband vorher/nachher mit deinem Gehör.");
|
| 514 |
} catch(error){
|
|
|
|
| 662 |
await pollNoiseJob(job.id,"Musikalische Impulse werden vorsichtig untersucht …");
|
| 663 |
const response=await api(`${BASE}/projects/${state.projectId}/noise`);
|
| 664 |
state.noise=response.noise;renderNoise();
|
| 665 |
+
loadManifest(await api(`${BASE}/projects/${state.projectId}`));
|
| 666 |
toast("Scan beendet. Nichts wurde verändert. Bitte jeden Kandidaten einzeln prüfen.");
|
| 667 |
}catch(error){toast(`NOISE-CORE: ${error.message}`,true)}
|
| 668 |
finally{setBusy(false);renderNoise();}
|
|
|
|
| 682 |
await pollNoiseJob(job.id,"Nur freigegebene Einzelstellen werden behutsam bearbeitet …");
|
| 683 |
const response=await api(`${BASE}/projects/${state.projectId}/noise`);
|
| 684 |
state.noise=response.noise;renderNoise();
|
| 685 |
+
loadManifest(await api(`${BASE}/projects/${state.projectId}`));
|
| 686 |
toast("Reparatur gerendert. Bitte die Differenzspur anhören.");
|
| 687 |
}catch(error){toast(`NOISE-CORE: ${error.message}`,true)}
|
| 688 |
finally{setBusy(false);renderNoise();}
|
app/static/arrangement.css
CHANGED
|
@@ -169,3 +169,71 @@ main:has(>.arr-view.active){width:100%;max-width:1840px;padding:26px 24px 22px}
|
|
| 169 |
|
| 170 |
.arr-scroll-label{display:flex;align-items:center;justify-content:end;gap:10px;padding:8px 3px;color:#89a9b6;font-size:9px;font-weight:800;letter-spacing:.1em}
|
| 171 |
.arr-scroll-label input{width:min(320px,60%);accent-color:#70e4cb}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 169 |
|
| 170 |
.arr-scroll-label{display:flex;align-items:center;justify-content:end;gap:10px;padding:8px 3px;color:#89a9b6;font-size:9px;font-weight:800;letter-spacing:.1em}
|
| 171 |
.arr-scroll-label input{width:min(320px,60%);accent-color:#70e4cb}
|
| 172 |
+
|
| 173 |
+
/* Ω v0.7 AURORA-inspired instrument laboratory:
|
| 174 |
+
original styling, no third-party fonts, image assets or component code. */
|
| 175 |
+
.arr-view{--arr-gold:#eccf91;--arr-teal:#79f2d5}
|
| 176 |
+
.arr-view::before{content:"";position:fixed;z-index:-1;inset:0;pointer-events:none;
|
| 177 |
+
background:radial-gradient(ellipse at 79% 16%,#18577335,transparent 45%),
|
| 178 |
+
radial-gradient(ellipse at 14% 86%,#1b85602b,transparent 46%)}
|
| 179 |
+
.arr-card,.omega-operations{
|
| 180 |
+
background:linear-gradient(125deg,rgba(24,41,57,.91),rgba(9,20,31,.97) 68%),
|
| 181 |
+
linear-gradient(90deg,#193346,#0d1a29);
|
| 182 |
+
box-shadow:inset 0 1px #a3e9df18,0 18px 58px #02070c55;
|
| 183 |
+
backdrop-filter:blur(18px);
|
| 184 |
+
}
|
| 185 |
+
.arr-view h1,.arr-card h2{letter-spacing:-.045em}
|
| 186 |
+
.omega-operations{margin:18px 0 22px;padding:23px;border:1px solid #426978;border-radius:15px;
|
| 187 |
+
position:relative;overflow:hidden}
|
| 188 |
+
.omega-operations::after{content:"";position:absolute;inset:0;pointer-events:none;border-radius:15px;
|
| 189 |
+
background:linear-gradient(132deg,#b7f5e80c,transparent 24%,transparent 80%,#ead49c0b)}
|
| 190 |
+
.omega-ops-head{display:flex;align-items:start;justify-content:space-between;gap:18px;margin-bottom:17px}
|
| 191 |
+
.omega-ops-head h2{font-size:25px;color:#e9f8f8;margin:6px 0}
|
| 192 |
+
.omega-ops-head h2 em{font-style:normal;color:#efcb84}
|
| 193 |
+
.omega-ops-head p{color:#94b5c3;font-size:12px;line-height:1.6}
|
| 194 |
+
.omega-procedure-grid{display:grid;grid-template-columns:1fr 1fr;gap:13px;margin-bottom:15px}
|
| 195 |
+
.omega-procedure{border:1px solid #36556b;background:linear-gradient(146deg,#0f2434dc,#0c1a29);
|
| 196 |
+
padding:18px;border-radius:12px;box-shadow:inset 0 1px #e0f4ff13}
|
| 197 |
+
.omega-noise-lab{border-color:#634a60}
|
| 198 |
+
.omega-procedure-title{display:flex;align-items:center;gap:9px;margin-bottom:9px;flex-wrap:wrap}
|
| 199 |
+
.omega-dot{width:8px;height:8px;border-radius:50%;background:var(--node-color);box-shadow:0 0 16px var(--node-color)}
|
| 200 |
+
.omega-procedure-title strong{letter-spacing:.1em;color:#e5f9f7;font-size:12px}
|
| 201 |
+
.omega-procedure-title small{color:#87a6bd;font-size:9px;font-weight:800;letter-spacing:.11em;margin-left:auto}
|
| 202 |
+
.omega-procedure p{color:#a4b9c8;font-size:12px;line-height:1.55;margin:0 0 14px}
|
| 203 |
+
.omega-safety{display:block;color:#839aaf;margin-top:12px;font-size:10px;line-height:1.6}
|
| 204 |
+
.omega-field{display:flex;gap:14px;align-items:center;flex-wrap:wrap;font-weight:700;
|
| 205 |
+
color:#c0e3e3;font-size:11px;letter-spacing:.03em;margin:12px 0}
|
| 206 |
+
.omega-field input{flex:1 1 100%;width:100%;accent-color:#83eacb}
|
| 207 |
+
.omega-field output{color:#81f1d4;margin-left:auto;font-variant-numeric:tabular-nums}
|
| 208 |
+
.omega-candidates{max-height:125px;overflow:auto;border:1px solid #33495b;border-radius:8px;
|
| 209 |
+
background:#071724a8;padding:10px;display:flex;flex-wrap:wrap;gap:6px;color:#8fabb9;font-size:10px}
|
| 210 |
+
.omega-candidate{display:flex;align-items:center;gap:5px;border:1px solid #314558;padding:6px;
|
| 211 |
+
border-radius:6px;color:#cee0ea;background:#122637}
|
| 212 |
+
.omega-candidate input{accent-color:#f49ebb}
|
| 213 |
+
.omega-noise-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
|
| 214 |
+
.omega-diagnostics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:9px;margin-bottom:14px}
|
| 215 |
+
.omega-diagnostic{padding:13px;background:#0a1a28bb;border:1px solid #304b5c;border-radius:10px;
|
| 216 |
+
display:grid;gap:7px;min-width:0}
|
| 217 |
+
.omega-diagnostic span{font-size:9px;font-weight:800;color:#83a4b6;letter-spacing:.1em}
|
| 218 |
+
.omega-diagnostic strong{font-size:12px;overflow-wrap:anywhere;color:#b5f1e1;font-variant-numeric:tabular-nums}
|
| 219 |
+
.omega-track-table-wrap{overflow:auto;border:1px solid #355365;border-radius:10px}
|
| 220 |
+
.omega-track-table{border-collapse:collapse;width:100%;min-width:620px;font-size:11px;color:#b8d5e3}
|
| 221 |
+
.omega-track-table thead{background:#183444;color:#8fdccc;text-align:left;letter-spacing:.1em;font-size:9px}
|
| 222 |
+
.omega-track-table th,.omega-track-table td{padding:11px 12px;border-bottom:1px solid #253e50;text-align:left}
|
| 223 |
+
.omega-track-table tbody tr:nth-child(2n){background:#0d223064}
|
| 224 |
+
.omega-track-table td:first-child{font-weight:750;color:#e6f3f4}
|
| 225 |
+
.omega-key{display:inline-block;width:8px;height:8px;border-radius:3px;margin-right:7px;box-shadow:0 0 9px currentColor}
|
| 226 |
+
.omega-procedure-warning{margin-top:12px!important;color:#afc4c8;font-size:11px;line-height:1.5}
|
| 227 |
+
.arr-track:has(.arr-track-name strong[title="noise_difference"]){box-shadow:inset 3px 0 #f09bbd}
|
| 228 |
+
@media(max-width:1100px){
|
| 229 |
+
.omega-diagnostics{grid-template-columns:repeat(2,minmax(0,1fr))}
|
| 230 |
+
}
|
| 231 |
+
@media(max-width:680px){
|
| 232 |
+
.omega-operations{padding:13px}
|
| 233 |
+
.omega-ops-head{flex-wrap:wrap}
|
| 234 |
+
.omega-procedure-grid{grid-template-columns:1fr}
|
| 235 |
+
.omega-procedure{padding:13px}
|
| 236 |
+
.omega-diagnostics{gap:7px}
|
| 237 |
+
.omega-diagnostic{padding:10px}
|
| 238 |
+
.omega-diagnostic strong{font-size:11px}
|
| 239 |
+
}
|
app/static/arrangement.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
| 11 |
const G={
|
| 12 |
inventory:null,plan:[],real:[],peaks:{},settings:{},zoom:1,scroll:0,
|
| 13 |
mixed:null,projectId:null,rubberband:false,serverModel:true,rendering:false,
|
| 14 |
-
length:0
|
| 15 |
};
|
| 16 |
const escape=(x)=>String(x??"").replace(/[&<>"']/g,c=>({"&":"&","<":"<",">":">",'"':""","'":"'"}[c]));
|
| 17 |
const dt=t=>{if(!Number.isFinite(t))return "—";let h=Math.floor(t/3600),m=Math.floor(t%3600/60),s=Math.floor(t%60);return h?`${h}:${String(m).padStart(2,"0")}:${String(s).padStart(2,"0")}`:`${m}:${String(s).padStart(2,"0")}`;};
|
|
@@ -23,7 +23,7 @@
|
|
| 23 |
}
|
| 24 |
function updateStatus(){
|
| 25 |
byId("arrSourceName").textContent=state.asset?.filename||"Noch keine Datei — importiere im Studio oder lade die Demo.";
|
| 26 |
-
byId("arrStemStatus").textContent=`${G.real.length}
|
| 27 |
byId("arrActiveTracks").textContent=`${G.real.length} reale Spuren`;
|
| 28 |
byId("arrInspect").disabled=!state.asset||G.rendering;
|
| 29 |
byId("arrSeparate").disabled=!state.asset||G.rendering;
|
|
@@ -39,7 +39,8 @@
|
|
| 39 |
byId("arrRenderReport").textContent=G.real.length?"Änderungen ungerendert":"Noch kein Mix berechnet";
|
| 40 |
}
|
| 41 |
function reset(){
|
| 42 |
-
G.projectId=null;G.inventory=null;G.plan=[];G.real=[];G.peaks={};G.settings={};G.mixed=null;G.length=0;
|
|
|
|
| 43 |
byId("arrPlanContent").innerHTML='<div class="arr-empty-inline">Noch keine Vorinventur. Klicke auf „Mini-KI analysieren“.</div>';
|
| 44 |
renderTracks();updateStatus();setUnrendered();draw();
|
| 45 |
}
|
|
@@ -48,9 +49,15 @@
|
|
| 48 |
const different=G.projectId!==projectId;
|
| 49 |
G.projectId=projectId;G.inventory=manifest.inventory||null;
|
| 50 |
G.plan=(manifest.plan||[]).map(p=>({...p}));
|
| 51 |
-
G.
|
|
|
|
|
|
|
|
|
|
| 52 |
G.length=Number(manifest.analysis?.duration_seconds)||0;
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
| 54 |
const settings=manifest.mixer?.settings?.tracks||{};
|
| 55 |
if(different){for(const [n,p] of Object.entries(settings))G.settings[n]={...p};}
|
| 56 |
if(different && manifest.mixer)G.mixed=manifest.mixer;
|
|
@@ -62,7 +69,7 @@
|
|
| 62 |
byId("arrTempoOut").textContent=tempo+" %";
|
| 63 |
byId("arrPitchOut").textContent=(pitch>=0?"+":"")+pitch+" HT";
|
| 64 |
}
|
| 65 |
-
renderPlan();renderTracks();updateStatus();
|
| 66 |
if(G.mixed)setMixed(G.mixed);
|
| 67 |
else setUnrendered();
|
| 68 |
await Promise.all([
|
|
@@ -135,14 +142,14 @@
|
|
| 135 |
notice("Trennplan gespeichert. Noch keine Audiospur wurde dadurch erzeugt.");
|
| 136 |
}catch(e){notice("Trennplan: "+e.message,true);}
|
| 137 |
}
|
| 138 |
-
function defaultSettings(){return {gain_db:0,pan:0,mute:false,solo:false,highpass_hz:0,lowpass_hz:0,width:1,drive:0};}
|
| 139 |
-
function getSettings(name){return G.settings[name]||(G.settings[name]=defaultSettings());}
|
| 140 |
-
function colorFor(index){return COLORS[index%COLORS.length];}
|
| 141 |
function pretty(name){
|
| 142 |
const labels={vocals:"Gesang / Vocals",drums:"Schlagzeug / Drums",
|
| 143 |
bass:"Bass",other:"Andere Instrumente",harmonic:"Harmonische Klanganteile",
|
| 144 |
percussive:"Perkussive Klanganteile",residual:"Residuum / Restmaterial"};
|
| 145 |
-
return labels[name]||name.replace(/[_-]/g," ");
|
| 146 |
}
|
| 147 |
function renderTracks(){
|
| 148 |
const wrap=byId("arrTracks");
|
|
@@ -154,7 +161,7 @@
|
|
| 154 |
const p=getSettings(name),color=colorFor(i);
|
| 155 |
return `<article class="arr-track" style="--arr-color:${color}" data-index="${i}">
|
| 156 |
<div class="arr-track-left">
|
| 157 |
-
<div class="arr-track-name"><span class="arr-track-dot"></span><div><strong title="${escape(name)}">${escape(pretty(name))}</strong><small>STEM ${String(i+1).padStart(2,"0")} ·
|
| 158 |
<button type="button" class="arr-track-preview" data-action="play" title="Diese Spur einzeln hören" aria-label="${escape(pretty(name))} anhören">▶</button>
|
| 159 |
</div>
|
| 160 |
<div class="arr-track-ctrl"><button class="arr-mute ${p.mute?"on":""}" type="button" data-action="mute" aria-pressed="${!!p.mute}" title="Mute">M</button>
|
|
@@ -179,6 +186,83 @@
|
|
| 179 |
}).join("");
|
| 180 |
updateStatus();requestAnimationFrame(draw);
|
| 181 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 182 |
function outputValue(param,p){
|
| 183 |
switch(param){
|
| 184 |
case"gain_db":return `${p>0?"+":""}${p} dB`;
|
|
@@ -307,6 +391,12 @@
|
|
| 307 |
}
|
| 308 |
function listeners(){
|
| 309 |
byId("arrDemo").addEventListener("click",loadDemo);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 310 |
byId("arrInspect").addEventListener("click",inspect);
|
| 311 |
byId("arrSavePlan").addEventListener("click",savePlan);
|
| 312 |
byId("arrAddPlan").addEventListener("click",()=>{
|
|
@@ -326,7 +416,7 @@
|
|
| 326 |
selectMethod(selected);runSeparation();
|
| 327 |
});
|
| 328 |
byId("arrResetMix").addEventListener("click",()=>{
|
| 329 |
-
G.settings={};for(const n of G.real)G.settings[n]=defaultSettings();
|
| 330 |
byId("arrTempo").value=100;byId("arrPitch").value=0;byId("arrTempoOut").textContent="100 %";byId("arrPitchOut").textContent="±0 HT";
|
| 331 |
renderTracks();setUnrendered();
|
| 332 |
});
|
|
|
|
| 11 |
const G={
|
| 12 |
inventory:null,plan:[],real:[],peaks:{},settings:{},zoom:1,scroll:0,
|
| 13 |
mixed:null,projectId:null,rubberband:false,serverModel:true,rendering:false,
|
| 14 |
+
length:0,meta:{},graph:null,noise:null
|
| 15 |
};
|
| 16 |
const escape=(x)=>String(x??"").replace(/[&<>"']/g,c=>({"&":"&","<":"<",">":">",'"':""","'":"'"}[c]));
|
| 17 |
const dt=t=>{if(!Number.isFinite(t))return "—";let h=Math.floor(t/3600),m=Math.floor(t%3600/60),s=Math.floor(t%60);return h?`${h}:${String(m).padStart(2,"0")}:${String(s).padStart(2,"0")}`:`${m}:${String(s).padStart(2,"0")}`;};
|
|
|
|
| 23 |
}
|
| 24 |
function updateStatus(){
|
| 25 |
byId("arrSourceName").textContent=state.asset?.filename||"Noch keine Datei — importiere im Studio oder lade die Demo.";
|
| 26 |
+
byId("arrStemStatus").textContent=`${G.real.length} additive Audiospuren`;
|
| 27 |
byId("arrActiveTracks").textContent=`${G.real.length} reale Spuren`;
|
| 28 |
byId("arrInspect").disabled=!state.asset||G.rendering;
|
| 29 |
byId("arrSeparate").disabled=!state.asset||G.rendering;
|
|
|
|
| 39 |
byId("arrRenderReport").textContent=G.real.length?"Änderungen ungerendert":"Noch kein Mix berechnet";
|
| 40 |
}
|
| 41 |
function reset(){
|
| 42 |
+
G.projectId=null;G.inventory=null;G.plan=[];G.real=[];G.peaks={};G.settings={};G.mixed=null;G.length=0;G.meta={};G.graph=null;G.noise=null;
|
| 43 |
+
renderOperations();
|
| 44 |
byId("arrPlanContent").innerHTML='<div class="arr-empty-inline">Noch keine Vorinventur. Klicke auf „Mini-KI analysieren“.</div>';
|
| 45 |
renderTracks();updateStatus();setUnrendered();draw();
|
| 46 |
}
|
|
|
|
| 49 |
const different=G.projectId!==projectId;
|
| 50 |
G.projectId=projectId;G.inventory=manifest.inventory||null;
|
| 51 |
G.plan=(manifest.plan||[]).map(p=>({...p}));
|
| 52 |
+
G.graph=manifest.unified||null;
|
| 53 |
+
G.meta=manifest.unified?.mix_consistent ? manifest.unified.stems : (manifest.stems||{});
|
| 54 |
+
G.real=Object.keys(G.meta);
|
| 55 |
+
G.noise=manifest.noise||null;
|
| 56 |
G.length=Number(manifest.analysis?.duration_seconds)||0;
|
| 57 |
+
const roster=G.real.join("|");
|
| 58 |
+
if(different || G.lastRoster!==roster){G.peaks={};G.settings={};G.mixed=null;}
|
| 59 |
+
G.lastRoster=roster;
|
| 60 |
+
for(const n of G.real)if(!G.settings[n])G.settings[n]=defaultSettings(n);
|
| 61 |
const settings=manifest.mixer?.settings?.tracks||{};
|
| 62 |
if(different){for(const [n,p] of Object.entries(settings))G.settings[n]={...p};}
|
| 63 |
if(different && manifest.mixer)G.mixed=manifest.mixer;
|
|
|
|
| 69 |
byId("arrTempoOut").textContent=tempo+" %";
|
| 70 |
byId("arrPitchOut").textContent=(pitch>=0?"+":"")+pitch+" HT";
|
| 71 |
}
|
| 72 |
+
renderPlan();renderTracks();renderOperations();updateStatus();
|
| 73 |
if(G.mixed)setMixed(G.mixed);
|
| 74 |
else setUnrendered();
|
| 75 |
await Promise.all([
|
|
|
|
| 142 |
notice("Trennplan gespeichert. Noch keine Audiospur wurde dadurch erzeugt.");
|
| 143 |
}catch(e){notice("Trennplan: "+e.message,true);}
|
| 144 |
}
|
| 145 |
+
function defaultSettings(name=""){return {gain_db:0,pan:0,mute:false,solo:false,highpass_hz:0,lowpass_hz:0,width:1,drive:0};}
|
| 146 |
+
function getSettings(name){return G.settings[name]||(G.settings[name]=defaultSettings(name));}
|
| 147 |
+
function colorFor(index){const n=G.real[index];return G.meta[n]?.color||COLORS[index%COLORS.length];}
|
| 148 |
function pretty(name){
|
| 149 |
const labels={vocals:"Gesang / Vocals",drums:"Schlagzeug / Drums",
|
| 150 |
bass:"Bass",other:"Andere Instrumente",harmonic:"Harmonische Klanganteile",
|
| 151 |
percussive:"Perkussive Klanganteile",residual:"Residuum / Restmaterial"};
|
| 152 |
+
return G.meta[name]?.label||labels[name]||name.replace(/[_-]/g," ");
|
| 153 |
}
|
| 154 |
function renderTracks(){
|
| 155 |
const wrap=byId("arrTracks");
|
|
|
|
| 161 |
const p=getSettings(name),color=colorFor(i);
|
| 162 |
return `<article class="arr-track" style="--arr-color:${color}" data-index="${i}">
|
| 163 |
<div class="arr-track-left">
|
| 164 |
+
<div class="arr-track-name"><span class="arr-track-dot"></span><div><strong title="${escape(name)}">${escape(pretty(name))}</strong><small>STEM ${String(i+1).padStart(2,"0")} · ${escape(G.meta[name]?.role==="repair_difference"?"FREIGEGEBENE STÖRDIFFERENZ":G.meta[name]?.role==="derived_bass"?"BASSBAND-SCHÄTZUNG":"KOMPENSIERTE QUELLE")}</small></div>
|
| 165 |
<button type="button" class="arr-track-preview" data-action="play" title="Diese Spur einzeln hören" aria-label="${escape(pretty(name))} anhören">▶</button>
|
| 166 |
</div>
|
| 167 |
<div class="arr-track-ctrl"><button class="arr-mute ${p.mute?"on":""}" type="button" data-action="mute" aria-pressed="${!!p.mute}" title="Mute">M</button>
|
|
|
|
| 186 |
}).join("");
|
| 187 |
updateStatus();requestAnimationFrame(draw);
|
| 188 |
}
|
| 189 |
+
function renderOperations(){
|
| 190 |
+
const g=G.graph,hasAudio=Boolean(state?.asset);
|
| 191 |
+
byId("arrGraphStatus").textContent=g?.mix_consistent?"KONSISTENT":G.real.length?"BASISSTEMS":"WARTET AUF QUELLEN";
|
| 192 |
+
byId("arrGraphError").textContent=g?.mix_consistent?
|
| 193 |
+
`${Number(g.mix_consistency_max_error).toExponential(2)} max abs`:"—";
|
| 194 |
+
byId("arrBassStatus").textContent=G.real.includes("kick_core")?"Kick + Bassline aktiv":"Nicht berechnet";
|
| 195 |
+
byId("arrNoiseStatus").textContent=G.real.includes("noise_difference")?"Freigegebene Differenz":"Nicht repariert";
|
| 196 |
+
for(const id of ["arrBuildBass","arrScanNoise","arrUnify"]){
|
| 197 |
+
byId(id).disabled=!hasAudio||G.rendering;
|
| 198 |
+
}
|
| 199 |
+
const candidates=G.noise?.scan?.events||[];
|
| 200 |
+
const c=byId("arrNoiseCandidates");
|
| 201 |
+
if(!G.noise?.scan)c.textContent="Noch kein Scan. Keine automatische Stör-Entfernung.";
|
| 202 |
+
else if(!candidates.length)c.textContent="Keine Klick-Hypothesen gefunden; Original unverändert.";
|
| 203 |
+
else {
|
| 204 |
+
c.innerHTML=candidates.slice(0,120).map(e=>
|
| 205 |
+
`<label class="omega-candidate"><input type="checkbox" value="${Number(e.sample)}"> `+
|
| 206 |
+
`Sample ${Number(e.sample).toLocaleString("de-DE")} · ${Number(e.time_seconds??0).toFixed(3)} s · UNGEWISS</label>`).join("");
|
| 207 |
+
}
|
| 208 |
+
byId("arrRepairNoise").disabled=!hasAudio||!candidates.length||G.rendering;
|
| 209 |
+
const rows=Object.entries(G.meta);
|
| 210 |
+
byId("arrGraphTable").innerHTML=rows.length?rows.map(([name,meta])=>
|
| 211 |
+
`<tr><td><span class="omega-key" style="background:${escape(meta.color||"#8ea2bd")}"></span>`+
|
| 212 |
+
`${escape(meta.label||name)}</td><td>${escape(meta.role||"separiert")}</td>`+
|
| 213 |
+
`<td>${meta.role==="repair_difference"?"FREIGEGEBEN":meta.role==="derived_bass"?"SCHÄTZUNG":"REAL AUDIO"}</td>`+
|
| 214 |
+
`<td>${name==="noise_difference"?"MUTE nur bei Wunsch · Original bei ON":meta.role==="base_compensated"?"Kompensiert / nicht verdoppelt":"Frei mischbar"}</td></tr>`).join(""):
|
| 215 |
+
`<tr><td colspan="4">Zunächst Datei importieren und BASS-CORE oder Separation starten.</td></tr>`;
|
| 216 |
+
}
|
| 217 |
+
async function waitJob(job,caption){
|
| 218 |
+
const pid=G.projectId;
|
| 219 |
+
const label=byId("arrOpsProgress");
|
| 220 |
+
while(true){
|
| 221 |
+
await new Promise(r=>setTimeout(r,500));
|
| 222 |
+
const status=await request("/jobs/"+encodeURIComponent(job.id));
|
| 223 |
+
if(status.status==="failed")throw new Error(status.error||"Verarbeitung fehlgeschlagen");
|
| 224 |
+
if(pid!==G.projectId)throw new Error("Projektwechsel während des Jobs.");
|
| 225 |
+
label.textContent=`${caption}: ${status.progress||0} %`;
|
| 226 |
+
if(status.status==="done")break;
|
| 227 |
+
}
|
| 228 |
+
// Use the canonical manifest loader so every view sees the same real stems.
|
| 229 |
+
const manifest=await request(`/projects/${encodeURIComponent(pid)}`);
|
| 230 |
+
loadManifest(manifest);
|
| 231 |
+
label.textContent=`✓ ${caption} abgeschlossen. Der Originalmix wurde nicht überschrieben.`;
|
| 232 |
+
}
|
| 233 |
+
async function runOperation(action){
|
| 234 |
+
if(!state.asset||G.rendering)return;
|
| 235 |
+
G.rendering=true;renderOperations();updateStatus();
|
| 236 |
+
try{
|
| 237 |
+
let job,caption;
|
| 238 |
+
if(action==="bass"){
|
| 239 |
+
caption="Kick/Bassline vorbereiten";
|
| 240 |
+
const cfg={project_id:G.projectId,source_mode:"auto",
|
| 241 |
+
crossover_hz:Number(byId("arrBassCutoff").value),
|
| 242 |
+
kick_gain_db:0,bass_gain_db:0,sub_gain_db:0,
|
| 243 |
+
harmonics:0,lowcut_hz:22,wet:0};
|
| 244 |
+
job=await request("/jobs/bass",{method:"POST",headers:{"content-type":"application/json"},
|
| 245 |
+
body:JSON.stringify(cfg)});
|
| 246 |
+
}else if(action==="scan"){
|
| 247 |
+
caption="Stör-Hypothesen scannen";
|
| 248 |
+
job=await request("/jobs/noise/scan",{method:"POST",headers:{"content-type":"application/json"},
|
| 249 |
+
body:JSON.stringify({project_id:G.projectId})});
|
| 250 |
+
}else if(action==="repair"){
|
| 251 |
+
const picks=[...byId("arrNoiseCandidates").querySelectorAll("input:checked")].map(x=>Number(x.value));
|
| 252 |
+
if(!picks.length)throw new Error("Bitte zuerst tatsächliche Klickkandidaten auswählen.");
|
| 253 |
+
if(!confirm(`${picks.length} Klickstelle(n) reparieren? Die Differenz kann musikalische Signalanteile enthalten.`))return;
|
| 254 |
+
caption="Freigegebene Störspur erzeugen";
|
| 255 |
+
job=await request("/jobs/noise/repair",{method:"POST",headers:{"content-type":"application/json"},
|
| 256 |
+
body:JSON.stringify({project_id:G.projectId,approved_samples:picks,strength:Number(byId("arrNoiseStrength").value)/100})});
|
| 257 |
+
}else{
|
| 258 |
+
caption="Spurgraph rekonstruieren";
|
| 259 |
+
job=await request(`/jobs/unify?project_id=${encodeURIComponent(G.projectId)}`,{method:"POST"});
|
| 260 |
+
}
|
| 261 |
+
await waitJob(job,caption);
|
| 262 |
+
notice(caption+" abgeschlossen — Basis-Stems und Differenzen zusammengeführt.");
|
| 263 |
+
}catch(e){byId("arrOpsProgress").textContent="Fehler: "+e.message;notice("Studio: "+e.message,true);}
|
| 264 |
+
finally{G.rendering=false;renderOperations();updateStatus();}
|
| 265 |
+
}
|
| 266 |
function outputValue(param,p){
|
| 267 |
switch(param){
|
| 268 |
case"gain_db":return `${p>0?"+":""}${p} dB`;
|
|
|
|
| 391 |
}
|
| 392 |
function listeners(){
|
| 393 |
byId("arrDemo").addEventListener("click",loadDemo);
|
| 394 |
+
byId("arrImport").addEventListener("click",()=>byId("fileInput").click());
|
| 395 |
+
byId("arrBassCutoff").addEventListener("input",e=>byId("arrBassCutoffOut").textContent=e.target.value+" Hz");
|
| 396 |
+
byId("arrNoiseStrength").addEventListener("input",e=>byId("arrNoiseStrengthOut").textContent=e.target.value+" %");
|
| 397 |
+
for(const [id,mode] of [["arrBuildBass","bass"],["arrScanNoise","scan"],
|
| 398 |
+
["arrRepairNoise","repair"],["arrUnify","unify"]])
|
| 399 |
+
byId(id).addEventListener("click",()=>runOperation(mode));
|
| 400 |
byId("arrInspect").addEventListener("click",inspect);
|
| 401 |
byId("arrSavePlan").addEventListener("click",savePlan);
|
| 402 |
byId("arrAddPlan").addEventListener("click",()=>{
|
|
|
|
| 416 |
selectMethod(selected);runSeparation();
|
| 417 |
});
|
| 418 |
byId("arrResetMix").addEventListener("click",()=>{
|
| 419 |
+
G.settings={};for(const n of G.real)G.settings[n]=defaultSettings(n);
|
| 420 |
byId("arrTempo").value=100;byId("arrPitch").value=0;byId("arrTempoOut").textContent="100 %";byId("arrPitchOut").textContent="±0 HT";
|
| 421 |
renderTracks();setUnrendered();
|
| 422 |
});
|
app/static/index.html
CHANGED
|
@@ -22,8 +22,8 @@
|
|
| 22 |
</a>
|
| 23 |
<div class="nav-group-label">WORKSPACE</div>
|
| 24 |
<nav class="nav-stack" aria-label="Bereiche">
|
| 25 |
-
<button class="nav-link
|
| 26 |
-
<button class="nav-link" data-view="arrangement"><span class="nav-icon">▥</span>
|
| 27 |
<button class="nav-link" data-view="bass"><span class="nav-icon">♮</span> BASS-CORE <span class="nav-number">02</span></button>
|
| 28 |
<button class="nav-link" data-view="noise"><span class="nav-icon">⌁</span> NOISE-CORE <span class="nav-number">03</span></button>
|
| 29 |
<button class="nav-link" data-view="stems"><span class="nav-icon">≋</span> Meine Stems <span class="nav-count" id="stem-count">0</span></button>
|
|
@@ -41,13 +41,13 @@
|
|
| 41 |
<span class="privacy-icon">◉</span>
|
| 42 |
<div><strong>Lokale Verarbeitung</strong><small>Kein Cloud-Upload durch diese App</small></div>
|
| 43 |
</div>
|
| 44 |
-
<div class="sidebar-foot">ABSOLUTION Ω · v0.
|
| 45 |
</aside>
|
| 46 |
|
| 47 |
<div class="content-shell">
|
| 48 |
<header class="topbar">
|
| 49 |
<button id="menuToggle" class="menu-toggle icon-button" aria-label="Menü öffnen" aria-expanded="false">☰</button>
|
| 50 |
-
<div class="crumb"><span class="crumb-muted">WORKSPACE</span><span class="crumb-sep">/</span><span id="crumbCurrent">STUDIO</span></div>
|
| 51 |
<div class="top-right">
|
| 52 |
<span class="api-indicator" id="apiIndicator"><i></i><span id="apiLabel">Engine wird geprüft</span></span>
|
| 53 |
<button class="top-help" data-goto="guide" type="button">Hilfe <span>↗</span></button>
|
|
@@ -55,14 +55,15 @@
|
|
| 55 |
</header>
|
| 56 |
|
| 57 |
<main id="main-content" tabindex="-1">
|
| 58 |
-
<section id="view-arrangement" class="view arr-view" aria-label="Mehrspur-Arrangement Studio">
|
| 59 |
<div class="arr-header">
|
| 60 |
<div class="arr-title">
|
| 61 |
-
<div class="arr-kicker"><span class="arr-light"></span> ABSOLUTION Ω / MULTITRACK WORKSTATION <span class="arr-beta">v0.
|
| 62 |
<h1>Alle Frequenzen. <em>Alle Ebenen.</em></h1>
|
| 63 |
<p>KI-Vorinventur → editierbarer Trennplan → echte Stems → präziser Mix. Originaltreue steht über aggressiver Verarbeitung.</p>
|
| 64 |
</div>
|
| 65 |
<div class="arr-header-actions">
|
|
|
|
| 66 |
<button class="arr-btn arr-btn-ghost" id="arrDemo">♫ Demo laden</button>
|
| 67 |
<button class="arr-btn arr-btn-primary" id="arrInspect">✧ Mini-KI analysieren</button>
|
| 68 |
</div>
|
|
@@ -92,6 +93,47 @@
|
|
| 92 |
<div class="arr-help-text" id="arrPlanHint">Der Trennplan kann mehr Ziele enthalten als das gewählte Modell separat erzeugen kann. Nicht verfügbare Instrumente bleiben Planungseinträge, keine Audiodateien.</div>
|
| 93 |
</section>
|
| 94 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
<section class="arr-console arr-card">
|
| 96 |
<div class="arr-console-top">
|
| 97 |
<div class="arr-console-heading"><span class="arr-micro">MULTI-STEM WORKSPACE / MIXER</span><h2>Arrangement & Frequenzspuren</h2></div>
|
|
@@ -138,7 +180,7 @@
|
|
| 138 |
<p class="arr-disclaimer">Präzisionshinweis: Farbige Wellenformen sind Visualisierungen realer, geschätzter Stems; die Mini-KI liefert nur Textur-Hypothesen. Der Offline-Mix kann mit Filtern, Sättigung, Pan und Transposition hörbar vom Original abweichen und wird deshalb separat gerendert.</p>
|
| 139 |
</section>
|
| 140 |
|
| 141 |
-
<section id="view-studio" class="view
|
| 142 |
<div class="hero">
|
| 143 |
<div class="hero-copy">
|
| 144 |
<div class="kicker"><span class="kicker-dot"></span> INTELLIGENT AUDIO WORKSPACE <span class="kicker-index">/ 001</span></div>
|
|
|
|
| 22 |
</a>
|
| 23 |
<div class="nav-group-label">WORKSPACE</div>
|
| 24 |
<nav class="nav-stack" aria-label="Bereiche">
|
| 25 |
+
<button class="nav-link" data-view="studio"><span class="nav-icon">◈</span> Audio-Import <span class="nav-number">01</span></button>
|
| 26 |
+
<button class="nav-link active" data-view="arrangement" aria-current="page"><span class="nav-icon">▥</span> Ω STUDIO <span class="nav-number">NEU</span></button>
|
| 27 |
<button class="nav-link" data-view="bass"><span class="nav-icon">♮</span> BASS-CORE <span class="nav-number">02</span></button>
|
| 28 |
<button class="nav-link" data-view="noise"><span class="nav-icon">⌁</span> NOISE-CORE <span class="nav-number">03</span></button>
|
| 29 |
<button class="nav-link" data-view="stems"><span class="nav-icon">≋</span> Meine Stems <span class="nav-count" id="stem-count">0</span></button>
|
|
|
|
| 41 |
<span class="privacy-icon">◉</span>
|
| 42 |
<div><strong>Lokale Verarbeitung</strong><small>Kein Cloud-Upload durch diese App</small></div>
|
| 43 |
</div>
|
| 44 |
+
<div class="sidebar-foot">ABSOLUTION Ω · v0.7 UNIFIED STUDIO<br>Forschungsversion · Single User</div>
|
| 45 |
</aside>
|
| 46 |
|
| 47 |
<div class="content-shell">
|
| 48 |
<header class="topbar">
|
| 49 |
<button id="menuToggle" class="menu-toggle icon-button" aria-label="Menü öffnen" aria-expanded="false">☰</button>
|
| 50 |
+
<div class="crumb"><span class="crumb-muted">WORKSPACE</span><span class="crumb-sep">/</span><span id="crumbCurrent">Ω STUDIO</span></div>
|
| 51 |
<div class="top-right">
|
| 52 |
<span class="api-indicator" id="apiIndicator"><i></i><span id="apiLabel">Engine wird geprüft</span></span>
|
| 53 |
<button class="top-help" data-goto="guide" type="button">Hilfe <span>↗</span></button>
|
|
|
|
| 55 |
</header>
|
| 56 |
|
| 57 |
<main id="main-content" tabindex="-1">
|
| 58 |
+
<section id="view-arrangement" class="view active arr-view" aria-label="Mehrspur-Arrangement Studio">
|
| 59 |
<div class="arr-header">
|
| 60 |
<div class="arr-title">
|
| 61 |
+
<div class="arr-kicker"><span class="arr-light"></span> ABSOLUTION Ω / MULTITRACK WORKSTATION <span class="arr-beta">v0.7</span></div>
|
| 62 |
<h1>Alle Frequenzen. <em>Alle Ebenen.</em></h1>
|
| 63 |
<p>KI-Vorinventur → editierbarer Trennplan → echte Stems → präziser Mix. Originaltreue steht über aggressiver Verarbeitung.</p>
|
| 64 |
</div>
|
| 65 |
<div class="arr-header-actions">
|
| 66 |
+
<button class="arr-btn arr-btn-ghost" id="arrImport">+ Datei importieren</button>
|
| 67 |
<button class="arr-btn arr-btn-ghost" id="arrDemo">♫ Demo laden</button>
|
| 68 |
<button class="arr-btn arr-btn-primary" id="arrInspect">✧ Mini-KI analysieren</button>
|
| 69 |
</div>
|
|
|
|
| 93 |
<div class="arr-help-text" id="arrPlanHint">Der Trennplan kann mehr Ziele enthalten als das gewählte Modell separat erzeugen kann. Nicht verfügbare Instrumente bleiben Planungseinträge, keine Audiodateien.</div>
|
| 94 |
</section>
|
| 95 |
|
| 96 |
+
<section class="omega-operations arr-card" aria-label="BASS-CORE und NOISE-CORE im selben Studio">
|
| 97 |
+
<div class="omega-ops-head">
|
| 98 |
+
<div><span class="arr-micro">AURORA INSPIRED · AUDIO SURGICAL DECK</span>
|
| 99 |
+
<h2>Element-Kontrolle <em>Ω</em></h2>
|
| 100 |
+
<p>Separate Zusatz-Lanes ohne Signalverdopplung: alle Quellen werden beim Synchronisieren kompensiert.</p></div>
|
| 101 |
+
<button type="button" id="arrUnify" class="arr-btn arr-btn-ghost">↻ Spurgraph prüfen</button>
|
| 102 |
+
</div>
|
| 103 |
+
<div class="omega-procedure-grid">
|
| 104 |
+
<div class="omega-procedure omega-bass-lab">
|
| 105 |
+
<div class="omega-procedure-title"><span class="omega-dot" style="--node-color:#6feccc"></span>
|
| 106 |
+
<strong>BASS-CORE</strong><small>SUB · KICK · BASSLINE</small></div>
|
| 107 |
+
<p>Schätzt Kick- und Bassline-Tiefbänder. Diese werden aus den Ursprungsstems subtrahiert und separat mischbar.</p>
|
| 108 |
+
<label class="omega-field">Trennfrequenz <output id="arrBassCutoffOut">180 Hz</output>
|
| 109 |
+
<input id="arrBassCutoff" type="range" min="65" max="350" step="5" value="180"></label>
|
| 110 |
+
<button type="button" id="arrBuildBass" class="arr-btn arr-btn-primary">+ Kick & Bassline als Spuren</button>
|
| 111 |
+
<small class="omega-safety">DSP-Schätzung, keine garantierte Instrumenten-Isolation. Kein automatisches Bass-Enhancement.</small>
|
| 112 |
+
</div>
|
| 113 |
+
<div class="omega-procedure omega-noise-lab">
|
| 114 |
+
<div class="omega-procedure-title"><span class="omega-dot" style="--node-color:#f69cb8"></span>
|
| 115 |
+
<strong>NOISE-CORE</strong><small>FORENSIC · REPAIR DIFFERENCE</small></div>
|
| 116 |
+
<p>Störungen nur lokalisieren. Erst bestätigte Klickstellen erzeugen eine eigene, standardmäßig hörbare Störspur. Erst Mute entfernt den geprüften Anteil.</p>
|
| 117 |
+
<div class="omega-noise-actions"><button type="button" id="arrScanNoise" class="arr-btn arr-btn-ghost">⌕ Störungen scannen</button>
|
| 118 |
+
<button type="button" id="arrRepairNoise" class="arr-btn arr-btn-primary">✓ Auswahl reparieren</button></div>
|
| 119 |
+
<div id="arrNoiseCandidates" class="omega-candidates">Noch kein Scan. Ohne bestätigte Reparatur keine Störspur.</div>
|
| 120 |
+
<label class="omega-field">Reparaturstärke <output id="arrNoiseStrengthOut">65 %</output>
|
| 121 |
+
<input id="arrNoiseStrength" type="range" min="5" max="100" value="65" step="5"></label>
|
| 122 |
+
</div>
|
| 123 |
+
</div>
|
| 124 |
+
<div class="omega-diagnostics">
|
| 125 |
+
<div class="omega-diagnostic"><span>GRAPH STATUS</span><strong id="arrGraphStatus">Noch nicht berechnet</strong></div>
|
| 126 |
+
<div class="omega-diagnostic"><span>MIX CONSISTENCY</span><strong id="arrGraphError">—</strong></div>
|
| 127 |
+
<div class="omega-diagnostic"><span>KICK / BASS</span><strong id="arrBassStatus">Nicht vorhanden</strong></div>
|
| 128 |
+
<div class="omega-diagnostic"><span>NOISE DIFFERENCE</span><strong id="arrNoiseStatus">Nicht vorhanden</strong></div>
|
| 129 |
+
</div>
|
| 130 |
+
<div class="omega-track-table-wrap">
|
| 131 |
+
<table class="omega-track-table"><thead><tr><th>SPUR</th><th>QUELLE / METHODIK</th><th>STATUS</th><th>ROLLE IM MIX</th></tr></thead>
|
| 132 |
+
<tbody id="arrGraphTable"><tr><td colspan="4">Noch keine Audiospuren generiert.</td></tr></tbody></table>
|
| 133 |
+
</div>
|
| 134 |
+
<p class="omega-procedure-warning" id="arrOpsProgress" role="status">Neutraler Mix = Original · Störspur hörbar = Original; Mute = gezielte Reparatur · Originaldatei bleibt unverändert.</p>
|
| 135 |
+
</section>
|
| 136 |
+
|
| 137 |
<section class="arr-console arr-card">
|
| 138 |
<div class="arr-console-top">
|
| 139 |
<div class="arr-console-heading"><span class="arr-micro">MULTI-STEM WORKSPACE / MIXER</span><h2>Arrangement & Frequenzspuren</h2></div>
|
|
|
|
| 180 |
<p class="arr-disclaimer">Präzisionshinweis: Farbige Wellenformen sind Visualisierungen realer, geschätzter Stems; die Mini-KI liefert nur Textur-Hypothesen. Der Offline-Mix kann mit Filtern, Sättigung, Pan und Transposition hörbar vom Original abweichen und wird deshalb separat gerendert.</p>
|
| 181 |
</section>
|
| 182 |
|
| 183 |
+
<section id="view-studio" class="view" aria-label="Audio-Studio">
|
| 184 |
<div class="hero">
|
| 185 |
<div class="hero-copy">
|
| 186 |
<div class="kicker"><span class="kicker-dot"></span> INTELLIGENT AUDIO WORKSPACE <span class="kicker-index">/ 001</span></div>
|
app/unified.py
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""ABSOLUTION Ω — canonical, non-duplicating multitrack source graph.
|
| 2 |
+
|
| 3 |
+
Bass estimates and an explicitly approved click-difference become audible
|
| 4 |
+
lanes, NOT additional energy. A corresponding compensation is subtracted
|
| 5 |
+
from the underlying real stems. In neutral settings all lanes sum to the
|
| 6 |
+
original mixture up to the original separator's numeric error.
|
| 7 |
+
|
| 8 |
+
No model silently calls an estimate 'isolated instrument'.
|
| 9 |
+
"""
|
| 10 |
+
from __future__ import annotations
|
| 11 |
+
|
| 12 |
+
from contextlib import ExitStack
|
| 13 |
+
from pathlib import Path
|
| 14 |
+
import math
|
| 15 |
+
import os
|
| 16 |
+
import shutil
|
| 17 |
+
import uuid
|
| 18 |
+
|
| 19 |
+
import numpy as np
|
| 20 |
+
import soundfile as sf
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
TRACK_COLORS = {
|
| 24 |
+
"harmonic": "#8ea8ff", "percussive": "#ffbb79",
|
| 25 |
+
"residual": "#b9c0ce", "bass": "#46d8cc", "drums": "#ffc070",
|
| 26 |
+
"vocals": "#d7a4ff", "other": "#8ec7ff",
|
| 27 |
+
"kick_core": "#fa9e61", "bassline_core": "#68f0d3",
|
| 28 |
+
"noise_difference": "#f38ca6", "source_body": "#aab7d5",
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
def _entry(path: Path, root: Path, label: str, kind: str, description: str) -> dict:
|
| 33 |
+
info = sf.info(str(path))
|
| 34 |
+
return {
|
| 35 |
+
"master": path.relative_to(root).as_posix(),
|
| 36 |
+
"label": label, "role": kind,
|
| 37 |
+
"description": description, "color": TRACK_COLORS.get(path.stem, "#b5c1d8"),
|
| 38 |
+
"samplerate": info.samplerate, "channels": info.channels, "frames": info.frames,
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def build_unified_graph(project_folder: Path, manifest: dict, *, blocksize: int = 32768) -> dict | None:
|
| 43 |
+
"""Materialize canonical mix stems, streaming bounded-memory float WAV.
|
| 44 |
+
|
| 45 |
+
Derivative lanes are only available when their producer has actually run.
|
| 46 |
+
If base separation is missing, the original file is used as one source.
|
| 47 |
+
"""
|
| 48 |
+
asset = manifest.get("asset")
|
| 49 |
+
if not asset:
|
| 50 |
+
return None
|
| 51 |
+
bass = manifest.get("bass")
|
| 52 |
+
repair = (manifest.get("noise") or {}).get("repair")
|
| 53 |
+
if not bass and not repair:
|
| 54 |
+
return None
|
| 55 |
+
|
| 56 |
+
canonical = manifest.get("stems") or {}
|
| 57 |
+
base = {
|
| 58 |
+
name: project_folder / "stems" / item["master"]
|
| 59 |
+
for name, item in canonical.items()
|
| 60 |
+
} if canonical else {"source_body": project_folder / asset["stored_name"]}
|
| 61 |
+
root = project_folder.resolve()
|
| 62 |
+
original_path = project_folder / asset["stored_name"]
|
| 63 |
+
if not original_path.is_file():
|
| 64 |
+
raise FileNotFoundError("Original audio is missing.")
|
| 65 |
+
sources = dict(base)
|
| 66 |
+
additions = {}
|
| 67 |
+
|
| 68 |
+
if bass:
|
| 69 |
+
# These are RAW estimates. Never add the optimized full bass mix as a stem:
|
| 70 |
+
# it contains newly synthesized harmonics and overlaps the original.
|
| 71 |
+
bp = project_folder / "basscore" / bass["id"]
|
| 72 |
+
for name, key in (("kick_core", "kick_estimate"), ("bassline_core", "bassline_estimate")):
|
| 73 |
+
sources[name] = bp / bass["stems"][key]["master"]
|
| 74 |
+
additions[name] = True
|
| 75 |
+
if repair:
|
| 76 |
+
rp = project_folder / "noisecore" / repair["id"]
|
| 77 |
+
sources["noise_difference"] = rp / repair["tracks"]["difference"]["master"]
|
| 78 |
+
additions["noise_difference"] = True
|
| 79 |
+
|
| 80 |
+
info = sf.info(str(original_path))
|
| 81 |
+
if not (info.channels in (1, 2) and info.frames > 0):
|
| 82 |
+
raise ValueError("Unified graph supports valid mono/stereo PCM inputs.")
|
| 83 |
+
for k, path in sources.items():
|
| 84 |
+
other = sf.info(str(path))
|
| 85 |
+
if (other.frames, other.channels, other.samplerate) != (info.frames, info.channels, info.samplerate):
|
| 86 |
+
raise ValueError(f"Invalid length/channel/sample-rate for {k}")
|
| 87 |
+
# When bass comes from the canonical separator, return the two estimated
|
| 88 |
+
# sub-bands to their respective parent stems.
|
| 89 |
+
bassmode = (bass or {}).get("mode")
|
| 90 |
+
if not bass:
|
| 91 |
+
dest = {}
|
| 92 |
+
elif bassmode == "hpss" and {"harmonic", "percussive"}.issubset(base):
|
| 93 |
+
dest = {"kick_core": "percussive", "bassline_core": "harmonic"}
|
| 94 |
+
elif bassmode == "demucs" and {"bass", "drums"}.issubset(base):
|
| 95 |
+
dest = {"kick_core": "drums", "bassline_core": "bass"}
|
| 96 |
+
else:
|
| 97 |
+
dest = {n: "source_body" if "source_body" in base else
|
| 98 |
+
("harmonic" if "harmonic" in base else next(iter(base)))
|
| 99 |
+
for n in ("kick_core", "bassline_core")}
|
| 100 |
+
if repair:
|
| 101 |
+
dest["noise_difference"] = ("residual" if "residual" in base else
|
| 102 |
+
"other" if "other" in base else
|
| 103 |
+
"source_body" if "source_body" in base else next(iter(base)))
|
| 104 |
+
outfolder = project_folder / "unified" / uuid.uuid4().hex
|
| 105 |
+
outfolder.mkdir(parents=True, exist_ok=False)
|
| 106 |
+
labels = {
|
| 107 |
+
"harmonic": "Harmonische Basis · ohne Bassline",
|
| 108 |
+
"percussive": "Perkussive Basis · ohne Kick-Band",
|
| 109 |
+
"bass": "Bass-Basis · ohne Bassline-Band",
|
| 110 |
+
"drums": "Drums-Basis · ohne Kick-Band",
|
| 111 |
+
"other": "Andere Quellen",
|
| 112 |
+
"vocals": "Vocals",
|
| 113 |
+
"residual": "Residuum · differenzkompensiert",
|
| 114 |
+
"source_body": "Quellmix · verbleibender Körper",
|
| 115 |
+
"kick_core": "KICK · geschätztes Tiefband",
|
| 116 |
+
"bassline_core": "BASSLINE · geschätztes Tiefband",
|
| 117 |
+
"noise_difference": "STÖRSPUR · freigegebene Klick-Differenz",
|
| 118 |
+
}
|
| 119 |
+
roles = {n: "derived_bass" if n in ("kick_core", "bassline_core") else
|
| 120 |
+
"repair_difference" if n == "noise_difference" else "base_compensated"
|
| 121 |
+
for n in sources}
|
| 122 |
+
max_reconstruction_error = 0.
|
| 123 |
+
audio_peak = 0.
|
| 124 |
+
try:
|
| 125 |
+
with ExitStack() as stack:
|
| 126 |
+
readers = {name: stack.enter_context(sf.SoundFile(str(path), "r"))
|
| 127 |
+
for name, path in sources.items()}
|
| 128 |
+
original = stack.enter_context(sf.SoundFile(str(original_path), "r"))
|
| 129 |
+
writers = {
|
| 130 |
+
name: stack.enter_context(sf.SoundFile(
|
| 131 |
+
str(outfolder / f"{name}.wav"), "w", samplerate=info.samplerate,
|
| 132 |
+
channels=info.channels, subtype="FLOAT", format="WAV"
|
| 133 |
+
)) for name in sources
|
| 134 |
+
}
|
| 135 |
+
for start in range(0, info.frames, blocksize):
|
| 136 |
+
count = min(blocksize, info.frames-start)
|
| 137 |
+
chunks = {
|
| 138 |
+
name: rd.read(count, dtype="float64", always_2d=True)
|
| 139 |
+
for name, rd in readers.items()
|
| 140 |
+
}
|
| 141 |
+
for name in chunks:
|
| 142 |
+
if len(chunks[name]) != count or not np.isfinite(chunks[name]).all():
|
| 143 |
+
raise ValueError(f"Corrupt source chunk {name}")
|
| 144 |
+
for derivative, parent in dest.items():
|
| 145 |
+
chunks[parent] -= chunks[derivative]
|
| 146 |
+
# All recorded lanes are additive. No hidden gain normalization.
|
| 147 |
+
total = np.zeros((count, info.channels), dtype=np.float64)
|
| 148 |
+
for name, chunk in chunks.items():
|
| 149 |
+
writers[name].write(chunk)
|
| 150 |
+
total += chunk
|
| 151 |
+
source = original.read(count, dtype="float64", always_2d=True)
|
| 152 |
+
err = float(np.max(np.abs(source-total)))
|
| 153 |
+
max_reconstruction_error = max(max_reconstruction_error, err)
|
| 154 |
+
audio_peak = max(audio_peak, float(np.max(np.abs(source))))
|
| 155 |
+
# Browser-friendly listening previews, separate from unchanged Float32 masters.
|
| 156 |
+
stempeaks = {}
|
| 157 |
+
for name in sources:
|
| 158 |
+
with sf.SoundFile(str(outfolder / f"{name}.wav"), "r") as inp, \
|
| 159 |
+
sf.SoundFile(str(outfolder / f"{name}_preview.wav"), "w",
|
| 160 |
+
samplerate=info.samplerate, channels=info.channels,
|
| 161 |
+
subtype="PCM_16", format="WAV") as preview:
|
| 162 |
+
peak = 0.0
|
| 163 |
+
while True:
|
| 164 |
+
part = inp.read(blocksize, dtype="float64", always_2d=True)
|
| 165 |
+
if not len(part):
|
| 166 |
+
break
|
| 167 |
+
peak = max(peak, float(np.max(np.abs(part))))
|
| 168 |
+
preview.write(np.clip(part, -1, 1))
|
| 169 |
+
stempeaks[name] = peak
|
| 170 |
+
entries = {}
|
| 171 |
+
for name in sources:
|
| 172 |
+
meta = _entry(outfolder / f"{name}.wav", project_folder, labels.get(name, name),
|
| 173 |
+
roles[name],
|
| 174 |
+
"Estimated sub-band" if roles[name] == "derived_bass"
|
| 175 |
+
else "Approved noise difference; muting removes these changes" if name == "noise_difference"
|
| 176 |
+
else "Real source compensated to prevent double-counting.")
|
| 177 |
+
meta["color"] = TRACK_COLORS.get(name, "#9bb5cc")
|
| 178 |
+
# Conservative estimated visual-only peaks; signal is always verified by IO.
|
| 179 |
+
meta["duration_seconds"] = round(info.frames/info.samplerate, 4)
|
| 180 |
+
meta["peak_dbfs"] = round(20*math.log10(max(stempeaks[name],1e-12)),3)
|
| 181 |
+
meta["preview"] = (outfolder / f"{name}_preview.wav").relative_to(project_folder).as_posix()
|
| 182 |
+
entries[name] = meta
|
| 183 |
+
# Keep raw material and old unified exports until the graph was produced.
|
| 184 |
+
tol = max(5e-5, audio_peak * 2e-5)
|
| 185 |
+
graph = {
|
| 186 |
+
"stems": entries, "based_on_asset_sha256": asset["sha256"],
|
| 187 |
+
"mode": "additive_compensated_sources",
|
| 188 |
+
"mix_consistency_max_error": max_reconstruction_error,
|
| 189 |
+
"mix_consistency_tolerance": tol,
|
| 190 |
+
"mix_consistent": bool(max_reconstruction_error <= tol),
|
| 191 |
+
"bass_included": bool(bass), "noise_included": bool(repair),
|
| 192 |
+
"noise_default_mute": False,
|
| 193 |
+
"warnings": [
|
| 194 |
+
"Kick/Bassline are estimates, not perfectly isolated instruments.",
|
| 195 |
+
"NOISE is an approved repair difference, not generic ambient noise extraction.",
|
| 196 |
+
"NOISE is audible by default to preserve the original; explicitly muting it auditions the repaired mix.",
|
| 197 |
+
"Gain and effect changes can exceed 0 dBFS; review export peak."
|
| 198 |
+
],
|
| 199 |
+
}
|
| 200 |
+
if not graph["mix_consistent"]:
|
| 201 |
+
raise ValueError(
|
| 202 |
+
f"Graph is not mixture-consistent: error={max_reconstruction_error}, tol={tol}"
|
| 203 |
+
)
|
| 204 |
+
return graph
|
| 205 |
+
except Exception:
|
| 206 |
+
shutil.rmtree(outfolder, ignore_errors=True)
|
| 207 |
+
raise
|
docs/RELEASE_0.7.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ABSOLUTION Ω v0.7 — Unified Studio / Quality Gates
|
| 2 |
+
|
| 3 |
+
## Fehlermodus der v0.6-Architektur
|
| 4 |
+
|
| 5 |
+
`BASS-CORE` lieferte `kick_estimate` und `bassline_estimate` neben dem Basis-Mix,
|
| 6 |
+
`NOISE-CORE` eine Reparatur-Differenz. Blindes Addieren dieser Ausgaben zu den
|
| 7 |
+
bereits separierten Spuren hätte den Bass und einzelne Störimpulse verdoppelt.
|
| 8 |
+
|
| 9 |
+
## Neue additive, kompensierte Spur-Architektur
|
| 10 |
+
|
| 11 |
+
Für die Basisstems `S_i`, Bassanteile `K`, `B` und die manuell bestätigte
|
| 12 |
+
Reparatur-Differenz `N = x - clean` erstellt der Builder neue Stems `S'_i`,
|
| 13 |
+
indem er die abgeleiteten Anteile von den jeweiligen Elternstems subtrahiert.
|
| 14 |
+
|
| 15 |
+
`sum(S'_i) + K + B + N ~= x`.
|
| 16 |
+
|
| 17 |
+
Numerischer Gate: `max_abs_error <= max(5e-5, 2e-5 * peak(x))`. Ein nicht
|
| 18 |
+
bestandener Gate blockiert die Veröffentlichung des neuen Graphen.
|
| 19 |
+
|
| 20 |
+
Standardeinstellung für NOISE: **hörbar / nicht stumm**. Bei Stummschaltung:
|
| 21 |
+
`mix_without_noise = x - N = clean` (bei neutralen übrigen Mix-Reglern).
|
| 22 |
+
|
| 23 |
+
Bassline/Kick sind frequenzbasierte Schätzungen, nicht isolierte Instrumente.
|
| 24 |
+
Störspur basiert ausschließlich auf manueller Reparatur, nicht ungeprüfter KI.
|
| 25 |
+
|
| 26 |
+
## API
|
| 27 |
+
|
| 28 |
+
- `POST /api/v1/jobs/bass` erzeugt Bass-Signalanteile und baut den kanonischen Graphen
|
| 29 |
+
- `POST /api/v1/jobs/noise/scan` scannt nur und aktualisiert den Graphen bei alter Reparatur
|
| 30 |
+
- `POST /api/v1/jobs/noise/repair` erstellt freigegebene Differenz und baut Graphen neu
|
| 31 |
+
- `POST /api/v1/jobs/unify?project_id=<UUID>` synchronisiert vorhandene Projektdateien
|
| 32 |
+
- `GET /api/v1/projects/<UUID>/unified` Graphstatus, reale Spuren
|
| 33 |
+
- `GET /api/v1/projects/<UUID>/wave/<stem>` samplebasierte Visualisierung
|
| 34 |
+
- `GET /api/v1/projects/<UUID>/audio/<stem>?preview=true` echte Spur
|
| 35 |
+
- `POST /api/v1/jobs/mix` Offline-Float-WAV inklusive aller echten Spuren
|
| 36 |
+
|
| 37 |
+
## Tests
|
| 38 |
+
|
| 39 |
+
`python -m pytest -q`
|
| 40 |
+
|
| 41 |
+
Regressionen prüfen neutrale Mix-Rekonstruktion, stummgeschaltete Bass- und
|
| 42 |
+
Noise-Spuren, unveränderte Eingabedateien, Single-Source-Modus, echte API-Jobs
|
| 43 |
+
einschließlich HPSS → Bass → NOISE-Reparatur → Mix/Export.
|
| 44 |
+
|
| 45 |
+
## UI
|
| 46 |
+
|
| 47 |
+
Originales AURORA-inspiriertes CSS-Konzept: Glas, kühles Monitoring-Cyan, warme
|
| 48 |
+
BASS-Akzente, rosenfarbene Störspur, Instrument-/Diagnose-Tabelle.
|
| 49 |
+
Keine fremden Layoutdateien, Bilder oder Fonts übernommen.
|
| 50 |
+
Referenz: https://huggingface.co/spaces/2Btainment/einswarm-ui
|
| 51 |
+
|
| 52 |
+
Limitierung: Browser Testumgebung blockierte HTTP-Navigation zum lokalen
|
| 53 |
+
Server; die Oberfläche wurde offline mit produktionsgleichen Scripts und CSS
|
| 54 |
+
gerendert, echte Backend-Integration über FastAPI-TestClient geprüft.
|
pyproject.toml
CHANGED
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
| 4 |
|
| 5 |
[project]
|
| 6 |
name = "absolution-omega"
|
| 7 |
-
version = "0.
|
| 8 |
description = "Local-first audio workbench with multi-stem arrangement, synthetic mini tag model, BASS-CORE and NOISE-CORE."
|
| 9 |
requires-python = ">=3.11"
|
| 10 |
dependencies = [
|
|
|
|
| 4 |
|
| 5 |
[project]
|
| 6 |
name = "absolution-omega"
|
| 7 |
+
version = "0.7.0"
|
| 8 |
description = "Local-first audio workbench with multi-stem arrangement, synthetic mini tag model, BASS-CORE and NOISE-CORE."
|
| 9 |
requires-python = ">=3.11"
|
| 10 |
dependencies = [
|
tests/test_unified.py
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""v0.7 regressions: additional BASS/NOISE lanes must never double-count energy."""
|
| 2 |
+
import hashlib
|
| 3 |
+
import io
|
| 4 |
+
import time
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
|
| 7 |
+
import numpy as np
|
| 8 |
+
import pytest
|
| 9 |
+
import soundfile as sf
|
| 10 |
+
from fastapi.testclient import TestClient
|
| 11 |
+
|
| 12 |
+
from app.unified import build_unified_graph
|
| 13 |
+
from app.mixer import render_mix
|
| 14 |
+
from app.server import create_app
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
def write(path, samples, sr=8000):
|
| 18 |
+
path.parent.mkdir(parents=True, exist_ok=True)
|
| 19 |
+
sf.write(path, samples, sr, subtype="FLOAT", format="WAV")
|
| 20 |
+
return path
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
def fixtures(tmp):
|
| 24 |
+
sr=8000; t=np.arange(sr*2)/sr
|
| 25 |
+
harm=.11*np.sin(2*np.pi*90*t)
|
| 26 |
+
perc=np.zeros_like(harm);perc[::401]=.22
|
| 27 |
+
residue=.008*np.cos(2*np.pi*1733*t)
|
| 28 |
+
noise=np.zeros_like(harm);noise[778]=.065
|
| 29 |
+
stereo=lambda x:np.column_stack((x,x*.92)).astype("float32")
|
| 30 |
+
a,b,r,n=map(stereo,(harm,perc,residue,noise))
|
| 31 |
+
original=a+b+r
|
| 32 |
+
root=tmp/"project";root.mkdir()
|
| 33 |
+
write(root/"original.wav",original)
|
| 34 |
+
for name,x in [("harmonic",a),("percussive",b),("residual",r)]:
|
| 35 |
+
write(root/"stems"/f"{name}.wav",x)
|
| 36 |
+
# Emulate already computed BASS raw estimates. Enhanced bass mixes are excluded.
|
| 37 |
+
kick=b*.35
|
| 38 |
+
line=a*.42
|
| 39 |
+
write(root/"basscore"/"testbass"/"kick_estimate.wav",kick)
|
| 40 |
+
write(root/"basscore"/"testbass"/"bassline_estimate.wav",line)
|
| 41 |
+
write(root/"noisecore"/"testnoise"/"difference.wav",n)
|
| 42 |
+
asset_hash=hashlib.sha256((root/"original.wav").read_bytes()).hexdigest()
|
| 43 |
+
m={"asset":{"stored_name":"original.wav","sha256":asset_hash},
|
| 44 |
+
"stems":{n:{"master":f"{n}.wav"} for n in ("harmonic","percussive","residual")},
|
| 45 |
+
"bass":{"id":"testbass","mode":"hpss","stems":{
|
| 46 |
+
"kick_estimate":{"master":"kick_estimate.wav"},
|
| 47 |
+
"bassline_estimate":{"master":"bassline_estimate.wav"}}},
|
| 48 |
+
"noise":{"repair":{"id":"testnoise","tracks":{"difference":{"master":"difference.wav"}}}}}
|
| 49 |
+
return root,m,original,kick,line,n,asset_hash
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
def summed(root, graph, ignore=()):
|
| 53 |
+
return np.sum([sf.read(root/v["master"],always_2d=True)[0]
|
| 54 |
+
for name,v in graph["stems"].items() if name not in ignore], axis=0)
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
def test_combined_bass_noise_graph_preserves_original_and_tracks(tmp_path):
|
| 58 |
+
root,m,x,k,b,n,sha=fixtures(tmp_path)
|
| 59 |
+
graph=build_unified_graph(root,m,blocksize=1027)
|
| 60 |
+
assert graph["mix_consistent"]
|
| 61 |
+
assert graph["bass_included"] and graph["noise_included"]
|
| 62 |
+
assert set(graph["stems"])=={"harmonic","percussive","residual",
|
| 63 |
+
"kick_core","bassline_core","noise_difference"}
|
| 64 |
+
assert graph["mix_consistency_max_error"]<5e-7
|
| 65 |
+
assert np.max(np.abs(summed(root,graph)-x))<5e-7
|
| 66 |
+
assert np.max(np.abs(summed(root,graph,{"noise_difference"})-(x-n)))<5e-7
|
| 67 |
+
assert np.max(np.abs(summed(root,graph,{"kick_core"})-(x-k)))<5e-7
|
| 68 |
+
assert hashlib.sha256((root/"original.wav").read_bytes()).hexdigest()==sha
|
| 69 |
+
assert graph["noise_default_mute"] is False
|
| 70 |
+
assert all("preview" in v and (root/v["preview"]).is_file() for v in graph["stems"].values())
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
def test_mix_render_no_double_bass_or_noise(tmp_path):
|
| 74 |
+
root,m,x,k,b,n,_=fixtures(tmp_path)
|
| 75 |
+
graph=build_unified_graph(root,m)
|
| 76 |
+
sources={name:root/entry["master"] for name,entry in graph["stems"].items()}
|
| 77 |
+
out=root/"neutral.wav"
|
| 78 |
+
render_mix(sources,{"tracks":{}},out)
|
| 79 |
+
mix,_=sf.read(out,always_2d=True)
|
| 80 |
+
assert np.max(np.abs(mix-x))<5e-7
|
| 81 |
+
render_mix(sources,{"tracks":{"noise_difference":{"mute":True}}},out)
|
| 82 |
+
after,_=sf.read(out,always_2d=True)
|
| 83 |
+
assert np.max(np.abs(after-(x-n)))<5e-7
|
| 84 |
+
render_mix(sources,{"tracks":{"bassline_core":{"mute":True},"kick_core":{"mute":True}}},out)
|
| 85 |
+
after,_=sf.read(out,always_2d=True)
|
| 86 |
+
assert np.max(np.abs(after-(x-k-b)))<5e-7
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
def test_graph_for_only_noise_and_none(tmp_path):
|
| 90 |
+
root,m,x,k,b,n,_=fixtures(tmp_path)
|
| 91 |
+
m["bass"]=None
|
| 92 |
+
graph=build_unified_graph(root,m)
|
| 93 |
+
assert set(graph["stems"])=={"harmonic","percussive","residual","noise_difference"}
|
| 94 |
+
assert np.max(np.abs(summed(root,graph)-x))<5e-7
|
| 95 |
+
m["noise"]=None
|
| 96 |
+
assert build_unified_graph(root,m) is None
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
def test_graph_for_bass_without_separation(tmp_path):
|
| 100 |
+
root,m,x,k,b,n,_=fixtures(tmp_path)
|
| 101 |
+
m["stems"]={}
|
| 102 |
+
m["noise"]=None
|
| 103 |
+
m["bass"]["mode"]="dsp"
|
| 104 |
+
graph=build_unified_graph(root,m)
|
| 105 |
+
assert set(graph["stems"])=={"source_body","kick_core","bassline_core"}
|
| 106 |
+
assert np.max(np.abs(summed(root,graph)-x))<5e-7
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
def poll(client,jid):
|
| 110 |
+
for _ in range(250):
|
| 111 |
+
result=client.get("/api/v1/jobs/"+jid).json()
|
| 112 |
+
if result["status"] in ("done","failed"):return result
|
| 113 |
+
time.sleep(.04)
|
| 114 |
+
pytest.fail("Job timed out")
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
def test_unified_api_full_flow_bass_and_mixer(tmp_path):
|
| 118 |
+
root,m,x,k,b,n,_=fixtures(tmp_path)
|
| 119 |
+
# Real API path, real BASS-CORE algorithm. No model checkpoint required.
|
| 120 |
+
app=create_app(tmp_path/"runtime")
|
| 121 |
+
payload=io.BytesIO()
|
| 122 |
+
sf.write(payload,x,8000,format="WAV",subtype="FLOAT")
|
| 123 |
+
with TestClient(app) as client:
|
| 124 |
+
pid=client.post("/api/v1/projects",json={"name":"Unified"}).json()["id"]
|
| 125 |
+
response=client.post("/api/v1/assets",data={"project_id":pid},
|
| 126 |
+
files={"file":("demo.wav",payload.getvalue(),"audio/wav")})
|
| 127 |
+
assert response.status_code==201,response.text
|
| 128 |
+
bassjob=client.post("/api/v1/jobs/bass",json={
|
| 129 |
+
"project_id":pid, "source_mode":"dsp", "crossover_hz":150,
|
| 130 |
+
"harmonics":0, "wet":0}).json()
|
| 131 |
+
result=poll(client,bassjob["id"])
|
| 132 |
+
assert result["status"]=="done",result
|
| 133 |
+
manifest=client.get(f"/api/v1/projects/{pid}").json()
|
| 134 |
+
assert manifest["unified"]["mix_consistent"]
|
| 135 |
+
assert set(manifest["unified"]["stems"])=={"source_body","kick_core","bassline_core"}
|
| 136 |
+
for track in manifest["unified"]["stems"]:
|
| 137 |
+
assert client.get(f"/api/v1/projects/{pid}/wave/{track}").status_code==200
|
| 138 |
+
assert client.get(f"/api/v1/projects/{pid}/audio/{track}?preview=true").status_code==200
|
| 139 |
+
assert client.get(f"/api/v1/projects/{pid}/export").status_code==200
|
| 140 |
+
job=client.post("/api/v1/jobs/mix",json={"project_id":pid}).json()
|
| 141 |
+
assert poll(client,job["id"])["status"]=="done"
|
| 142 |
+
rendered=client.get(f"/api/v1/projects/{pid}/mixer/audio")
|
| 143 |
+
assert rendered.status_code==200
|
| 144 |
+
mixed,_=sf.read(io.BytesIO(rendered.content),always_2d=True)
|
| 145 |
+
assert np.max(np.abs(mixed-x))<2e-5
|
| 146 |
+
|
| 147 |
+
|
| 148 |
+
def test_full_api_hpss_bass_noise_repaired_additive(tmp_path):
|
| 149 |
+
"""Actual HPSS + BASS-CORE + manually approved NOISE-CORE on same source."""
|
| 150 |
+
t=np.arange(24000)/8000
|
| 151 |
+
wave=.09*np.sin(2*np.pi*73*t)+.033*np.sin(2*np.pi*512*t)
|
| 152 |
+
stereo=np.stack((wave,wave*.85),axis=1).astype("float32")
|
| 153 |
+
stereo[5017,:]+=.82
|
| 154 |
+
bio=io.BytesIO();sf.write(bio,stereo,8000,format="WAV",subtype="FLOAT")
|
| 155 |
+
app=create_app(tmp_path/"complete")
|
| 156 |
+
with TestClient(app) as client:
|
| 157 |
+
pid=client.post("/api/v1/projects",json={"name":"Full"}).json()["id"]
|
| 158 |
+
assert client.post("/api/v1/assets",data={"project_id":pid},
|
| 159 |
+
files={"file":("full.wav",bio.getvalue(),"audio/wav")}).status_code==201
|
| 160 |
+
run=client.post("/api/v1/jobs/separate",json={"project_id":pid,"model":"hpss"})
|
| 161 |
+
assert run.status_code==202,run.text
|
| 162 |
+
assert poll(client,run.json()["id"])["status"]=="done"
|
| 163 |
+
run=client.post("/api/v1/jobs/bass",json={
|
| 164 |
+
"project_id":pid,"source_mode":"auto", "crossover_hz":140,
|
| 165 |
+
"harmonics":0,"wet":0})
|
| 166 |
+
assert poll(client,run.json()["id"])["status"]=="done"
|
| 167 |
+
run=client.post("/api/v1/jobs/noise/scan",json={"project_id":pid})
|
| 168 |
+
assert poll(client,run.json()["id"])["status"]=="done"
|
| 169 |
+
scan=client.get(f"/api/v1/projects/{pid}/noise").json()["noise"]["scan"]
|
| 170 |
+
events=[z["sample"] for z in scan["events"]]
|
| 171 |
+
assert 5017 in events, events
|
| 172 |
+
run=client.post("/api/v1/jobs/noise/repair",json={
|
| 173 |
+
"project_id":pid,"approved_samples":[5017], "strength":.8})
|
| 174 |
+
assert poll(client,run.json()["id"])["status"]=="done"
|
| 175 |
+
manifest=client.get(f"/api/v1/projects/{pid}").json()
|
| 176 |
+
graph=manifest["unified"]
|
| 177 |
+
assert graph and graph["mix_consistent"],graph
|
| 178 |
+
assert len(graph["stems"])==6
|
| 179 |
+
run=client.post("/api/v1/jobs/mix",json={"project_id":pid})
|
| 180 |
+
assert poll(client,run.json()["id"])["status"]=="done"
|
| 181 |
+
wav=client.get(f"/api/v1/projects/{pid}/mixer/audio")
|
| 182 |
+
assert wav.status_code==200
|
| 183 |
+
reconstructed,_=sf.read(io.BytesIO(wav.content),always_2d=True)
|
| 184 |
+
assert np.max(np.abs(stereo-reconstructed))<5e-5
|
| 185 |
+
run=client.post("/api/v1/jobs/mix",json={
|
| 186 |
+
"project_id":pid,"tracks":{"noise_difference":{"mute":True}}})
|
| 187 |
+
assert poll(client,run.json()["id"])["status"]=="done"
|
| 188 |
+
clean,_=sf.read(io.BytesIO(client.get(
|
| 189 |
+
f"/api/v1/projects/{pid}/mixer/audio").content),always_2d=True)
|
| 190 |
+
difference=reconstructed-clean
|
| 191 |
+
assert np.max(np.abs(difference))>.1
|
| 192 |
+
mask=np.ones(len(difference),dtype=bool);mask[5017]=False
|
| 193 |
+
assert np.max(np.abs(difference[mask]))<2e-5
|