Skip to content

Commit e56ce34

Browse files
test: keep browser e2e app-focused
1 parent 5a0e8cc commit e56ce34

3 files changed

Lines changed: 10 additions & 47 deletions

File tree

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ jobs:
7070
7171
- run: |
7272
pnpm cli-separate-v2 \
73-
fixtures/sine-2s.wav data/output-split
74-
test -s data/output-split/drums.wav
75-
test -s data/output-split/bass.wav
76-
test -s data/output-split/other.wav
77-
test -s data/output-split/vocals.wav
73+
fixtures/sine-2s.wav data/ci-split-output
74+
test -s data/ci-split-output/drums.wav
75+
test -s data/ci-split-output/bass.wav
76+
test -s data/ci-split-output/other.wav
77+
test -s data/ci-split-output/vocals.wav
7878
7979
- run: pnpm build-wasm
8080

docs/split-dsp.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,12 @@ pnpm cli-separate-v2 fixtures/sine-2s.wav data/output-split
199199
- [x] Reuse the Rust DSP implementation and buffers in WASM.
200200
- [x] Pass waveform/spectrogram inputs and frequency/time outputs across the JS/WASM boundary.
201201
- [x] Remove `dft.bin` from recognized and required browser model files.
202-
- [x] Compare browser-generated stems with native split CLI stems in Playwright.
202+
- [x] Verify browser separation and downloadable stem output in Playwright.
203203

204204
The browser is hard-switched to split graphs; legacy browser model loading is not retained. Native
205-
CLI legacy support remains available for parity checks. Browser E2E verifies all four downloaded
206-
stems against native split output with `2e-3` max-absolute and `1e-7` MSE limits.
205+
CLI legacy support remains available for parity checks. Cross-runtime native/WASM numerical
206+
alignment is tracked separately in https://github.com/hi-ogawa/demucs-onnx/issues/56 rather than in
207+
app E2E.
207208

208209
### 5. Benchmark execution providers
209210

packages/app/e2e/separate.spec.ts

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,14 @@
1-
import { existsSync, readFileSync } from "node:fs";
1+
import { existsSync } from "node:fs";
22
import { resolve } from "node:path";
33
import { test, expect } from "@playwright/test";
44

55
const MODELS_DIR = resolve(import.meta.dirname, "../../../data/onnx-split");
66
const MODEL = resolve(MODELS_DIR, "htdemucs.onnx");
77
const FIXTURE = resolve(import.meta.dirname, "../../../fixtures/sine-2s.wav");
8-
const NATIVE_OUTPUT = resolve(
9-
import.meta.dirname,
10-
"../../../data/output-split",
11-
);
12-
13-
function readFloatWav(buffer: Buffer) {
14-
const dataOffset = buffer.indexOf("data") + 8;
15-
expect(dataOffset).toBeGreaterThan(7);
16-
const samples = new Float32Array((buffer.length - dataOffset) / 4);
17-
for (let index = 0; index < samples.length; index++) {
18-
samples[index] = buffer.readFloatLE(dataOffset + index * 4);
19-
}
20-
return samples;
21-
}
228

239
test("separates a clip fully client-side", async ({ page }) => {
2410
expect(existsSync(MODEL), `model missing at ${MODEL}`).toBe(true);
2511
expect(existsSync(FIXTURE), `fixture missing at ${FIXTURE}`).toBe(true);
26-
for (const name of ["drums", "bass", "other", "vocals"]) {
27-
expect(
28-
existsSync(resolve(NATIVE_OUTPUT, `${name}.wav`)),
29-
`native reference missing for ${name}`,
30-
).toBe(true);
31-
}
3212

3313
await page.goto("/");
3414
await page.setInputFiles("#modelFiles", MODEL);
@@ -54,24 +34,6 @@ test("separates a clip fully client-side", async ({ page }) => {
5434
await expect(stems).toHaveCount(4);
5535
for (const name of ["drums", "bass", "other", "vocals"]) {
5636
await expect(page.locator("#stems")).toContainText(name);
57-
const row = page.locator("#stems > div").filter({ hasText: name });
58-
const downloadPromise = page.waitForEvent("download");
59-
await row.getByRole("link", { name: "Download WAV" }).click();
60-
const download = await downloadPromise;
61-
const browser = readFloatWav(readFileSync((await download.path())!));
62-
const native = readFloatWav(
63-
readFileSync(resolve(NATIVE_OUTPUT, `${name}.wav`)),
64-
);
65-
expect(browser.length).toBe(native.length);
66-
let maxAbs = 0;
67-
let squaredError = 0;
68-
for (let index = 0; index < browser.length; index++) {
69-
const error = Math.abs(browser[index] - native[index]);
70-
maxAbs = Math.max(maxAbs, error);
71-
squaredError += error * error;
72-
}
73-
expect(maxAbs, `${name} max absolute error`).toBeLessThan(2e-3);
74-
expect(squaredError / browser.length, `${name} MSE`).toBeLessThan(1e-7);
7537
}
7638
await expect(page.locator("#stems audio")).toHaveCount(4);
7739
await expect(page.locator("#stems a")).toHaveCount(4);

0 commit comments

Comments
 (0)