feat(douanier): /grade endpoint — the Foundry loop grader as a building block (#39)
Exposes the Foundry's mechanical loop-quality grader (the "katana") on /audio/v1/grade: upload a loop/one-shot → composite 0..1 + S/A/B/C/D tier, per-rule sub-scores (seam click, zero-crossing cleanliness, DC, bar self-consistency, level, bass mono-compat) + human-readable flags. scope `grade`, cached, torch-free. Directly serves "iterate on sampling quality". engines/grade.py is a BYTE-FOR-BYTE vendored copy of tools/foundry/engine/grade.py (self-contained — numpy/soundfile/pydantic/librosa, no Foundry/torch — because the container holds only armada/api/). It's kept identical on purpose, and tests/test_grade_endpoint.py is a DRIFT GUARD: it imports the Foundry canonical standalone and asserts the vendored copy grades identically (grade/tier/sub + WEIGHTS/THRESH) on a synth signal — a future Foundry tweak that isn't re-vendored fails CI here, not silently in prod (parsers-over-copy, applied to a vendored copy). Validated in the torch-free container (healthz engines now emotion/features/ samples/grade/separate; a sine tone grades D with a correct seam-click flag) + 43/43 tests. Note: this is the CPU-doable slice of #31's /loops /grade /correlate — the finder (/loops) and corpus correlation (/correlate) remain.
Showing
armada/api/engines/grade.py
0 → 100644
This diff is collapsed.
Click to expand it.
armada/api/tests/test_grade_endpoint.py
0 → 100644
Please
register
or
sign in
to comment