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.
Python apple-siliconaudio-generationclaude-codecudagame-audiomcpmcp-servermlxmusic-generationpytorchsound-effectsstable-audiowindows
Web UI: sun/moon theme toggle; select arrows inset from the edge (GAME-224)
Kanad65241df8140
diff --git a/src/audio_studio_mcp/static/app.css b/src/audio_studio_mcp/static/app.cssindex d2f7b74..4ee90c0 100644--- a/src/audio_studio_mcp/static/app.css+++ b/src/audio_studio_mcp/static/app.css@@ -93,7 +93,25 @@ textarea { resize: vertical; min-height: 64px; }input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }[aria-invalid="true"] { border-color: var(--danger) !important; }-.select-sm { width: auto; padding: 4px 6px; font-size: 12.5px; }+/* own chevron with room on the right (the native arrow sits against the edge) */+select {+ appearance: none; -webkit-appearance: none; padding-right: 30px; cursor: pointer;+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%23555e68' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");+ background-repeat: no-repeat; background-position: right 10px center; background-size: 12px;+}+:root[data-theme="dark"] select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%23a4acb5' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }+@media (prefers-color-scheme: dark) {+ :root:not([data-theme="light"]) select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%23a4acb5' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }+}+.select-sm { width: auto; padding: 5px 30px 5px 10px; font-size: 12.5px; background-position: right 9px center; }+.icon-btn {+ appearance: none; width: 32px; height: 30px; display: inline-flex; align-items: center; justify-content: center;+ border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); color: var(--text); cursor: pointer; padding: 0;+}+.icon-btn:hover { background: var(--surface-2); }+.icon-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }+.icon-btn .icon-moon { fill: currentColor; stroke: none; }+#theme[aria-pressed="true"] .icon-sun, #theme[aria-pressed="false"] .icon-moon { display: none; }.btn {appearance: none; font: inherit; font-weight: 550; border-radius: 6px; padding: 7px 14px; cursor: pointer;border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);diff --git a/src/audio_studio_mcp/static/app.js b/src/audio_studio_mcp/static/app.jsindex bcc3666..4ded559 100644--- a/src/audio_studio_mcp/static/app.js+++ b/src/audio_studio_mcp/static/app.js@@ -66,6 +66,7 @@ function applyI18n() {document.querySelectorAll("[data-i18n-title]").forEach((n) => { n.title = t(n.dataset.i18nTitle); });document.querySelectorAll("[data-i18n-aria-label]").forEach((n) => { n.setAttribute("aria-label", t(n.dataset.i18nAriaLabel)); });updateTypeUI();+ renderThemeButton();renderStatus();renderJobs();renderLibrary();@@ -156,14 +157,17 @@ document.addEventListener("keydown", (e) => {// ── theme / language settings ────────────────────────────────────────────────function initSettings() {- const theme = localStorage.getItem("as.theme") || "system";- $("#theme").value = theme;- $("#theme").addEventListener("change", (e) => {- const v = e.target.value;- if (v === "system") { delete document.documentElement.dataset.theme; localStorage.removeItem("as.theme"); }- else { document.documentElement.dataset.theme = v; localStorage.setItem("as.theme", v); }+ // Sun / moon toggle. Only a choice that differs from the system is saved, so+ // switching back to the system's look means "follow the system" again.+ const systemDark = matchMedia("(prefers-color-scheme: dark)");+ $("#theme").addEventListener("click", () => {+ const next = isDark() ? "light" : "dark";+ if ((next === "dark") === systemDark.matches) { delete document.documentElement.dataset.theme; localStorage.removeItem("as.theme"); }+ else { document.documentElement.dataset.theme = next; localStorage.setItem("as.theme", next); }+ renderThemeButton();window.dispatchEvent(new Event("as:theme"));});+ systemDark.addEventListener("change", renderThemeButton);const lang = localStorage.getItem("as.lang") || "auto";$("#lang").value = lang;state.lang = pickLang(lang);@@ -175,6 +179,17 @@ function initSettings() {});}+function isDark() {+ const forced = document.documentElement.dataset.theme;+ return forced ? forced === "dark" : matchMedia("(prefers-color-scheme: dark)").matches;+}+function renderThemeButton() {+ const b = $("#theme"), dark = isDark(), label = t(dark ? "settings.toLight" : "settings.toDark");+ b.setAttribute("aria-pressed", String(dark));+ b.setAttribute("aria-label", label);+ b.title = label;+}+// ── pages ────────────────────────────────────────────────────────────────────// Hash routes: #generate, #library, #edit/<file name>function showPage(name, push = true) {diff --git a/src/audio_studio_mcp/static/i18n.js b/src/audio_studio_mcp/static/i18n.jsindex 8b64240..832191d 100644--- a/src/audio_studio_mcp/static/i18n.js+++ b/src/audio_studio_mcp/static/i18n.js@@ -1,13 +1,13 @@// UI strings: English, Japanese, Simplified Chinese. {name} = placeholder.window.I18N = {en: {+ "settings.toDark": "Switch to dark mode", "settings.toLight": "Switch to light mode","nav.generate": "Generate", "nav.edit": "Edit", "nav.library": "Library","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",+ "settings.language": "Language", "settings.auto": "Auto","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",@@ -121,7 +121,6 @@ window.I18N = {"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",@@ -147,13 +146,13 @@ window.I18N = {"sum.fadeShort": "fade {a}/{b} ms (shortened to fit)",},ja: {+ "settings.toDark": "ダークモードに切り替え", "settings.toLight": "ライトモードに切り替え","nav.generate": "生成", "nav.edit": "編集", "nav.library": "ライブラリ","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": "ダーク",+ "settings.language": "言語", "settings.auto": "自動","gen.title": "新しい音", "gen.type": "何を作りますか?","type.music": "音楽", "type.instrument": "楽器ソロ/ループ", "type.sfx": "効果音", "type.raw": "Raw",@@ -267,7 +266,6 @@ window.I18N = {"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. 説明する",@@ -293,13 +291,13 @@ window.I18N = {"sum.fadeShort": "フェード {a}/{b} ms(長さに合わせて短縮)",},zh: {+ "settings.toDark": "切换到深色模式", "settings.toLight": "切换到浅色模式","nav.generate": "生成", "nav.edit": "编辑", "nav.library": "作品库","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": "深色",+ "settings.language": "语言", "settings.auto": "自动","gen.title": "新建声音", "gen.type": "想做什么?","type.music": "音乐", "type.instrument": "单乐器 / 循环", "type.sfx": "音效", "type.raw": "Raw",@@ -413,7 +411,6 @@ window.I18N = {"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. 描述",diff --git a/src/audio_studio_mcp/static/index.html b/src/audio_studio_mcp/static/index.htmlindex d666a81..cae93f9 100644--- a/src/audio_studio_mcp/static/index.html+++ b/src/audio_studio_mcp/static/index.html@@ -36,12 +36,11 @@<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.systemTheme">Theme: System</option>- <option value="light" data-i18n="settings.light">Light</option>- <option value="dark" data-i18n="settings.dark">Dark</option>- </select>+ <!-- sun / moon toggle: follows the system until clicked -->+ <button type="button" class="icon-btn" id="theme" aria-pressed="false">+ <svg class="icon-sun" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="4.2"/><path d="M12 2.5v2.2M12 19.3v2.2M2.5 12h2.2M19.3 12h2.2M5.3 5.3l1.6 1.6M17.1 17.1l1.6 1.6M5.3 18.7l1.6-1.6M17.1 6.9l1.6-1.6"/></svg>+ <svg class="icon-moon" viewBox="0 0 24 24" aria-hidden="true"><path d="M20.2 14.6A8.3 8.3 0 0 1 9.4 3.8a8.3 8.3 0 1 0 10.8 10.8z"/></svg>+ </button></div></header>diff --git a/tests/test_webui_browser.py b/tests/test_webui_browser.pyindex 3ffe786..75d1acf 100644--- a/tests/test_webui_browser.py+++ b/tests/test_webui_browser.py@@ -424,17 +424,25 @@ def test_languages_and_themes(web, browser, shots, lang, theme):def test_manual_theme_and_language_switch(web, browser):errors: list[str] = []page = _page(browser, web, "en", "light", errors)- page.select_option("#theme", "dark")+ assert page.get_attribute("#theme", "aria-label") == "Switch to dark mode"+ page.click("#theme") # sun → moonassert page.evaluate("document.documentElement.dataset.theme") == "dark"+ assert page.get_attribute("#theme", "aria-pressed") == "true"+ assert page.is_visible("#theme .icon-moon") and not page.is_visible("#theme .icon-sun")bg = page.evaluate("getComputedStyle(document.body).backgroundColor")page.select_option("#lang", "ja")assert page.text_content("#tab-library") == "ライブラリ"+ assert page.get_attribute("#theme", "aria-label") == "ライトモードに切り替え"page.reload() # both choices persistassert page.evaluate("document.documentElement.dataset.theme") == "dark"assert page.evaluate("getComputedStyle(document.body).backgroundColor") == bgassert page.text_content("#tab-library") == "ライブラリ"- page.select_option("#theme", "system")+ page.click("#theme") # back to the system's look = follow the system againpage.select_option("#lang", "auto")assert page.evaluate("document.documentElement.dataset.theme") is None+ assert page.evaluate("localStorage.getItem('as.theme')") is Noneassert page.text_content("#tab-library") == "Library"+ # selects keep their arrow away from the edge+ pad = page.evaluate("parseFloat(getComputedStyle(document.querySelector('#lang')).paddingRight)")+ assert pad >= 24assert not errors, errors