Skip to content

Local AI BGM and sound effects for Claude Code and any MCP client. Stable Audio 3 on Apple Silicon (MLX) and Windows NVIDIA GPUs (PyTorch). No cloud, no API key.

Web UI: usability review fixes (export length and fade limits, clearer AI actions, library titles and type filter, translations) (GAME-224)

Kanad68c2ced8989
diff --git a/src/audio_studio_mcp/static/app.css b/src/audio_studio_mcp/static/app.css
index d66baae..280fe03 100644
--- a/src/audio_studio_mcp/static/app.css
+++ b/src/audio_studio_mcp/static/app.css
@@ -120,7 +120,7 @@ main { max-width: 1280px; margin: 0 auto; padding: 20px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; border: 0; padding: 0; margin: 0; }
.field > label, .field > legend { font-weight: 550; font-size: 13px; padding: 0; }
.hint { margin: 0; color: var(--muted); font-size: 12.5px; }
-.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; align-items: start; }
+.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; align-items: end; }
.segmented { display: flex; border: 1px solid var(--border-strong); border-radius: 6px; overflow: hidden; }
.segmented label { flex: 1; position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
@@ -135,7 +135,11 @@ main { max-width: 1280px; margin: 0 auto; padding: 20px; }
.advanced > .field { margin-top: 10px; }
.form-error { margin: 0; padding: 8px 10px; border-radius: 6px; background: var(--danger-soft); color: var(--danger); white-space: pre-wrap; word-break: break-word; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
-.kbd-hint { margin-left: auto; }
+.kbd-hint { margin-left: 4px; }
+.clear-btn { margin-left: auto; color: var(--muted); }
+.steps { list-style: none; padding: 0; margin: 4px 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; width: 100%; text-align: left; }
+.steps li { display: flex; flex-direction: column; gap: 4px; padding: 12px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
+.steps strong { color: var(--text); }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
input.num { width: 96px; flex: none; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
@@ -239,7 +243,8 @@ input.num { width: 96px; flex: none; }
.item-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.item-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
-.item-prompt { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+.item-file { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+.lib-kinds { margin-top: 10px; }
.item-side { display: flex; flex-direction: column; gap: 6px; }
.item-details { grid-column: 1 / -1; margin: 6px 0 0; display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 12.5px; border-top: 1px solid var(--border); padding-top: 10px; }
.item-details dt { color: var(--muted); }
@@ -324,5 +329,5 @@ input[type="range"] { width: 100%; accent-color: var(--accent-bg); }
.check.disabled { color: var(--muted); cursor: not-allowed; }
.checks { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.summary { margin: 0; color: var(--muted); }
-#x-custom .row { margin-bottom: 10px; }
+#x-custom .row, #x-custom > .field { margin-bottom: 10px; }
@media (max-width: 560px) { .mode-cards { grid-template-columns: 1fr; } .wave-help { display: none; } }
diff --git a/src/audio_studio_mcp/static/app.js b/src/audio_studio_mcp/static/app.js
index 8dc2015..38062ec 100644
--- a/src/audio_studio_mcp/static/app.js
+++ b/src/audio_studio_mcp/static/app.js
@@ -10,7 +10,7 @@ const state = {
jobs: new Map(), // id -> job view from the server
expect: new Map(), // id -> audio seconds the job will produce (for the estimate)
polling: false,
- lib: { items: [], total: 0, query: "" },
+ lib: { items: [], total: 0, query: "", kind: "" },
};
const PAGE = 50;
const RESTORE_JOBS = 8;
@@ -69,7 +69,7 @@ function applyI18n() {
renderStatus();
renderJobs();
renderLibrary();
- renderStarters();
+ renderKinds();
Editor.applyI18n();
}
@@ -242,7 +242,7 @@ function updateDurationUI() {
$("#duration-hint").textContent = t("gen.durationHint", { def: d ?? "—", max });
const cur = input.value.trim() === "" ? d : Number(input.value);
$("#durations").replaceChildren(...DURATIONS[type].filter((s) => s <= max).map((s) =>
- el("button", { type: "button", class: "chip", "aria-pressed": String(cur === s), text: fmtLen(s),
+ el("button", { type: "button", class: "chip", "aria-pressed": String(cur === s), text: `${s} s`,
onclick: () => { input.value = s; updateDurationUI(); } })));
}
function updateTypeUI() {
@@ -377,7 +377,14 @@ function initForm() {
form().addEventListener("keydown", (e) => {
if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) { e.preventDefault(); form().requestSubmit(); }
});
- $("#gen-reset").addEventListener("click", () => { form().reset(); clearErrors(); updateTypeUI(); updateAdvancedDot(); });
+ $("#gen-reset").addEventListener("click", () => {
+ const saved = [...form().elements].filter((n) => n.name).map((n) => [n, n.type === "radio" || n.type === "checkbox" ? n.checked : n.value]);
+ form().reset(); clearErrors(); updateTypeUI(); updateAdvancedDot();
+ toast(t("toast.cleared"), { label: t("act.undo"), run: () => {
+ for (const [n, v] of saved) { if (n.type === "radio" || n.type === "checkbox") n.checked = v; else n.value = v; }
+ updateTypeUI(); updateAdvancedDot();
+ } });
+ });
$("#adv-reset").addEventListener("click", () => {
for (const k of ADV_FIELDS) field(k).value = "";
updateAdvancedDot();
@@ -385,16 +392,6 @@ function initForm() {
$("#unload").addEventListener("click", unloadModel);
}
-// Starter cards in the empty Results area: one click fills the form.
-function renderStarters() {
- const picks = [["sfx", EXAMPLES.sfx[0]], ["music", EXAMPLES.music[1]], ["instrument", EXAMPLES.instrument[0]]];
- $("#starters").replaceChildren(...picks.map(([type, ex]) => el("button", { type: "button", class: "starter-card",
- onclick: () => applyExample(type, ex) },
- el("span", { class: "badge", text: t(`type.${type}`) }),
- el("span", { class: "starter-name", text: t(`ex.${ex.key}`) }),
- el("span", { class: "muted small", text: fmtLen(ex.seconds) }))));
-}
-
// ── jobs ─────────────────────────────────────────────────────────────────────
function rates() { try { return JSON.parse(localStorage.getItem("as.rates") || "{}"); } catch { return {}; } }
function rateKey(job) { return `${job.tool}:${job.arguments.mode || ""}`; }
@@ -441,16 +438,15 @@ function candidateCard(c, i, job) {
const file = baseName(c.path), mini = new MiniWave(file, c.seconds);
const many = job.result.candidates.length > 1;
return el("div", { class: "cand", dataset: { index: i } },
- el("div", { class: "cand-head" },
- el("strong", { text: many ? t("cand.label", { n: LETTERS[i] || i + 1 }) : t("cand.single") }),
- c.seed != null ? el("span", { class: "muted", text: t("cand.seed", { seed: c.seed }) }) : null),
+ el("div", { class: "cand-head", title: c.seed != null ? t("cand.seed", { seed: c.seed }) : null },
+ el("strong", { text: many ? t("cand.label", { n: LETTERS[i] || i + 1 }) : t("cand.single") })),
mini.node,
el("div", { class: "cand-actions" },
el("button", { class: "btn btn-sm", type: "button", text: t("act.edit"), onclick: () => openEditor(file) }),
el("a", { class: "btn btn-sm btn-quiet", href: audioUrl(file, true), download: file, text: t("act.download") }),
moreMenu([
[t("act.copyPath"), () => copyText(c.path)],
- job.tool === "generate_audio" && c.seed != null ? [t("act.useSeed"), () => {
+ job.tool === "generate_audio" && c.seed != null ? [t("act.useSeed", { seed: c.seed }), () => {
field("seed").value = c.seed; $("#advanced").open = true; updateAdvancedDot(); showPage("generate");
toast(t("toast.seedSet", { seed: c.seed }));
}] : null,
@@ -651,7 +647,9 @@ function regenerate(item) {
}
function libraryItem(item) {
const m = item.meta || {};
- const title = m.title || item.file;
+ // what the sound is (title or prompt), not its long generated file name
+ const prompt = promptLabel({ prompt: m.prompt, ...prefixSound(m.sound_fields) }) || (m.source && m.source.prompt) || "";
+ const title = m.title || prompt || item.file;
// The form has no "raw" type, so only these can be regenerated faithfully.
const canRegen = m.kind === "generate" && m.seed != null && TYPES.includes(m.audio_type);
const details = el("dl", { class: "item-details", hidden: true },
@@ -667,15 +665,13 @@ function libraryItem(item) {
kind.startsWith("edit") ? t(`mode.${kind.split(":")[1]}`) : kind === "process" ? t("kind.process") : null,
kind === "process" || !m.kind ? item.format.toUpperCase() : null].filter(Boolean);
const mini = new MiniWave(item.file, item.seconds);
- const sub = promptLabel({ prompt: m.prompt, ...prefixSound(m.sound_fields) }) || (m.source && m.source.prompt) || "";
return el("article", { class: "panel item" },
el("div", { class: "item-main" },
- el("div", { class: "item-title", title: item.file, text: title }),
+ el("div", { class: "item-title", title: title, text: title }),
el("div", { class: "item-meta" },
badges.map((b) => el("span", { class: "badge", text: b })),
- el("span", { text: fmtDate(item.mtime) }),
- m.seed != null ? el("span", { text: t("cand.seed", { seed: m.seed }) }) : null),
- sub ? el("div", { class: "item-prompt", title: sub, text: sub }) : null),
+ el("span", { text: fmtDate(item.mtime) })),
+ el("div", { class: "item-file", title: item.path, text: item.file })),
el("div", { class: "item-side" },
mini.node,
el("div", { class: "item-actions" },
@@ -697,8 +693,9 @@ function renderLibrary() {
box.replaceChildren(...L.items.map(libraryItem));
$("#lib-count").textContent = t("lib.count", { n: L.total });
$("#lib-empty").hidden = L.items.length > 0;
- $("#lib-empty-text").textContent = L.query ? t("lib.noMatch", { q: L.query }) : t("lib.empty");
- $("#lib-empty-btn").textContent = L.query ? t("lib.clearSearch") : t("lib.generateFirst");
+ const filtered = L.query || L.kind;
+ $("#lib-empty-text").textContent = L.query ? t("lib.noMatch", { q: L.query }) : L.kind ? t("lib.noKind") : t("lib.empty");
+ $("#lib-empty-btn").textContent = filtered ? t("lib.clearSearch") : t("lib.generateFirst");
$("#lib-more").hidden = L.items.length >= L.total;
}
let libSeq = 0;
@@ -706,7 +703,7 @@ async function loadLibrary(reset) {
const L = state.lib, seq = ++libSeq;
const offset = reset ? 0 : L.items.length;
try {
- const r = await api(`/api/library?q=${encodeURIComponent(L.query)}&offset=${offset}&limit=${PAGE}`);
+ const r = await api(`/api/library?q=${encodeURIComponent(L.query)}&kind=${L.kind}&offset=${offset}&limit=${PAGE}`);
if (seq !== libSeq) return; // a newer search finished first
L.items = reset ? r.items : L.items.concat(r.items);
L.total = r.total;
@@ -717,6 +714,13 @@ async function loadLibrary(reset) {
}
renderLibrary();
}
+// Type filter chips above the library list.
+const LIB_KINDS = ["", "music", "instrument", "sfx", "edit", "process"];
+function renderKinds() {
+ $("#lib-kinds").replaceChildren(...LIB_KINDS.map((k) => el("button", { type: "button", class: "chip",
+ "aria-pressed": String(state.lib.kind === k), text: t(`lib.kind.${k || "all"}`),
+ onclick: () => { state.lib.kind = k; renderKinds(); loadLibrary(true); } })));
+}
function initLibrary() {
let timer;
$("#lib-search").addEventListener("input", (e) => {
@@ -726,7 +730,9 @@ function initLibrary() {
$("#lib-refresh").addEventListener("click", () => loadLibrary(true));
$("#lib-more").addEventListener("click", () => loadLibrary(false));
$("#lib-empty-btn").addEventListener("click", () => {
- if (state.lib.query) { $("#lib-search").value = ""; state.lib.query = ""; loadLibrary(true); }
+ if (state.lib.query || state.lib.kind) {
+ $("#lib-search").value = ""; state.lib.query = ""; state.lib.kind = ""; renderKinds(); loadLibrary(true);
+ }
else { showPage("generate"); $("#prompt").focus(); }
});
}
diff --git a/src/audio_studio_mcp/static/editor.js b/src/audio_studio_mcp/static/editor.js
index 7b8a896..c37ce8c 100644
--- a/src/audio_studio_mcp/static/editor.js
+++ b/src/audio_studio_mcp/static/editor.js
@@ -160,7 +160,7 @@ const Editor = {
$("#edit-name").textContent = m.title || this.file;
$("#edit-name").title = this.file;
const parts = [];
- if (this.seconds) parts.push(fmtClock(this.seconds, 1));
+ if (this.seconds) parts.push(this.fmt(this.seconds));
if (this.sampleRate) parts.push(`${(this.sampleRate / 1000).toFixed(1).replace(/\.0$/, "")} kHz`, this.channels === 1 ? t("edit.mono") : t("edit.stereo"));
if (m.audio_type) parts.push(t(`type.${m.audio_type}`));
if (m.kind) parts.push(kindLabel(m));
@@ -255,7 +255,7 @@ const Editor = {
for (let tk = Math.ceil(s / step) * step; tk <= e + 1e-9; tk += step) {
const x = Math.round(((tk - s) / span) * W) + 0.5;
ctx.beginPath(); ctx.moveTo(x, H - 6 * dpr); ctx.lineTo(x, H); ctx.stroke();
- ctx.fillText(fmtClock(tk, decimals), x + 3 * dpr, 2 * dpr);
+ ctx.fillText(this.seconds >= 60 ? fmtClock(tk, decimals) : tk.toFixed(decimals), x + 3 * dpr, 2 * dpr);
}
},
drawOverview() {
@@ -329,7 +329,7 @@ const Editor = {
}
$("#w-start").placeholder = "0.00";
$("#w-end").placeholder = this.seconds ? this.seconds.toFixed(2) : "";
- $("#w-len").textContent = s ? t("wave.length", { len: (s.b - s.a).toFixed(2) }) : t("wave.noSelection");
+ $("#w-len").textContent = s ? t("wave.length", { len: this.fmt(s.b - s.a) }) : t("wave.noSelection");
$("#w-sel-clear").disabled = !s;
$("#w-zoom-sel").disabled = !s;
},
@@ -466,7 +466,7 @@ const Editor = {
if (this.playhead > e || this.playhead < s) this.setView(this.playhead - span * 0.1, this.playhead + span * 0.9);
},
renderClock() {
- $("#w-clock").textContent = `${fmtClock(this.playhead, 1)} / ${fmtClock(this.seconds, 1)}`;
+ $("#w-clock").textContent = `${this.fmt(this.playhead, undefined, false)} / ${this.fmt(this.seconds)}`;
},
renderTransport() {
const playing = !this.audio.paused;
@@ -506,9 +506,23 @@ const Editor = {
clearErrors($("#export-form"), $("#x-error"));
this.updateAiForm();
},
- selText() {
- const d = this.seconds < 10 ? 2 : 1; // short sounds need finer times
- return this.sel ? `${fmtClock(this.sel.a, d)}–${fmtClock(this.sel.b, d)}` : "";
+ // Times as the selection fields show them: seconds under a minute, m:ss.d above.
+ fmt(sec, d = this.seconds < 10 ? 2 : 1, unit = true) {
+ if (this.seconds >= 60) return fmtClock(sec, d);
+ return `${sec.toFixed(d)}${unit ? " s" : ""}`;
+ },
+ selText() { return this.sel ? `${this.fmt(this.sel.a, undefined, false)}–${this.fmt(this.sel.b)}` : ""; },
+ outLen() {
+ const trim = this.xField("trim_selection").checked && this.sel;
+ let len = trim ? this.sel.b - this.sel.a : this.seconds;
+ if (this.xField("loop").checked) len -= Number(this.xField("loop_crossfade_ms").value) / 1000 || 0;
+ return Math.max(0, len);
+ },
+ // Fades never take more than a quarter of the output each (a 2 s fade on a 0.4 s clip silences it).
+ fades() {
+ const cap = (this.outLen() * 1000) / 4;
+ const fi = Number(this.xField("fade_in_ms").value) || 0, fo = Number(this.xField("fade_out_ms").value) || 0;
+ return { fi: Math.round(Math.min(fi, cap)), fo: Math.round(Math.min(fo, cap)), clamped: fi > cap || fo > cap };
},
updateAiForm() {
if (!$("#ai-form")) return;
@@ -527,7 +541,7 @@ const Editor = {
dur.min = String(Math.floor(this.seconds) + 1);
dur.max = String(this.max());
const target = parseFloat(dur.value);
- $("#extend-hint").textContent = t("edit.extendHint", { now: fmtClock(this.seconds, 1), max: this.max() });
+ $("#extend-hint").textContent = t("edit.extendHint", { now: this.fmt(this.seconds), max: this.max() });
const adds = [5, 10, 30, 60].filter((d) => this.seconds + d <= this.max());
$("#extend-chips").replaceChildren(...adds.map((d) => el("button", { type: "button", class: "chip",
"aria-pressed": String(Math.abs(target - Math.ceil(this.seconds + d)) < 0.01), text: `+${d} s`,
@@ -537,8 +551,17 @@ const Editor = {
btn.disabled = !this.file || (mode === "inpaint" && !this.sel);
if (mode === "variation") btn.textContent = n > 1 ? t("edit.submitVariationN", { n }) : t("edit.submitVariation");
else if (mode === "inpaint") btn.textContent = this.sel ? t("edit.submitInpaint", { range: this.selText() }) : t("mode.inpaint");
- else btn.textContent = t("edit.submitContinue", { len: target > 0 ? fmtClock(target) : "—" });
- if (n > 1 && mode !== "variation") btn.textContent += ` × ${n}`;
+ else btn.textContent = t("edit.submitContinue", { len: target > 0 ? `${target} s` : "—" });
+ if (n > 1 && mode !== "variation") btn.textContent += t("edit.nVersions", { n });
+ // AI edits of an export (mono, resampled, normalized) are better done on its original
+ const m = (this.item && this.item.meta) || {};
+ const exp = $("#export-note");
+ exp.hidden = !(m.kind === "process" && m.input_audio);
+ if (!exp.hidden) {
+ const orig = baseName(m.input_audio);
+ exp.replaceChildren(el("span", { text: t("edit.isExport") }), " ",
+ el("button", { type: "button", class: "link-btn", text: t("edit.openOriginal"), onclick: () => openEditor(orig) }));
+ }
},
async submitAi() {
const f = $("#ai-form"), mode = this.aiMode();
@@ -598,7 +621,9 @@ const Editor = {
},
setPreset(p) {
this.preset = p;
- const v = PRESETS[p];
+ let v = PRESETS[p];
+ // "keep as is" keeps the file's own rate when it is one we can write
+ if (p === "original" && [44100, 48000].includes(this.sampleRate)) v = { ...v, sample_rate: String(this.sampleRate) };
if (v) {
for (const [k, val] of Object.entries(v)) {
const fld = this.xField(k);
@@ -620,7 +645,9 @@ const Editor = {
const trim = this.xField("trim_selection");
trim.disabled = !this.sel;
if (!this.sel) trim.checked = false;
- $("#x-trim-sel-text").textContent = this.sel ? t("exp.trimSel", { range: this.selText() }) : t("exp.trimSelNone");
+ $("#x-trim-sel-text").textContent = this.sel
+ ? t("exp.trimSel", { range: this.selText(), len: this.fmt(this.sel.b - this.sel.a), total: this.fmt(this.seconds) })
+ : t("exp.trimSelNone");
$("#trim-sel-row").classList.toggle("disabled", !this.sel);
const norm = this.xField("normalize").value;
$("#x-lufs-field").hidden = norm !== "loudness";
@@ -633,11 +660,11 @@ const Editor = {
if (norm === "peak") parts.push(t("sum.peak", { db: this.xField("peak_ceiling_db").value }));
if (norm === "loudness") parts.push(t("sum.lufs", { lufs: this.xField("target_lufs").value }));
if (this.xField("loop").checked) parts.push(t("sum.loop", { ms: this.xField("loop_crossfade_ms").value }));
- const fi = Number(this.xField("fade_in_ms").value), fo = Number(this.xField("fade_out_ms").value);
- if (fi || fo) parts.push(t("sum.fade", { a: fi, b: fo }));
+ const { fi, fo, clamped } = this.fades();
+ if (fi || fo) parts.push(t(clamped ? "sum.fadeShort" : "sum.fade", { a: fi, b: fo }));
const fmt = String(this.xField("format").value).toUpperCase(), sr = Number(this.xField("sample_rate").value) / 1000;
parts.push(`${fmt} ${sr} kHz`);
- $("#x-summary").textContent = t("sum.prefix") + parts.join(" · ");
+ $("#x-summary").textContent = t("sum.prefix", { len: this.fmt(this.outLen()) }) + parts.join(" · ");
$("#x-submit").disabled = !this.file;
},
async submitExport() {
@@ -646,7 +673,7 @@ const Editor = {
const num = (k) => Number(this.xField(k).value);
const args = { input_audio: this.file, trim_silence: this.xField("trim_silence").checked, mono: this.xField("mono").checked,
normalize: this.xField("normalize").value, peak_ceiling_db: num("peak_ceiling_db"), loop: this.xField("loop").checked,
- fade_in_ms: num("fade_in_ms"), fade_out_ms: num("fade_out_ms"), format: this.xField("format").value,
+ fade_in_ms: this.fades().fi, fade_out_ms: this.fades().fo, format: this.xField("format").value,
sample_rate: num("sample_rate") };
if (args.normalize === "loudness") args.target_lufs = num("target_lufs");
if (args.loop) args.loop_crossfade_ms = num("loop_crossfade_ms");
diff --git a/src/audio_studio_mcp/static/i18n.js b/src/audio_studio_mcp/static/i18n.js
index 189aa2e..296b2fb 100644
--- a/src/audio_studio_mcp/static/i18n.js
+++ b/src/audio_studio_mcp/static/i18n.js
@@ -2,14 +2,14 @@
window.I18N = {
en: {
"nav.generate": "Generate", "nav.edit": "Edit", "nav.library": "Library",
- "status.unload": "Free memory", "status.unloadHint": "Unload the model now (it reloads on the next generation)",
+ "status.unload": "Unload model", "status.unloadHint": "Frees the 5–7 GB the model uses. It loads again on the next generation.",
"status.loaded": "Model ready", "status.notLoaded": "Model loads on first use", "status.working": "Working",
"status.offline": "Server unreachable", "status.unloaded": "Model unloaded, memory freed",
"status.nothingToUnload": "The model was not loaded",
"settings.language": "Language", "settings.auto": "Auto", "settings.theme": "Theme",
"settings.system": "System", "settings.light": "Light", "settings.dark": "Dark",
- "gen.title": "New sound", "gen.type": "What do you want to make?", "gen.typeShort": "Type",
+ "gen.title": "New sound", "gen.type": "What do you want to make?",
"type.music": "Music", "type.instrument": "Instrument loop", "type.sfx": "Sound effect", "type.raw": "Raw",
"type.musicHint": "Background music: a full track with several instruments.",
"type.instrumentHint": "One instrument or a short loop, e.g. a drum beat or a guitar phrase.",
@@ -38,12 +38,12 @@ window.I18N = {
"gen.advanced": "Advanced", "gen.modified": "Changed from the defaults", "gen.resetAdvanced": "Reset to defaults",
"adv.seed": "Seed", "adv.seedPh": "Random", "adv.cfg": "Prompt strength (CFG)", "adv.steps": "Steps",
"adv.ceiling": "Peak ceiling (dBFS)", "adv.negative": "Negative prompt", "adv.negativePh": "Qualities to avoid",
- "adv.hint": "The negative prompt only works when CFG is not 1. CFG 3–7 follows the prompt more closely but takes about twice as long.",
- "gen.submit": "Generate", "gen.submitN": "Generate {n} versions", "gen.reset": "Clear",
+ "adv.hint": "Steps: 8 is tuned for this model; more steps do not improve quality. The negative prompt only works when CFG is not 1; CFG 3–7 follows the prompt more closely but takes about twice as long.",
+ "gen.submit": "Generate", "gen.submitN": "Generate {n} versions", "gen.reset": "Clear form",
"gen.shortcut": "⌘/Ctrl + Enter",
"jobs.title": "Results", "jobs.empty": "Your sounds appear here.",
- "jobs.emptyHint": "Pick a starter below or write your own description. The first generation also loads the model, which takes a little longer.",
+ "jobs.emptyHint": "The first generation also loads the model, so it takes a little longer.",
"jobs.queued": "Waiting · #{n} in line", "jobs.loading": "Loading the model (first time only)… {t}",
"jobs.running": "Working… {t}", "jobs.runningEst": "Working… {t} / about {e}", "jobs.done": "Done in {t}",
"jobs.cancelled": "Cancelled", "jobs.error": "Failed",
@@ -51,7 +51,7 @@ window.I18N = {
"jobs.queueInfo": "{running} working · {queued} waiting", "jobs.exportOf": "Export of {file}",
"cand.label": "Version {n}", "cand.single": "Result", "cand.seed": "seed {seed}",
"cand.abHint": "Compare: press 1–4 to switch versions at the same moment",
- "act.edit": "Edit", "act.download": "Download", "act.copyPath": "Copy path", "act.useSeed": "Use this seed",
+ "act.edit": "Edit", "act.download": "Download", "act.copyPath": "Copy path", "act.useSeed": "Use seed {seed}",
"act.regen": "Regenerate (same seed)", "act.details": "Details", "act.hideDetails": "Hide details",
"act.more": "More actions", "act.cancel": "Cancel", "act.moreLike": "More like this",
"toast.copied": "Path copied", "toast.copyFailed": "Could not copy; select the path in Details", "toast.seedSet": "Seed {seed} set",
@@ -95,42 +95,67 @@ window.I18N = {
"edit.submitInpaint": "Replace {range}", "edit.submitContinue": "Extend to {len}",
"edit.results": "Results from this sound", "edit.noResults": "Edits and exports of this sound appear here.",
- "wave.loop": "Loop", "wave.zoom": "Zoom", "wave.zoomOut": "Zoom out", "wave.zoomIn": "Zoom in", "wave.fit": "Fit",
+ "wave.loop": "Loop", "wave.zoom": "Zoom", "wave.zoomOut": "Zoom out", "wave.zoomIn": "Zoom in", "wave.fit": "Show all",
"wave.zoomSel": "Zoom to selection", "wave.playhead": "Playhead", "wave.selStart": "Selection start",
"wave.selEnd": "Selection end", "wave.loading": "Loading waveform…", "wave.overview": "Overview: click or drag to move the view",
"wave.selection": "Selection", "wave.start": "Start", "wave.end": "End", "wave.selectAll": "Select all", "wave.clear": "Clear",
- "wave.length": "{len} s", "wave.noSelection": "None: the whole sound is used",
+ "wave.length": "{len}", "wave.noSelection": "None: the whole sound is used",
"wave.playSel": "Play selection",
- "wave.help": "Drag to select · Click to move · Space play · L loop · Ctrl/⌘+wheel zoom · Esc clear",
+ "wave.help": "Drag: select · Click: move · Shift+click: extend · Double-click: all · Space: play · L: loop · Ctrl/⌘+wheel: zoom · Esc: clear",
- "exp.purpose": "What is it for?", "exp.customize": "Customize",
+ "exp.purpose": "What is it for?", "exp.customize": "Adjust settings",
"exp.trimSilence": "Remove silence at the start and end", "exp.mono": "Mono (one channel)", "exp.loop": "Seamless loop",
"exp.volume": "Volume", "exp.volNone": "Keep as is", "exp.volPeak": "Peak (loudest point)", "exp.volLoud": "Loudness (LUFS)",
"exp.lufs": "Target (LUFS)", "exp.peak": "Peak limit (dBFS)", "exp.xfade": "Loop crossfade (ms)",
"exp.fadeIn": "Fade in (ms)", "exp.fadeOut": "Fade out (ms)", "exp.format": "Format", "exp.rate": "Sample rate",
"exp.namePh": "Automatic if empty", "exp.submit": "Export",
- "exp.trimSel": "Only the selection ({range})", "exp.trimSelNone": "Only the selection (drag on the waveform to select)",
+ "exp.trimSel": "Only the selection: {range} ({len} of {total})", "exp.trimSelNone": "Only the selection (drag on the waveform to select)",
"preset.game_sfx": "Game sound effect", "preset.game_loop": "Game music loop", "preset.video_bgm": "Video / YouTube",
- "preset.original": "Original quality", "preset.custom": "Custom",
+ "preset.original": "Keep as is (WAV)", "preset.custom": "Custom",
"preset.game_sfxDesc": "Silence trimmed, mono, peak at −1 dB, OGG 48 kHz — ready for Unity, Godot or Unreal.",
"preset.game_loopDesc": "Seamless loop, −16 LUFS, OGG 48 kHz. Set the loop flag in your engine.",
"preset.video_bgmDesc": "−14 LUFS (YouTube level), short fade in and out, WAV 48 kHz for video editors.",
- "preset.originalDesc": "Unchanged 44.1 kHz WAV; only peaks above −1 dB are turned down.",
+ "preset.originalDesc": "WAV at the file's sample rate, unchanged; only peaks above −1 dB are turned down.",
"preset.customDesc": "Your own settings below.",
- "sum.prefix": "Will export: ", "sum.trim": "selection {range}", "sum.silence": "trim silence", "sum.mono": "mono",
+ "sum.prefix": "Will export {len}: ", "sum.trim": "selection {range}", "sum.silence": "trim silence", "sum.mono": "mono",
"sum.peak": "peak {db} dB", "sum.lufs": "{lufs} LUFS", "sum.loop": "loop ({ms} ms crossfade)", "sum.fade": "fade {a}/{b} ms",
+ "settings.autoLang": "Language: Auto",
+ "settings.systemTheme": "Theme: System",
+ "toast.cleared": "Form cleared",
+ "act.undo": "Undo",
+ "steps.1": "1. Describe",
+ "steps.1d": "Pick a type, write a sentence or click an example on the left.",
+ "steps.2": "2. Generate",
+ "steps.2d": "Make 2–4 versions and compare them here.",
+ "steps.3": "3. Edit & export",
+ "steps.3d": "Fix a part, extend it, or export for a game or video.",
+ "lib.filter": "Filter by type",
+ "lib.kind.all": "All",
+ "lib.kind.music": "Music",
+ "lib.kind.instrument": "Instrument loops",
+ "lib.kind.sfx": "Sound effects",
+ "lib.kind.edit": "AI edits",
+ "lib.kind.process": "Exports",
+ "lib.noKind": "No sounds of this type yet.",
+ "edit.treatAs": "Treat as",
+ "edit.treatAsHint": "Tells the model what kind of sound this is.",
+ "edit.keepsOriginal": "Your original is kept. Results are saved as new files.",
+ "edit.isExport": "This is an exported file (possibly mono or resampled). AI edits sound better on the original.",
+ "edit.openOriginal": "Open the original",
+ "edit.nVersions": " · {n} versions",
+ "sum.fadeShort": "fade {a}/{b} ms (shortened to fit)",
},
ja: {
"nav.generate": "生成", "nav.edit": "編集", "nav.library": "ライブラリ",
- "status.unload": "メモリを解放", "status.unloadHint": "モデルを今すぐアンロードします(次の生成で再読み込み)",
+ "status.unload": "モデルを解放", "status.unloadHint": "モデルが使っている 5〜7 GB のメモリを解放します。次の生成でまた読み込みます。",
"status.loaded": "モデル準備完了", "status.notLoaded": "初回の生成時にモデルを読み込みます", "status.working": "処理中",
"status.offline": "サーバーに接続できません", "status.unloaded": "モデルをアンロードしてメモリを解放しました",
"status.nothingToUnload": "モデルは読み込まれていません",
"settings.language": "言語", "settings.auto": "自動", "settings.theme": "テーマ",
"settings.system": "システム", "settings.light": "ライト", "settings.dark": "ダーク",
- "gen.title": "新しい音", "gen.type": "何を作りますか?", "gen.typeShort": "種類",
- "type.music": "音楽", "type.instrument": "楽器・ループ", "type.sfx": "効果音", "type.raw": "Raw",
+ "gen.title": "新しい音", "gen.type": "何を作りますか?",
+ "type.music": "音楽", "type.instrument": "楽器ソロ/ループ", "type.sfx": "効果音", "type.raw": "Raw",
"type.musicHint": "BGM:複数の楽器による 1 曲。",
"type.instrumentHint": "単一の楽器や短いループ(ドラムビート、ギターのフレーズなど)。",
"type.sfxHint": "足音、衝撃音、UI 音、環境音など。",
@@ -158,12 +183,12 @@ window.I18N = {
"gen.advanced": "詳細設定", "gen.modified": "既定値から変更されています", "gen.resetAdvanced": "既定値に戻す",
"adv.seed": "シード", "adv.seedPh": "ランダム", "adv.cfg": "プロンプトの強さ(CFG)", "adv.steps": "ステップ数",
"adv.ceiling": "ピーク上限(dBFS)", "adv.negative": "ネガティブプロンプト", "adv.negativePh": "避けたい要素",
- "adv.hint": "ネガティブプロンプトは CFG が 1 以外のときだけ効きます。CFG 3〜7 はプロンプトに忠実になりますが、時間は約 2 倍かかります。",
- "gen.submit": "生成", "gen.submitN": "{n} バージョン生成", "gen.reset": "クリア",
+ "adv.hint": "ステップ数はこのモデル向けに 8 が最適で、増やしても品質は上がりません。ネガティブプロンプトは CFG が 1 以外のときだけ効きます。CFG 3〜7 はプロンプトに忠実になりますが、時間は約 2 倍かかります。",
+ "gen.submit": "生成", "gen.submitN": "{n} バージョン生成", "gen.reset": "フォームをクリア",
"gen.shortcut": "⌘/Ctrl + Enter",
"jobs.title": "結果", "jobs.empty": "作った音はここに表示されます。",
- "jobs.emptyHint": "下の例を選ぶか、説明を書いてみてください。初回はモデルの読み込みがあるため少し時間がかかります。",
+ "jobs.emptyHint": "初回の生成ではモデルの読み込みがあるため、少し時間がかかります。",
"jobs.queued": "待機中・{n} 番目", "jobs.loading": "モデルを読み込み中(初回のみ)… {t}",
"jobs.running": "処理中… {t}", "jobs.runningEst": "処理中… {t} / 約 {e}", "jobs.done": "完了({t})",
"jobs.cancelled": "キャンセルしました", "jobs.error": "失敗",
@@ -171,7 +196,7 @@ window.I18N = {
"jobs.queueInfo": "処理中 {running} 件・待機 {queued} 件", "jobs.exportOf": "{file} の書き出し",
"cand.label": "バージョン {n}", "cand.single": "結果", "cand.seed": "シード {seed}",
"cand.abHint": "聴き比べ:1〜4 キーで同じ位置のまま切り替え",
- "act.edit": "編集", "act.download": "ダウンロード", "act.copyPath": "パスをコピー", "act.useSeed": "このシードを使う",
+ "act.edit": "編集", "act.download": "ダウンロード", "act.copyPath": "パスをコピー", "act.useSeed": "シード {seed} を使う",
"act.regen": "同じシードで再生成", "act.details": "詳細", "act.hideDetails": "詳細を閉じる",
"act.more": "その他の操作", "act.cancel": "キャンセル", "act.moreLike": "似た音をもっと作る",
"toast.copied": "パスをコピーしました", "toast.copyFailed": "コピーできませんでした。詳細からパスを選択してください", "toast.seedSet": "シード {seed} を設定しました",
@@ -215,42 +240,67 @@ window.I18N = {
"edit.submitInpaint": "{range} を差し替え", "edit.submitContinue": "{len} まで延長",
"edit.results": "この音から作った結果", "edit.noResults": "この音の編集・書き出しの結果はここに表示されます。",
- "wave.loop": "ループ", "wave.zoom": "ズーム", "wave.zoomOut": "縮小", "wave.zoomIn": "拡大", "wave.fit": "全体",
- "wave.zoomSel": "選択範囲を拡大", "wave.playhead": "再生位置", "wave.selStart": "選択の開始",
+ "wave.loop": "ループ", "wave.zoom": "ズーム", "wave.zoomOut": "縮小", "wave.zoomIn": "拡大", "wave.fit": "全体を表示",
+ "wave.zoomSel": "選択範囲にズーム", "wave.playhead": "再生位置", "wave.selStart": "選択の開始",
"wave.selEnd": "選択の終了", "wave.loading": "波形を読み込み中…", "wave.overview": "全体図:クリックまたはドラッグで表示位置を移動",
"wave.selection": "選択範囲", "wave.start": "開始", "wave.end": "終了", "wave.selectAll": "すべて選択", "wave.clear": "解除",
- "wave.length": "{len} 秒", "wave.noSelection": "なし:音全体が対象になります",
+ "wave.length": "{len}", "wave.noSelection": "なし:音全体が対象になります",
"wave.playSel": "選択範囲を再生",
- "wave.help": "ドラッグで選択・クリックで移動・Space 再生・L ループ・Ctrl/⌘+ホイールでズーム・Esc で解除",
+ "wave.help": "ドラッグ:選択・クリック:移動・Shift+クリック:範囲を広げる・ダブルクリック:全選択・Space:再生・L:ループ・Ctrl/⌘+ホイール:ズーム・Esc:解除",
- "exp.purpose": "用途は?", "exp.customize": "カスタマイズ",
+ "exp.purpose": "用途は?", "exp.customize": "設定を調整",
"exp.trimSilence": "先頭と末尾の無音を削除", "exp.mono": "モノラル(1 チャンネル)", "exp.loop": "シームレスループ",
"exp.volume": "音量", "exp.volNone": "そのまま", "exp.volPeak": "ピーク(最大音量)", "exp.volLoud": "ラウドネス(LUFS)",
"exp.lufs": "目標(LUFS)", "exp.peak": "ピーク上限(dBFS)", "exp.xfade": "ループのクロスフェード(ms)",
"exp.fadeIn": "フェードイン(ms)", "exp.fadeOut": "フェードアウト(ms)", "exp.format": "形式", "exp.rate": "サンプルレート",
"exp.namePh": "空欄なら自動", "exp.submit": "書き出し",
- "exp.trimSel": "選択範囲だけ({range})", "exp.trimSelNone": "選択範囲だけ(波形をドラッグして選択)",
+ "exp.trimSel": "選択範囲だけ:{range}({total} 中 {len})", "exp.trimSelNone": "選択範囲だけ(波形をドラッグして選択)",
"preset.game_sfx": "ゲームの効果音", "preset.game_loop": "ゲームのループ BGM", "preset.video_bgm": "動画・YouTube",
- "preset.original": "元の品質", "preset.custom": "カスタム",
+ "preset.original": "そのまま(WAV)", "preset.custom": "カスタム",
"preset.game_sfxDesc": "無音カット・モノラル・ピーク −1 dB・OGG 48 kHz。Unity / Godot / Unreal にそのまま使えます。",
"preset.game_loopDesc": "シームレスループ・−16 LUFS・OGG 48 kHz。エンジン側でループ再生を有効にしてください。",
"preset.video_bgmDesc": "−14 LUFS(YouTube の基準)・短いフェードイン/アウト・動画編集向け WAV 48 kHz。",
- "preset.originalDesc": "44.1 kHz WAV のまま。−1 dB を超えるピークだけ下げます。",
+ "preset.originalDesc": "元のサンプルレートの WAV のまま。−1 dB を超えるピークだけ下げます。",
"preset.customDesc": "下の設定を自分で選びます。",
- "sum.prefix": "書き出し内容:", "sum.trim": "選択範囲 {range}", "sum.silence": "無音カット", "sum.mono": "モノラル",
+ "sum.prefix": "{len} を書き出し:", "sum.trim": "選択範囲 {range}", "sum.silence": "無音カット", "sum.mono": "モノラル",
"sum.peak": "ピーク {db} dB", "sum.lufs": "{lufs} LUFS", "sum.loop": "ループ(クロスフェード {ms} ms)", "sum.fade": "フェード {a}/{b} ms",
+ "settings.autoLang": "言語:自動",
+ "settings.systemTheme": "テーマ:システム",
+ "toast.cleared": "フォームをクリアしました",
+ "act.undo": "元に戻す",
+ "steps.1": "1. 説明する",
+ "steps.1d": "種類を選び、1 文書くか左の例をクリック。",
+ "steps.2": "2. 生成する",
+ "steps.2d": "2〜4 バージョン作ってここで聴き比べ。",
+ "steps.3": "3. 編集・書き出し",
+ "steps.3d": "一部を直す、延長する、ゲームや動画向けに書き出す。",
+ "lib.filter": "種類で絞り込み",
+ "lib.kind.all": "すべて",
+ "lib.kind.music": "音楽",
+ "lib.kind.instrument": "楽器ソロ/ループ",
+ "lib.kind.sfx": "効果音",
+ "lib.kind.edit": "AI 編集",
+ "lib.kind.process": "書き出し",
+ "lib.noKind": "この種類の音はまだありません。",
+ "edit.treatAs": "音の種類",
+ "edit.treatAsHint": "どんな種類の音かをモデルに伝えます。",
+ "edit.keepsOriginal": "元の音はそのまま残ります。結果は新しいファイルとして保存されます。",
+ "edit.isExport": "これは書き出したファイルです(モノラルやリサンプル済みの可能性あり)。AI 編集は元の音で行うほうがきれいです。",
+ "edit.openOriginal": "元の音を開く",
+ "edit.nVersions": "・{n} バージョン",
+ "sum.fadeShort": "フェード {a}/{b} ms(長さに合わせて短縮)",
},
zh: {
"nav.generate": "生成", "nav.edit": "编辑", "nav.library": "作品库",
- "status.unload": "释放内存", "status.unloadHint": "立即卸载模型(下次生成时会重新加载)",
+ "status.unload": "卸载模型", "status.unloadHint": "释放模型占用的 5–7 GB 内存,下次生成时会重新加载。",
"status.loaded": "模型已就绪", "status.notLoaded": "首次生成时加载模型", "status.working": "处理中",
"status.offline": "无法连接服务器", "status.unloaded": "已卸载模型并释放内存",
"status.nothingToUnload": "模型尚未加载",
"settings.language": "语言", "settings.auto": "自动", "settings.theme": "主题",
"settings.system": "跟随系统", "settings.light": "浅色", "settings.dark": "深色",
- "gen.title": "新建声音", "gen.type": "想做什么?", "gen.typeShort": "类型",
- "type.music": "音乐", "type.instrument": "乐器 / 循环", "type.sfx": "音效", "type.raw": "Raw",
+ "gen.title": "新建声音", "gen.type": "想做什么?",
+ "type.music": "音乐", "type.instrument": "单乐器 / 循环", "type.sfx": "音效", "type.raw": "Raw",
"type.musicHint": "背景音乐:多种乐器组成的完整曲子。",
"type.instrumentHint": "单一乐器或短循环,例如鼓点、吉他乐句。",
"type.sfxHint": "脚步声、撞击声、UI 音、环境音等。",
@@ -278,12 +328,12 @@ window.I18N = {
"gen.advanced": "高级参数", "gen.modified": "已修改默认值", "gen.resetAdvanced": "恢复默认",
"adv.seed": "种子", "adv.seedPh": "随机", "adv.cfg": "提示词强度(CFG)", "adv.steps": "步数",
"adv.ceiling": "峰值上限(dBFS)", "adv.negative": "反向提示词", "adv.negativePh": "想避免的元素",
- "adv.hint": "反向提示词只在 CFG 不等于 1 时生效。CFG 3–7 更贴合提示词,但耗时约为 2 倍。",
- "gen.submit": "生成", "gen.submitN": "生成 {n} 个版本", "gen.reset": "清空",
+ "adv.hint": "步数:8 是为该模型调好的值,增加步数不会提升质量。反向提示词只在 CFG 不等于 1 时生效;CFG 3–7 更贴合提示词,但耗时约为 2 倍。",
+ "gen.submit": "生成", "gen.submitN": "生成 {n} 个版本", "gen.reset": "清空表单",
"gen.shortcut": "⌘/Ctrl + Enter",
"jobs.title": "结果", "jobs.empty": "生成的声音会显示在这里。",
- "jobs.emptyHint": "选一个下面的示例,或自己写描述。第一次生成需要加载模型,会稍慢一些。",
+ "jobs.emptyHint": "第一次生成需要加载模型,会稍慢一些。",
"jobs.queued": "排队中 · 第 {n} 位", "jobs.loading": "正在加载模型(仅首次)… {t}",
"jobs.running": "处理中… {t}", "jobs.runningEst": "处理中… {t} / 约 {e}", "jobs.done": "完成({t})",
"jobs.cancelled": "已取消", "jobs.error": "失败",
@@ -291,7 +341,7 @@ window.I18N = {
"jobs.queueInfo": "处理中 {running} 个 · 排队 {queued} 个", "jobs.exportOf": "导出 {file}",
"cand.label": "版本 {n}", "cand.single": "结果", "cand.seed": "种子 {seed}",
"cand.abHint": "对比试听:按 1–4 在同一位置切换版本",
- "act.edit": "编辑", "act.download": "下载", "act.copyPath": "复制路径", "act.useSeed": "使用此种子",
+ "act.edit": "编辑", "act.download": "下载", "act.copyPath": "复制路径", "act.useSeed": "使用种子 {seed}",
"act.regen": "用同一种子重新生成", "act.details": "详情", "act.hideDetails": "收起详情",
"act.more": "更多操作", "act.cancel": "取消", "act.moreLike": "再来几个类似的",
"toast.copied": "已复制路径", "toast.copyFailed": "无法复制,请在详情中选中路径", "toast.seedSet": "已设置种子 {seed}",
@@ -335,29 +385,54 @@ window.I18N = {
"edit.submitInpaint": "替换 {range}", "edit.submitContinue": "延长到 {len}",
"edit.results": "由这个声音生成的结果", "edit.noResults": "这个声音的编辑和导出结果会显示在这里。",
- "wave.loop": "循环", "wave.zoom": "缩放", "wave.zoomOut": "缩小", "wave.zoomIn": "放大", "wave.fit": "全部",
- "wave.zoomSel": "放大选区", "wave.playhead": "播放位置", "wave.selStart": "选区开始",
+ "wave.loop": "循环", "wave.zoom": "缩放", "wave.zoomOut": "缩小", "wave.zoomIn": "放大", "wave.fit": "显示全部",
+ "wave.zoomSel": "缩放到选区", "wave.playhead": "播放位置", "wave.selStart": "选区开始",
"wave.selEnd": "选区结束", "wave.loading": "正在加载波形…", "wave.overview": "全局图:点击或拖动以移动视图",
"wave.selection": "选区", "wave.start": "开始", "wave.end": "结束", "wave.selectAll": "全选", "wave.clear": "取消选区",
- "wave.length": "{len} 秒", "wave.noSelection": "无:使用整个声音",
+ "wave.length": "{len}", "wave.noSelection": "无:使用整个声音",
"wave.playSel": "播放选区",
- "wave.help": "拖动选择 · 点击定位 · 空格播放 · L 循环 · Ctrl/⌘+滚轮缩放 · Esc 取消",
+ "wave.help": "拖动:选择 · 点击:定位 · Shift+点击:扩展选区 · 双击:全选 · 空格:播放 · L:循环 · Ctrl/⌘+滚轮:缩放 · Esc:取消",
- "exp.purpose": "用在哪里?", "exp.customize": "自定义",
+ "exp.purpose": "用在哪里?", "exp.customize": "调整参数",
"exp.trimSilence": "去掉开头和结尾的静音", "exp.mono": "单声道", "exp.loop": "无缝循环",
"exp.volume": "音量", "exp.volNone": "保持不变", "exp.volPeak": "峰值(最响处)", "exp.volLoud": "响度(LUFS)",
"exp.lufs": "目标(LUFS)", "exp.peak": "峰值上限(dBFS)", "exp.xfade": "循环交叉淡化(ms)",
"exp.fadeIn": "淡入(ms)", "exp.fadeOut": "淡出(ms)", "exp.format": "格式", "exp.rate": "采样率",
"exp.namePh": "留空则自动命名", "exp.submit": "导出",
- "exp.trimSel": "仅导出选区({range})", "exp.trimSelNone": "仅导出选区(在波形上拖动来选择)",
+ "exp.trimSel": "仅导出选区:{range}(共 {total},选中 {len})", "exp.trimSelNone": "仅导出选区(在波形上拖动来选择)",
"preset.game_sfx": "游戏音效", "preset.game_loop": "游戏循环音乐", "preset.video_bgm": "视频 / YouTube",
- "preset.original": "原始品质", "preset.custom": "自定义",
+ "preset.original": "保持原样(WAV)", "preset.custom": "自定义",
"preset.game_sfxDesc": "去静音、单声道、峰值 −1 dB、OGG 48 kHz,可直接用于 Unity / Godot / Unreal。",
"preset.game_loopDesc": "无缝循环、−16 LUFS、OGG 48 kHz。请在引擎中开启循环播放。",
"preset.video_bgmDesc": "−14 LUFS(YouTube 标准)、短淡入淡出、WAV 48 kHz,适合视频剪辑。",
- "preset.originalDesc": "保持 44.1 kHz WAV,只把超过 −1 dB 的峰值压下来。",
+ "preset.originalDesc": "保持原采样率的 WAV,只把超过 −1 dB 的峰值压下来。",
"preset.customDesc": "在下面自己设置。",
- "sum.prefix": "将导出:", "sum.trim": "选区 {range}", "sum.silence": "去静音", "sum.mono": "单声道",
+ "sum.prefix": "将导出 {len}:", "sum.trim": "选区 {range}", "sum.silence": "去静音", "sum.mono": "单声道",
"sum.peak": "峰值 {db} dB", "sum.lufs": "{lufs} LUFS", "sum.loop": "循环(交叉淡化 {ms} ms)", "sum.fade": "淡入淡出 {a}/{b} ms",
+ "settings.autoLang": "语言:自动",
+ "settings.systemTheme": "主题:跟随系统",
+ "toast.cleared": "已清空表单",
+ "act.undo": "撤销",
+ "steps.1": "1. 描述",
+ "steps.1d": "选择类型,写一句话或点左边的示例。",
+ "steps.2": "2. 生成",
+ "steps.2d": "生成 2–4 个版本,在这里对比试听。",
+ "steps.3": "3. 编辑与导出",
+ "steps.3d": "修改一段、延长,或导出给游戏和视频使用。",
+ "lib.filter": "按类型筛选",
+ "lib.kind.all": "全部",
+ "lib.kind.music": "音乐",
+ "lib.kind.instrument": "单乐器 / 循环",
+ "lib.kind.sfx": "音效",
+ "lib.kind.edit": "AI 编辑",
+ "lib.kind.process": "导出",
+ "lib.noKind": "还没有这种类型的声音。",
+ "edit.treatAs": "声音类型",
+ "edit.treatAsHint": "告诉模型这是什么类型的声音。",
+ "edit.keepsOriginal": "原声音会保留,结果另存为新文件。",
+ "edit.isExport": "这是导出的文件(可能是单声道或已重采样)。用原始声音做 AI 编辑效果更好。",
+ "edit.openOriginal": "打开原始声音",
+ "edit.nVersions": " · {n} 个版本",
+ "sum.fadeShort": "淡入淡出 {a}/{b} ms(已按长度缩短)",
},
};
diff --git a/src/audio_studio_mcp/static/index.html b/src/audio_studio_mcp/static/index.html
index 18eab3a..c0c5b59 100644
--- a/src/audio_studio_mcp/static/index.html
+++ b/src/audio_studio_mcp/static/index.html
@@ -31,14 +31,14 @@
<button class="btn btn-quiet btn-sm" id="unload" data-i18n="status.unload" data-i18n-title="status.unloadHint">Free memory</button>
<label class="sr-only" for="lang" data-i18n="settings.language">Language</label>
<select id="lang" class="select-sm">
- <option value="auto" data-i18n="settings.auto">Auto</option>
+ <option value="auto" data-i18n="settings.autoLang">Language: Auto</option>
<option value="ja">日本語</option>
<option value="en">English</option>
<option value="zh">简体中文</option>
</select>
<label class="sr-only" for="theme" data-i18n="settings.theme">Theme</label>
<select id="theme" class="select-sm">
- <option value="system" data-i18n="settings.system">System</option>
+ <option value="system" data-i18n="settings.systemTheme">Theme: System</option>
<option value="light" data-i18n="settings.light">Light</option>
<option value="dark" data-i18n="settings.dark">Dark</option>
</select>
@@ -126,8 +126,8 @@
<p class="form-error" id="form-error" role="alert" hidden></p>
<div class="actions">
<button type="submit" class="btn btn-primary btn-lg" id="gen-submit">Generate</button>
- <button type="button" class="btn btn-quiet" id="gen-reset" data-i18n="gen.reset">Clear</button>
<span class="kbd-hint muted small" data-i18n="gen.shortcut"></span>
+ <button type="button" class="link-btn clear-btn" id="gen-reset" data-i18n="gen.reset">Clear form</button>
</div>
</form>
@@ -139,8 +139,12 @@
<div id="jobs" class="jobs"></div>
<div class="empty-state" id="jobs-empty">
<p class="empty-title" data-i18n="jobs.empty">Your sounds appear here.</p>
+ <ol class="steps" id="steps">
+ <li><strong data-i18n="steps.1"></strong><span class="muted small" data-i18n="steps.1d"></span></li>
+ <li><strong data-i18n="steps.2"></strong><span class="muted small" data-i18n="steps.2d"></span></li>
+ <li><strong data-i18n="steps.3"></strong><span class="muted small" data-i18n="steps.3d"></span></li>
+ </ol>
<p class="muted small" data-i18n="jobs.emptyHint"></p>
- <div class="starter" id="starters"></div>
</div>
</div>
</section>
@@ -210,6 +214,7 @@
</div>
<form id="ai-form" class="form-body" role="tabpanel" aria-labelledby="st-ai" novalidate>
+ <p class="note warn" id="export-note" hidden></p>
<fieldset class="field">
<legend class="sr-only" data-i18n="edit.mode">Mode</legend>
<div class="mode-cards" id="mode-cards">
@@ -244,12 +249,13 @@
<div class="row">
<div class="field">
- <label for="ai-type" data-i18n="gen.typeShort">Type</label>
- <select id="ai-type" name="audio_type">
+ <label for="ai-type" data-i18n="edit.treatAs">Treat as</label>
+ <select id="ai-type" name="audio_type" aria-describedby="ai-type-hint">
<option value="music" data-i18n="type.music">Music</option>
<option value="instrument" data-i18n="type.instrument">Instrument</option>
<option value="sfx" data-i18n="type.sfx">Sound effect</option>
</select>
+ <p class="hint" id="ai-type-hint" data-i18n="edit.treatAsHint"></p>
</div>
<fieldset class="field">
<legend data-i18n="gen.variations">Versions</legend>
@@ -281,6 +287,7 @@
<p class="form-error" id="ai-error" role="alert" hidden></p>
<div class="actions"><button type="submit" class="btn btn-primary btn-lg" id="ai-submit"></button></div>
+ <p class="hint" data-i18n="edit.keepsOriginal"></p>
</form>
<form id="export-form" class="form-body" role="tabpanel" aria-labelledby="st-export" novalidate hidden>
@@ -299,15 +306,15 @@
<label class="check"><input type="checkbox" name="mono"><span data-i18n="exp.mono">Mono</span></label>
<label class="check"><input type="checkbox" name="loop"><span data-i18n="exp.loop">Seamless loop</span></label>
</div>
+ <div class="field">
+ <label for="x-normalize" data-i18n="exp.volume">Volume</label>
+ <select id="x-normalize" name="normalize">
+ <option value="none" data-i18n="exp.volNone">Keep as is</option>
+ <option value="peak" data-i18n="exp.volPeak">Peak (loudest point)</option>
+ <option value="loudness" data-i18n="exp.volLoud">Loudness (LUFS)</option>
+ </select>
+ </div>
<div class="row">
- <div class="field">
- <label for="x-normalize" data-i18n="exp.volume">Volume</label>
- <select id="x-normalize" name="normalize">
- <option value="none" data-i18n="exp.volNone">Keep as is</option>
- <option value="peak" data-i18n="exp.volPeak">Peak (loudest point)</option>
- <option value="loudness" data-i18n="exp.volLoud">Loudness (LUFS)</option>
- </select>
- </div>
<div class="field" id="x-lufs-field"><label for="x-lufs" data-i18n="exp.lufs">Target (LUFS)</label><input id="x-lufs" name="target_lufs" type="number" min="-40" max="-5" step="1"></div>
<div class="field"><label for="x-peak" data-i18n="exp.peak">Peak limit (dBFS)</label><input id="x-peak" name="peak_ceiling_db" type="number" min="-24" max="0" step="0.5"></div>
</div>
@@ -362,6 +369,7 @@
<button class="btn btn-quiet" id="lib-refresh" data-i18n="lib.refresh">Refresh</button>
<span class="muted small" id="lib-count"></span>
</div>
+ <div class="chips lib-kinds" id="lib-kinds" role="group" data-i18n-aria-label="lib.filter"></div>
<p class="muted small folder" id="lib-folder"></p>
<div id="library" class="library"></div>
<div class="empty-state" id="lib-empty" hidden>
diff --git a/src/audio_studio_mcp/static/wave.js b/src/audio_studio_mcp/static/wave.js
index d15b51f..4c86907 100644
--- a/src/audio_studio_mcp/static/wave.js
+++ b/src/audio_studio_mcp/static/wave.js
@@ -53,39 +53,44 @@ const Player = {
audio: new Audio(),
file: null,
owner: null, // the MiniWave currently loaded
+ prev: null, // the one before (to redraw it as stopped)
listeners: new Set(),
init() {
const a = this.audio;
a.preload = "auto";
- const tick = () => this.emit();
+ const tick = () => this.emit(false);
for (const ev of ["play", "pause", "ended", "timeupdate", "loadedmetadata", "seeked"]) a.addEventListener(ev, tick);
a.addEventListener("play", () => { this.raf(); window.dispatchEvent(new CustomEvent("as:play", { detail: "cards" })); });
window.addEventListener("as:play", (e) => { if (e.detail !== "cards") a.pause(); });
let rt; // redraw thumbnails after a resize or theme change
- const redraw = () => { clearTimeout(rt); rt = setTimeout(() => this.emit(), 100); };
+ const redraw = () => { clearTimeout(rt); rt = setTimeout(() => this.emit(true), 100); };
window.addEventListener("resize", redraw);
window.addEventListener("as:theme", redraw);
matchMedia("(prefers-color-scheme: dark)").addEventListener("change", redraw);
},
raf() {
if (this.audio.paused) return;
- this.emit();
+ this.emit(false);
requestAnimationFrame(() => this.raf());
},
- emit() { for (const f of this.listeners) f(); },
+ // all = every thumbnail (resize, theme); otherwise only the playing one and the previous one
+ emit(all) {
+ if (all) { for (const m of this.listeners) m.render(); return; }
+ for (const m of [this.owner, this.prev]) if (m) m.render();
+ },
async play(mini, at) {
const a = this.audio;
if (this.file !== mini.file) {
this.file = mini.file;
a.src = audioUrl(mini.file);
}
- this.owner = mini;
+ if (this.owner !== mini) { this.prev = this.owner; this.owner = mini; }
if (at != null) {
if (a.readyState < 1) await new Promise((r) => a.addEventListener("loadedmetadata", r, { once: true }));
a.currentTime = Math.min(at, (a.duration || at) - 0.01);
}
try { await a.play(); } catch { /* interrupted by another play() */ }
- this.emit();
+ this.emit(false);
},
pause() { this.audio.pause(); },
isPlaying(mini) { return this.owner === mini && !this.audio.paused; },
@@ -105,8 +110,7 @@ class MiniWave {
this.time = el("span", { class: "mini-time" });
this.node = el("div", { class: "mini-wave", dataset: { file } }, this.btn, this.track, this.time);
this.node.mini = this;
- this.update = () => this.render();
- Player.listeners.add(this.update);
+ Player.listeners.add(this);
MiniWave.observer.observe(this.node);
this.render();
}
@@ -135,20 +139,29 @@ class MiniWave {
e.preventDefault();
}
render() {
- if (!this.node.isConnected && this.drawn) { Player.listeners.delete(this.update); return; }
+ if (!this.node.isConnected) { // card removed from the page: forget it
+ if (this.attached) Player.listeners.delete(this);
+ return this.update();
+ }
+ this.attached = true;
+ this.update();
+ if (!this.peaks) return;
+ const now = Player.time(this);
+ const ctx = fitCanvas(this.cv);
+ ctx.clearRect(0, 0, this.cv.width, this.cv.height);
+ drawPeaks(ctx, this.peaks.min, this.peaks.max, {
+ color: cssVar("--wave"), played: cssVar("--wave-played"), split: this.seconds ? now / this.seconds : 0 });
+ }
+ // button, time and slider values (no drawing)
+ update() {
const playing = Player.isPlaying(this), now = Player.time(this);
this.btn.classList.toggle("playing", playing);
this.btn.setAttribute("aria-label", playing ? t("player.pause") : t("player.play"));
- this.time.textContent = Player.owner === this && now > 0 ? `${fmtClock(now)} / ${fmtClock(this.seconds)}` : fmtClock(this.seconds);
+ const f = (x) => (this.seconds < 60 ? `${x.toFixed(1)} s` : fmtClock(x)); // short sounds: tenths
+ this.time.textContent = Player.owner === this && now > 0 ? `${f(now)} / ${f(this.seconds)}` : f(this.seconds);
this.track.setAttribute("aria-valuemax", String(Math.round(this.seconds * 10) / 10));
this.track.setAttribute("aria-valuenow", String(Math.round(now * 10) / 10));
this.track.setAttribute("aria-valuetext", `${fmtClock(now)} / ${fmtClock(this.seconds)}`);
- if (!this.peaks || !this.node.isConnected) return;
- const ctx = fitCanvas(this.cv);
- ctx.clearRect(0, 0, this.cv.width, this.cv.height);
- drawPeaks(ctx, this.peaks.min, this.peaks.max, {
- color: cssVar("--wave"), played: cssVar("--wave-played"), split: this.seconds ? now / this.seconds : 0 });
- this.drawn = true;
}
}
MiniWave.observer = new IntersectionObserver((entries) => {
diff --git a/src/audio_studio_mcp/web.py b/src/audio_studio_mcp/web.py
index 4f8864d..79e277d 100644
--- a/src/audio_studio_mcp/web.py
+++ b/src/audio_studio_mcp/web.py
@@ -274,7 +274,20 @@ def _search_text(e: dict) -> str:
return " ".join(str(p) for p in parts if p is not None and p != "").lower()
-def list_library(query: str = "", offset: int = 0, limit: int = 100) -> dict:
+LIBRARY_KINDS = ("music", "instrument", "sfx", "edit", "process")
+
+
+def _kind_matches(e: dict, kind: str) -> bool:
+ m = e["meta"] or {}
+ k = str(m.get("kind") or "")
+ if kind == "edit":
+ return k.startswith("edit")
+ if kind == "process":
+ return k == "process"
+ return m.get("audio_type") == kind and k != "process"
+
+
+def list_library(query: str = "", offset: int = 0, limit: int = 100, kind: str = "") -> dict:
root = _output_dir()
files: list[tuple[Path, os.stat_result]] = []
try:
@@ -294,11 +307,11 @@ def list_library(query: str = "", offset: int = 0, limit: int = 100) -> dict:
if len(_entry_cache) > 2 * len(files) + 100:
_entry_cache.clear()
words = query.lower().split()
- if not words: # build entries for the requested page only
+ if not words and not kind: # build entries for the requested page only
return {"output_dir": str(root), "total": len(files),
"items": [_entry(p, st) for p, st in files[offset:offset + limit]]}
entries = [e for e in (_entry(p, st) for p, st in files)
- if all(w in _search_text(e) for w in words)]
+ if all(w in _search_text(e) for w in words) and (not kind or _kind_matches(e, kind))]
return {"output_dir": str(root), "total": len(entries), "items": entries[offset:offset + limit]}
@@ -483,7 +496,10 @@ async def api_library(request: Request) -> Response:
limit = min(500, max(1, int(q.get("limit", 100))))
except ValueError:
return _err(400, "offset/limit must be integers")
- return JSONResponse(await asyncio.to_thread(list_library, q.get("q", ""), offset, limit))
+ kind = q.get("kind", "")
+ if kind and kind not in LIBRARY_KINDS:
+ return _err(400, f"kind must be one of {', '.join(LIBRARY_KINDS)}")
+ return JSONResponse(await asyncio.to_thread(list_library, q.get("q", ""), offset, limit, kind))
async def api_library_item(request: Request) -> Response:
diff --git a/tests/test_web.py b/tests/test_web.py
index 8ea1475..a02905f 100644
--- a/tests/test_web.py
+++ b/tests/test_web.py
@@ -311,6 +311,20 @@ def test_library_search_and_paging(client, fake):
assert client.get("/api/library?limit=x").status_code == 400
+def test_library_kind_filter(client, fake):
+ out = _make_library(fake) # a.wav = generated sfx, b.flac = no sidecar
+ post.write(out / "c.wav", sine(0.2), 44100, "wav")
+ post.write_sidecar(out / "c.wav", {"kind": "edit:inpaint", "audio_type": "music"})
+ post.write(out / "d.ogg", sine(0.2), 44100, "ogg")
+ post.write_sidecar(out / "d.ogg", {"kind": "process", "source": {"audio_type": "sfx"}})
+ files = lambda k, q="": [i["file"] for i in client.get(f"/api/library?kind={k}&q={q}").json()["items"]]
+ assert files("sfx") == ["a.wav"]
+ assert files("music") == ["c.wav"] # an edit of music is still music
+ assert files("edit") == ["c.wav"] and files("process") == ["d.ogg"]
+ assert files("instrument") == [] and files("sfx", "rain") == ["a.wav"] and files("sfx", "nope") == []
+ assert client.get("/api/library?kind=video").status_code == 400
+
+
def test_library_survives_bad_sidecars_and_picks_up_new_ones(client, fake):
out = _make_library(fake)
(out / "b.flac.json").write_text("[1, 2]") # valid JSON, not an object
diff --git a/tests/test_webui_browser.py b/tests/test_webui_browser.py
index fdcf3d7..8eeb6d5 100644
--- a/tests/test_webui_browser.py
+++ b/tests/test_webui_browser.py
@@ -132,10 +132,15 @@ def test_empty_states(web, browser, shots):
"""Runs first, on an empty output folder: every page explains what to do."""
errors: list[str] = []
page = _page(browser, web, "en", "light", errors)
- page.wait_for_selector(".starter-card")
+ page.wait_for_selector("#steps li")
_check(page, "empty/generate")
page.screenshot(path=str(shots / "empty-generate.png"), full_page=True)
- page.locator(".starter-card").first.click()
+ page.click("#gen-form label:has(input[name=audio_type][value=sfx])")
+ page.click("#examples >> text=Glass breaking")
+ assert page.input_value("#sound_source") == "glass bottle"
+ page.click("#gen-reset") # clear, then undo from the toast
+ assert page.input_value("#sound_source") == ""
+ page.click("#toast >> text=Undo")
assert page.input_value("#sound_source") == "glass bottle"
assert page.is_checked("#gen-form input[name=audio_type][value=sfx]")
page.click("#tab-edit")
@@ -256,7 +261,8 @@ def test_editor_flow(web, browser, shots):
sel = page.evaluate("Editor.sel")
assert sel["a"] == pytest.approx(1.0, abs=0.05) and sel["b"] == pytest.approx(2.0, abs=0.05)
assert page.input_value("#w-start") == f"{sel['a']:.2f}"
- assert page.text_content("#ai-submit").startswith("Replace 0:01.0")
+ assert page.text_content("#ai-submit").startswith("Replace 1.0")
+ assert page.text_content("#ai-submit").endswith("· 2 versions")
# the numeric fields edit the selection too
page.fill("#w-start", "1.5")
page.press("#w-start", "Enter")
@@ -274,7 +280,7 @@ def test_editor_flow(web, browser, shots):
page.click("label.mode-card:has(input[value=continue])")
page.click("#extend-chips >> text=+5 s")
assert page.input_value("#ai-duration") == "9"
- assert page.text_content("#ai-submit").startswith("Extend to 0:09")
+ assert page.text_content("#ai-submit") == "Extend to 9 s · 2 versions"
# export the selection as a game sound effect
page.click("#st-export")
@@ -286,6 +292,19 @@ def test_editor_flow(web, browser, shots):
exp = page.evaluate("[...state.jobs.values()].find(j => j.tool === 'process_audio')")
assert exp["status"] == "done" and exp["result"]["format"] == "ogg" and exp["result"]["channels"] == 1
assert exp["result"]["seconds"] <= 1.5 + 0.01
+ # fades never swallow a short selection
+ page.fill("#w-start", "0.2")
+ page.press("#w-start", "Enter")
+ page.fill("#w-end", "0.6")
+ page.press("#w-end", "Enter")
+ page.click("label.preset:has(input[value=video_bgm])")
+ assert "shortened to fit" in page.text_content("#x-summary")
+ assert page.text_content("#x-summary").startswith("Will export 0.40 s")
+ page.click("#x-submit")
+ page.wait_for_function("[...state.jobs.values()].filter(j => j.tool === 'process_audio' && j.status === 'done').length === 2", timeout=10000)
+ vid = page.evaluate("[...state.jobs.values()].filter(j => j.tool === 'process_audio').sort((a, b) => b.created - a.created)[0]")
+ assert vid["arguments"]["fade_in_ms"] == 100 and vid["arguments"]["fade_out_ms"] == 100
+ assert vid["result"]["seconds"] == pytest.approx(0.4, abs=0.01)
# changing a detail switches the preset to Custom
page.click("#x-custom summary")
page.click("#export-form label.check:has(input[name=mono])")
@@ -295,7 +314,7 @@ def test_editor_flow(web, browser, shots):
page.click("#w-zoom-sel")
assert page.is_visible("#w-overview")
v = page.evaluate("Editor.view")
- assert v["s"] >= 1.4 and v["e"] <= 3.1
+ assert v["s"] >= 0.15 and v["e"] <= 0.65
for _ in range(6):
page.click("#w-zoom-in")
page.wait_for_function("Editor.detail !== null", timeout=5000)
@@ -317,6 +336,14 @@ def test_editor_flow(web, browser, shots):
assert not errors, errors
# a missing file falls back to the empty editor (the browser logs the 404)
+ # the library filters by type
+ page.click("#tab-library")
+ page.click("#lib-kinds >> text=Exports")
+ page.wait_for_function("document.querySelectorAll('.item').length === 2")
+ assert all(f.endswith(".ogg") or f.endswith(".wav") for f in page.locator(".item-file").all_text_contents())
+ page.click("#lib-kinds >> text=AI edits")
+ page.wait_for_function("document.querySelectorAll('.item').length === 2")
+ page.click("#lib-kinds >> text=All")
page.goto(web + "/#edit/missing.wav")
page.wait_for_selector("#edit-empty:not([hidden])")
page.wait_for_selector("#toast >> text=missing.wav is not in the output folder")