Skip to content

Commit f908966

Browse files
authored
refactor: rename two-stem complement output to backing across CLI, WASM, and web app (#61)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
1 parent 5ca589d commit f908966

8 files changed

Lines changed: 16 additions & 11 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
--two-stems-mix minus \
6363
fixtures/sine-10s.wav data/ci-output/native
6464
test -s data/ci-output/native/bass.wav
65-
test -s data/ci-output/native/no_bass.wav
65+
test -s data/ci-output/native/backing.wav
6666
6767
- run: pnpm build-wasm
6868

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pnpm model-release download models-2026-07-11 htdemucs_ft_bass
3939
pnpm cli-separate --name htdemucs_ft --two-stems bass --two-stems-mix minus data/input/song.wav data/output/song
4040
```
4141

42-
This creates `bass.wav` and `no_bass.wav`.
42+
This creates `bass.wav` and `backing.wav`.
4343

4444
Run the same separation flow through the Rust/WASM driver and
4545
`onnxruntime-web`'s Node WASM runtime with:

crates/cli/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ fn separate(args: SeparateArgs) -> Result<()> {
129129
complement,
130130
} => vec![
131131
(source.name().to_string(), target),
132-
(format!("no_{}", source.name()), complement),
132+
("backing".to_string(), complement),
133133
],
134134
};
135135
std::fs::create_dir_all(&args.out_dir)?;

crates/core/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ impl Source {
8383
}
8484

8585
/// What a separation yields, exactly; each track is stereo, `[channel][sample]`.
86-
/// How tracks are spelled (e.g. `no_bass.wav`) is the driver's concern.
86+
/// How tracks are spelled (e.g. `backing.wav`) is the driver's concern.
8787
pub enum Outputs {
8888
/// All four stems, in [`Source::ALL`] order.
8989
Full([[Vec<f32>; CHANNELS]; NUM_SOURCES]),

packages/app/e2e/preferences.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ test("restores and updates configuration preferences", async ({ page }) => {
1919
await expect(page.locator("#method")).toHaveValue("minus");
2020
await expect(page.locator("#method")).toBeEnabled();
2121
await expect(page.locator("#outputSummary")).toContainText(
22-
"Creates bass.wav and no_bass.wav.",
22+
"Creates bass.wav and backing.wav.",
2323
);
2424
await expect(page.locator("#shifts")).toHaveValue("3");
2525
await expect(page.getByLabel("Select htdemucs_ft_bass.onnx")).toBeAttached();

packages/app/src/app.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ export function App() {
355355
{twoStems ? (
356356
<>
357357
Creates <strong>{twoStems}.wav</strong> and{" "}
358-
<strong>no_{twoStems}.wav</strong>.
358+
<strong>backing.wav</strong>.
359359
</>
360360
) : (
361361
<>
@@ -481,7 +481,7 @@ export function App() {
481481
key={output.name}
482482
>
483483
<b className="text-xl font-semibold capitalize">
484-
{output.name}
484+
{stemLabel(output.name, twoStems)}
485485
</b>
486486
<audio
487487
className="col-span-full w-full"
@@ -505,6 +505,13 @@ export function App() {
505505
);
506506
}
507507

508+
function stemLabel(name: string, source: string | null): string {
509+
if (name === "backing" && source) {
510+
return `Backing track (without ${source})`;
511+
}
512+
return name;
513+
}
514+
508515
function ModelFileSlot({
509516
filename,
510517
ready,

packages/app/src/lib/audio/separate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ export async function separate(
152152
);
153153
const stemOrder: { name: string; index: number }[] = req.twoStems
154154
? [
155-
{ name: `no_${req.twoStems.source}`, index: 1 },
155+
{ name: "backing", index: 1 },
156156
{ name: req.twoStems.source, index: 0 },
157157
]
158158
: [

packages/app/src/node/cli.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,7 @@ async function main() {
154154
right,
155155
host,
156156
);
157-
const names = args.twoStems
158-
? [args.twoStems, `no_${args.twoStems}`]
159-
: SOURCES;
157+
const names = args.twoStems ? [args.twoStems, "backing"] : SOURCES;
160158
await mkdir(args.outDir, { recursive: true });
161159
for (const [index, name] of names.entries()) {
162160
const path = join(args.outDir, `${name}.wav`);

0 commit comments

Comments
 (0)