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.

Windows: full-length generations, READMEs and real-GPU numbers

Kana75859e66c97b
diff --git a/README.ja.md b/README.ja.md
index 87f809b..492a657 100644
--- a/README.ja.md
+++ b/README.ja.md
@@ -5,6 +5,7 @@
<p>
<a href="LICENSE"><img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-6b4dff?style=flat-square"></a>
<img alt="macOS Apple Silicon" src="https://img.shields.io/badge/macOS-Apple_Silicon-111?style=flat-square&logo=apple">
+ <img alt="Windows NVIDIA GPU" src="https://img.shields.io/badge/Windows-NVIDIA_GPU-76b900?style=flat-square&logo=nvidia&logoColor=white">
<a href="https://modelcontextprotocol.io"><img alt="MCP server" src="https://img.shields.io/badge/MCP-server-19b8d6?style=flat-square"></a>
<img alt="Python 3.10 to 3.13" src="https://img.shields.io/badge/python-3.10–3.13-3776ab?style=flat-square&logo=python&logoColor=white">
<a href="https://github.com/kanaworksai-hue/audio-studio-mcp/actions/workflows/tests.yml"><img alt="Tests" src="https://img.shields.io/github/actions/workflow/status/kanaworksai-hue/audio-studio-mcp/tests.yml?style=flat-square&label=tests"></a>
@@ -19,7 +20,7 @@
</div>
-**Audio Studio MCP** は、Claude Code、Claude Desktop、Cursor など任意の [MCP](https://modelcontextprotocol.io) クライアントに、自分の Mac で動くサウンドスタジオを追加します。BGM や効果音を普通の言葉で頼むと、[Stable Audio 3](https://github.com/Stability-AI/stable-audio-3) がローカルで生成します。さらにループ化やラウドネス調整をして、ゲームエンジンや動画編集ソフト向けに書き出せます。クラウドサービスも API キーも不要で、生成にお金はかかりません。
+**Audio Studio MCP** は、Claude Code、Claude Desktop、Cursor など任意の [MCP](https://modelcontextprotocol.io) クライアントに、自分の Mac や Windows PC で動くサウンドスタジオを追加します。BGM や効果音を普通の言葉で頼むと、[Stable Audio 3](https://github.com/Stability-AI/stable-audio-3) がローカルで生成します。さらにループ化やラウドネス調整をして、ゲームエンジンや動画編集ソフト向けに書き出せます。クラウドサービスも API キーも不要で、生成にお金はかかりません。
<p align="center">
<img src="docs/assets/demo-ja.png" alt="実際の Claude Code セッション:1 回の依頼で lo-fi BGM を 2 候補作り、Godot 用のシームレスループ OGG を書き出す" width="820">
@@ -33,13 +34,13 @@
<td align="center" width="25%"><img src="docs/assets/icon-generate.png" width="72" alt=""><br><b>生成</b><br><sub>1 文から BGM、楽器ループ、効果音を生成。1 回で 1〜4 候補</sub></td>
<td align="center" width="25%"><img src="docs/assets/icon-edit.png" width="72" alt=""><br><b>編集</b><br><sub>全体のスタイル変換、指定区間の再生成、曲の延長</sub></td>
<td align="center" width="25%"><img src="docs/assets/icon-process.png" width="72" alt=""><br><b>仕上げ</b><br><sub>シームレスループ、フェード、ラウドネス(LUFS)、48 kHz WAV / OGG / FLAC</sub></td>
-<td align="center" width="25%"><img src="docs/assets/icon-local.png" width="72" alt=""><br><b>ローカル</b><br><sub>Apple Silicon 上で MLX により動作。アカウント登録もアップロードも不要</sub></td>
+<td align="center" width="25%"><img src="docs/assets/icon-local.png" width="72" alt=""><br><b>ローカル</b><br><sub>Apple Silicon(MLX)または NVIDIA GPU(PyTorch)で動作。何もアップロードしません</sub></td>
</tr>
</table>
- **再現できる:** すべてのファイルに、プロンプト・シード・設定を記録した `.json` が付きます。
- **プロンプト作りも任せられる:** サーバーが公式の Stable Audio 3 プロンプト形式をクライアントに伝えるので、「きしむドアの音」のような頼み方でも、モデルが理解できるプロンプトに書き換えられます。
-- **公式と同じ出力:** 同じシードなら、公式の `sa3` CLI とビット単位で同じ結果になります。
+- **公式と同じ出力:** Mac では、同じシードなら公式の `sa3` CLI とビット単位で同じ結果になります。Windows では公式の Stable Audio 3 PyTorch API をそのまま呼び出します。
## 🎧 サンプル
@@ -62,12 +63,14 @@ MP3 は [`docs/samples/`](docs/samples) に、プロンプトとシードは [`s
flowchart LR
U["あなた<br/>「カフェの BGM を作って」"] --> C["Claude Code · Desktop<br/>Cursor · 任意の MCP クライアント"]
C -- "MCP" --> S["audio-studio-mcp<br/>生成 · 編集 · 仕上げ"]
- S --> M["Stable Audio 3<br/>Apple Silicon 上の MLX"]
+ S --> M["Stable Audio 3<br/>Apple Silicon 上の MLX<br/>NVIDIA GPU 上の PyTorch"]
M --> F["WAV / OGG / FLAC + .json<br/>ゲームや動画にそのまま"]
```
## 🚀 クイックスタート
+### macOS(Apple Silicon)
+
**動作要件:**
- Apple Silicon Mac(M1 以降)、メモリ 16 GB 推奨
@@ -93,6 +96,29 @@ cd audio-studio-mcp
claude mcp add --scope user audio-studio -- /path/to/audio-studio-mcp/.venv/bin/audio-studio-mcp
```
+### Windows(NVIDIA GPU)
+
+**動作要件:**
+
+- 64 ビット版 Windows 10 / 11、NVIDIA GPU(VRAM 8 GB 以上)と新しめのドライバー。RTX 3060 12 GB で動作確認済み
+- モデルと PyTorch 用に約 14 GB のディスク容量
+- `git`(`winget install Git.Git`)と [`ffmpeg`](https://ffmpeg.org)(`winget install Gyan.FFmpeg`)
+- 無料の [Hugging Face](https://huggingface.co) アカウント。PyTorch 版の重みは利用規約への同意が必要です。[stabilityai/stable-audio-3-medium](https://huggingface.co/stabilityai/stable-audio-3-medium) を開き、一度ライセンスに同意してください
+
+```powershell
+git clone https://github.com/kanaworksai-hue/audio-studio-mcp.git
+cd audio-studio-mcp
+powershell -ExecutionPolicy Bypass -File install.ps1
+```
+
+インストーラーの流れは macOS と同じですが、CUDA 版の PyTorch を導入し、**medium** モデルの公式 PyTorch 版の重み(約 10.4 GB)をダウンロードします。Hugging Face にまだログインしていない場合は、read 権限のアクセストークンを貼り付けるよう求められます([ここで作成](https://huggingface.co/settings/tokens))。最後に登録用のコマンドが表示されます:
+
+```powershell
+claude mcp add --scope user audio-studio -- "C:\path\to\audio-studio-mcp\.venv\Scripts\audio-studio-mcp.exe"
+```
+
+Flash Attention は不要です。入っていない場合、ランタイムは PyTorch 標準のアテンションを使います。
+
<details>
<summary><b>Claude Desktop、Cursor などのクライアント</b></summary>
@@ -107,18 +133,20 @@ claude mcp add --scope user audio-studio -- /path/to/audio-studio-mcp/.venv/bin/
}
}
```
+
+Windows では command を `C:\\path\\to\\audio-studio-mcp\\.venv\\Scripts\\audio-studio-mcp.exe` にします(JSON ではバックスラッシュを 2 つ重ねます)。
</details>
<details>
<summary><b>インストーラーのオプション</b></summary>
-| オプション | 内容 |
-|---|---|
-| `--model all` | 小型で高速な `sm-music` と `sm-sfx` モデルも取得(+2.6 GB) |
-| `--skip-weights` | 今はダウンロードせず、最初の生成時にダウンロード |
-| `-y` | 確認なしで `uv` を導入 |
+| macOS | Windows | 内容 |
+|---|---|---|
+| `--model all` | `-Model all` | 小型で高速な `sm-music` と `sm-sfx` モデルも取得(macOS は +2.6 GB、Windows は +7 GB) |
+| `--skip-weights` | `-SkipWeights` | 今はダウンロードせず、最初の生成時にダウンロード |
+| `-y` | `-Yes` | 確認なしで `uv` を導入 |
-ダウンロードにログインは不要です。`hf auth login` でログインすると、Hugging Face の速度制限が緩くなります。
+macOS ではダウンロードにログインは不要で、`hf auth login` でログインすると Hugging Face の速度制限が緩くなります。Windows の PyTorch 版の重みは、ダウンロードするモデルごとにページでライセンスに同意し([medium](https://huggingface.co/stabilityai/stable-audio-3-medium)、[small-music](https://huggingface.co/stabilityai/stable-audio-3-small-music)、[small-sfx](https://huggingface.co/stabilityai/stable-audio-3-small-sfx))、ログインしておく必要があります。
</details>
> [!TIP]
@@ -162,9 +190,10 @@ claude mcp add --scope user audio-studio -- /path/to/audio-studio-mcp/.venv/bin/
| `AUDIO_STUDIO_OUTPUT_DIR` | `<repo>/outputs` | 音声の出力先 |
| `AUDIO_STUDIO_IDLE_UNLOAD_MIN` | `10` | 何分使われなかったらモデルを解放するか(`0` = 解放しない) |
| `AUDIO_STUDIO_SA3_MODEL` | `medium` | `medium`(最高品質、最長 380 秒)、`sm-music` または `sm-sfx`(小型・高速、最長 120 秒) |
-| `AUDIO_STUDIO_MLX_CACHE_GB` | `1` | MLX のバッファキャッシュ上限。設定しないと、長い曲の生成後に約 6 GB 余分に残ることがあります |
+| `AUDIO_STUDIO_MLX_CACHE_GB` | `1` | macOS:MLX のバッファキャッシュ上限。設定しないと、長い曲の生成後に約 6 GB 余分に残ることがあります |
+| `AUDIO_STUDIO_DEVICE` | CUDA があれば `cuda` | Windows/Linux:PyTorch のデバイス。`cuda`、`cuda:1`、`cpu` など |
| `AUDIO_STUDIO_SA3_DIR` | `<repo>/vendor/stable-audio-3` | 別の stable-audio-3 チェックアウトを使う |
-| `AUDIO_STUDIO_BACKEND` | `auto` | `auto` または `sa3-mlx` |
+| `AUDIO_STUDIO_BACKEND` | `auto` | `auto`、`sa3-mlx`(Apple Silicon)、`sa3-torch`(PyTorch、NVIDIA) |
| `AUDIO_STUDIO_FFMPEG` | `PATH` 上の `ffmpeg` | ffmpeg のパス |
`claude mcp add ... -e 名前=値` で渡すか、クライアント設定の `env` に書きます。
@@ -179,6 +208,8 @@ claude mcp add --scope user audio-studio -- /path/to/audio-studio-mcp/.venv/bin/
.venv/bin/audio-studio-mcp --http 8765 --preload
claude mcp add --scope user --transport http audio-studio http://127.0.0.1:8765/mcp
```
+
+Windows では `.venv\Scripts\audio-studio-mcp.exe --http 8765 --preload` で起動します。
</details>
## ⚡ パフォーマンス
@@ -192,7 +223,17 @@ M1 Mac 16 GB、medium モデル:
| 35 秒まで延長(エンコーダーの初回読み込みを含む) | 約 27 秒 |
| `sm-music` でウォーム、15 秒の音楽 | 約 1 秒 |
-モデルを読み込んでいる間は約 5〜7 GB のメモリを使います。アイドル時間の経過、または `unload_models` で解放されます。
+Windows + RTX 3060 12 GB、medium モデル:
+
+| 内容 | 所要時間 |
+|---|---|
+| コールドスタート、3 秒の効果音 × 2(約 20 秒のモデル読み込みを含む) | 約 25 秒 |
+| ウォーム、20 秒の音楽 | 約 1.3 秒 |
+| ウォーム、30 秒まで延長 | 約 2.2 秒 |
+| ウォーム、380 秒の音楽(最大) | 約 15 秒 |
+| `sm-music` でウォーム、15 秒の音楽 | 約 0.7 秒 |
+
+Mac ではモデルを読み込んでいる間、約 5〜7 GB のメモリを使います。RTX 3060 では medium モデルの VRAM 使用量のピークが約 5.3 GB でした。アイドル時間の経過、または `unload_models` で解放されます。
## 📝 プロンプトのコツ
@@ -217,7 +258,11 @@ M1 Mac 16 GB、medium モデル:
<details>
<summary><b>Windows、Linux、Intel Mac で動きますか?</b></summary>
-まだ動きません。現在は Apple Silicon Mac が必要です。モデルの実行部分はバックエンドとして分離してあり、NVIDIA GPU 向けの Windows バックエンドを予定しています。
+**Windows:** NVIDIA GPU があれば動きます。[クイックスタート](#windowsnvidia-gpu)を参照してください。
+
+**Linux:** NVIDIA GPU なら同じ PyTorch バックエンドで動くはずですが、未テストで、インストーラーもまだありません。上流のランタイムを `vendor/stable-audio-3` に(`install.sh` で固定しているコミットで)clone し、`uv sync --extra cuda` と `hf auth login` を実行してください。
+
+**Intel Mac と AMD GPU** には対応していません。
</details>
<details>
@@ -247,7 +292,7 @@ M1 Mac 16 GB、medium モデル:
## 🗺️ ロードマップ
- [x] Apple Silicon バックエンド(Stable Audio 3、MLX)
-- [ ] NVIDIA GPU 向けの Windows バックエンド
+- [x] NVIDIA GPU 向けの Windows バックエンド(Stable Audio 3、PyTorch)
- [ ] LoRA 対応(上流のランタイムは対応済み)
Issue やプルリクエストを歓迎します。
@@ -257,7 +302,7 @@ Issue やプルリクエストを歓迎します。
Audio Studio で作った音を実際に使ってもらえたなら、[リポジトリページ](https://github.com/kanaworksai-hue/audio-studio-mcp)上部の **⭐ Star** を押してもらえるとうれしいです。無料で 1 秒で終わりますが、効果は見た目以上です:
- **もっと多くの人に届きます。** Star が増えるほど GitHub 上で見つけてもらいやすくなり、ゲームや動画を作る人に広がります。
-- **更新の励みになります。** Star は「使っている人がいる」という何よりのサインです。次のアップデート(Windows バックエンドや LoRA 対応など)を進める力になります。
+- **更新の励みになります。** Star は「使っている人がいる」という何よりのサインです。次のアップデート(LoRA 対応など)を進める力になります。
ほかの応援方法:不具合やアイデアは [Issue](https://github.com/kanaworksai-hue/audio-studio-mcp/issues) へどうぞ。作った音を X でシェアして [@KanaWorks_AI](https://x.com/KanaWorks_AI) を付けてもらえるのも大歓迎です。
@@ -265,16 +310,19 @@ Audio Studio で作った音を実際に使ってもらえたなら、[リポジ
```bash
uv run pytest # オフラインテスト(モデル不要)
-.venv/bin/python scripts/smoke_test.py # 実モデルでのエンドツーエンドテスト(約 30 秒)
+.venv/bin/python scripts/smoke_test.py # 実モデルでのエンドツーエンドテスト(M1 で約 30 秒)
```
+Windows では `.venv\Scripts\python scripts\smoke_test.py`(RTX 3060 で約 45 秒、モデル読み込みを含む)。
+
```
src/audio_studio_mcp/
server.py MCP ツール(バックエンド非依存)
prompts.py プロンプトの組み立てと、クライアントに送る説明
post.py 後処理と書き出し
backends/base.py バックエンドのインターフェース
- backends/sa3_mlx.py Apple Silicon 上の Stable Audio 3
+ backends/sa3_mlx.py Apple Silicon 上の Stable Audio 3(MLX)
+ backends/sa3_torch.py NVIDIA GPU 上の Stable Audio 3(PyTorch)
```
新しいプラットフォームは、`backends/` にバックエンドとして追加します。
@@ -283,11 +331,11 @@ src/audio_studio_mcp/
- **このプロジェクト:** [MIT](LICENSE)
- **Stable Audio 3 ランタイム:** インストール時に `vendor/` へダウンロードされます。© Stability AI、MIT ライセンスです。
-- **モデルの重み:** [Stability AI Community License](https://huggingface.co/stabilityai/stable-audio-3-optimized) が適用されます。重みは Hugging Face からダウンロードされ、本プロジェクトでは配布していません。
+- **モデルの重み:** [Stability AI Community License](https://huggingface.co/stabilityai/stable-audio-3-optimized) が適用されます。重みは Hugging Face からダウンロードされ(macOS:`stable-audio-3-optimized`、Windows:`stable-audio-3-medium` と小型モデル)、本プロジェクトでは配布していません。
- **ブランド:** KanaWorks_AI の名称、ロゴ、Kana のキャラクターの権利は KanaWorks_AI に帰属し、MIT ライセンスの対象**外**です。詳しくは [docs/brand](docs/brand/README.md) を参照してください。
-- **使用している技術:** [Stable Audio 3](https://github.com/Stability-AI/stable-audio-3)、[MLX](https://github.com/ml-explore/mlx)、[Model Context Protocol](https://modelcontextprotocol.io)
+- **使用している技術:** [Stable Audio 3](https://github.com/Stability-AI/stable-audio-3)、[MLX](https://github.com/ml-explore/mlx)、[PyTorch](https://pytorch.org)、[Model Context Protocol](https://modelcontextprotocol.io)
-本プロジェクトは独立したプロジェクトであり、Stability AI、Apple、Anthropic とは関係がなく、その承認も受けていません。
+本プロジェクトは独立したプロジェクトであり、Stability AI、Apple、NVIDIA、Anthropic とは関係がなく、その承認も受けていません。
<br>
diff --git a/README.md b/README.md
index 05e74e6..8dd8c6b 100644
--- a/README.md
+++ b/README.md
@@ -5,6 +5,7 @@
<p>
<a href="LICENSE"><img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-6b4dff?style=flat-square"></a>
<img alt="macOS Apple Silicon" src="https://img.shields.io/badge/macOS-Apple_Silicon-111?style=flat-square&logo=apple">
+ <img alt="Windows NVIDIA GPU" src="https://img.shields.io/badge/Windows-NVIDIA_GPU-76b900?style=flat-square&logo=nvidia&logoColor=white">
<a href="https://modelcontextprotocol.io"><img alt="MCP server" src="https://img.shields.io/badge/MCP-server-19b8d6?style=flat-square"></a>
<img alt="Python 3.10 to 3.13" src="https://img.shields.io/badge/python-3.10–3.13-3776ab?style=flat-square&logo=python&logoColor=white">
<a href="https://github.com/kanaworksai-hue/audio-studio-mcp/actions/workflows/tests.yml"><img alt="Tests" src="https://img.shields.io/github/actions/workflow/status/kanaworksai-hue/audio-studio-mcp/tests.yml?style=flat-square&label=tests"></a>
@@ -19,7 +20,7 @@
</div>
-**Audio Studio MCP** gives Claude Code, Claude Desktop, Cursor and any other [MCP](https://modelcontextprotocol.io) client a sound studio that runs on your own Mac. Ask for background music or a sound effect in plain language; the model generates it locally with [Stable Audio 3](https://github.com/Stability-AI/stable-audio-3). Then it can loop it, normalize the loudness and export it for your game engine or video editor. There is no cloud service and no API key, and generating doesn't cost anything.
+**Audio Studio MCP** gives Claude Code, Claude Desktop, Cursor and any other [MCP](https://modelcontextprotocol.io) client a sound studio that runs on your own Mac or Windows PC. Ask for background music or a sound effect in plain language; the model generates it locally with [Stable Audio 3](https://github.com/Stability-AI/stable-audio-3). Then it can loop it, normalize the loudness and export it for your game engine or video editor. There is no cloud service and no API key, and generating doesn't cost anything.
<p align="center">
<img src="docs/assets/demo-en.png" alt="A real Claude Code session: one request produces two lo-fi BGM candidates and a seamless OGG loop for Godot" width="820">
@@ -33,13 +34,13 @@
<td align="center" width="25%"><img src="docs/assets/icon-generate.png" width="72" alt=""><br><b>Generate</b><br><sub>BGM, instrument loops and sound effects from one sentence, 1–4 candidates per call</sub></td>
<td align="center" width="25%"><img src="docs/assets/icon-edit.png" width="72" alt=""><br><b>Edit</b><br><sub>Re-style a whole clip, regenerate a time range, or extend a track</sub></td>
<td align="center" width="25%"><img src="docs/assets/icon-process.png" width="72" alt=""><br><b>Finish</b><br><sub>Seamless loops, fades, loudness (LUFS), 48 kHz WAV / OGG / FLAC</sub></td>
-<td align="center" width="25%"><img src="docs/assets/icon-local.png" width="72" alt=""><br><b>Local</b><br><sub>Runs on Apple Silicon with MLX. No account or upload needed</sub></td>
+<td align="center" width="25%"><img src="docs/assets/icon-local.png" width="72" alt=""><br><b>Local</b><br><sub>Runs on Apple Silicon (MLX) or an NVIDIA GPU (PyTorch). Nothing is uploaded</sub></td>
</tr>
</table>
- **Reproducible:** every file gets a `.json` sidecar with its prompt, seed and settings.
- **Prompting built in:** the server teaches the client the official Stable Audio 3 prompt format, so a request like "make it sound like a creaky door" becomes a prompt the model understands.
-- **Same output as upstream:** for the same seed, results are bit-for-bit identical to the official `sa3` CLI.
+- **Same output as upstream:** on a Mac, results for the same seed are bit-for-bit identical to the official `sa3` CLI. On Windows it calls the official Stable Audio 3 PyTorch API.
## 🎧 Hear it
@@ -62,12 +63,14 @@ MP3s are in [`docs/samples/`](docs/samples), with prompts and seeds in [`samples
flowchart LR
U["You<br/>“make a cozy cafe BGM”"] --> C["Claude Code · Desktop<br/>Cursor · any MCP client"]
C -- "MCP" --> S["audio-studio-mcp<br/>generate · edit · process"]
- S --> M["Stable Audio 3<br/>MLX on Apple Silicon"]
+ S --> M["Stable Audio 3<br/>MLX on Apple Silicon<br/>PyTorch on NVIDIA GPUs"]
M --> F["WAV / OGG / FLAC + .json<br/>ready for game & video"]
```
## 🚀 Quick start
+### macOS (Apple Silicon)
+
**Requirements:**
- Apple Silicon Mac (M1 or later), 16 GB RAM recommended
@@ -86,6 +89,29 @@ The installer sets up [`uv`](https://docs.astral.sh/uv/) if needed, clones the o
claude mcp add --scope user audio-studio -- /path/to/audio-studio-mcp/.venv/bin/audio-studio-mcp
```
+### Windows (NVIDIA GPU)
+
+**Requirements:**
+
+- 64-bit Windows 10 or 11 with an NVIDIA GPU (8 GB of VRAM or more) and a current driver. Tested on an RTX 3060 12 GB
+- About 14 GB of disk for the model and PyTorch
+- `git` (`winget install Git.Git`) and [`ffmpeg`](https://ffmpeg.org) (`winget install Gyan.FFmpeg`)
+- A free [Hugging Face](https://huggingface.co) account. The PyTorch weights are gated: open [stabilityai/stable-audio-3-medium](https://huggingface.co/stabilityai/stable-audio-3-medium) and accept the license once
+
+```powershell
+git clone https://github.com/kanaworksai-hue/audio-studio-mcp.git
+cd audio-studio-mcp
+powershell -ExecutionPolicy Bypass -File install.ps1
+```
+
+The installer does the same steps as on macOS, but installs PyTorch with CUDA and downloads the official PyTorch checkpoint of the **medium** model (~10.4 GB). If you aren't logged in to Hugging Face yet, it asks for an access token with read permission ([create one here](https://huggingface.co/settings/tokens)). It finishes by printing the command to register the server:
+
+```powershell
+claude mcp add --scope user audio-studio -- "C:\path\to\audio-studio-mcp\.venv\Scripts\audio-studio-mcp.exe"
+```
+
+Flash Attention is not needed. Without it, the runtime falls back to PyTorch's built-in attention.
+
<details>
<summary><b>Claude Desktop, Cursor and other clients</b></summary>
@@ -100,18 +126,20 @@ Add this to `claude_desktop_config.json`, `.cursor/mcp.json` or your client's MC
}
}
```
+
+On Windows the command is `C:\\path\\to\\audio-studio-mcp\\.venv\\Scripts\\audio-studio-mcp.exe` (backslashes doubled in JSON).
</details>
<details>
<summary><b>Installer options</b></summary>
-| Option | Effect |
-|---|---|
-| `--model all` | Also download the small, fast `sm-music` and `sm-sfx` models (+2.6 GB) |
-| `--skip-weights` | Don't download now; the first generation downloads them |
-| `-y` | Install `uv` without asking |
+| macOS | Windows | Effect |
+|---|---|---|
+| `--model all` | `-Model all` | Also download the small, fast `sm-music` and `sm-sfx` models (+2.6 GB on macOS, +7 GB on Windows) |
+| `--skip-weights` | `-SkipWeights` | Don't download now; the first generation downloads them |
+| `-y` | `-Yes` | Install `uv` without asking |
-Downloads are anonymous. Logging in with `hf auth login` raises Hugging Face's rate limit.
+On macOS, downloads are anonymous; logging in with `hf auth login` raises Hugging Face's rate limit. On Windows, the PyTorch weights are gated: accept the license on each model page you download ([medium](https://huggingface.co/stabilityai/stable-audio-3-medium), [small-music](https://huggingface.co/stabilityai/stable-audio-3-small-music), [small-sfx](https://huggingface.co/stabilityai/stable-audio-3-small-sfx)) and log in.
</details>
> [!TIP]
@@ -155,9 +183,10 @@ Generated files are 44.1 kHz 24-bit stereo WAV, written to `outputs/` in this fo
| `AUDIO_STUDIO_OUTPUT_DIR` | `<repo>/outputs` | Where audio files are written |
| `AUDIO_STUDIO_IDLE_UNLOAD_MIN` | `10` | Free the models after this many idle minutes (`0` = never) |
| `AUDIO_STUDIO_SA3_MODEL` | `medium` | `medium` (best quality, up to 380 s), `sm-music` or `sm-sfx` (small and fast, up to 120 s) |
-| `AUDIO_STUDIO_MLX_CACHE_GB` | `1` | Cap on MLX's buffer cache. Without it, a long generation can leave ~6 GB cached |
+| `AUDIO_STUDIO_MLX_CACHE_GB` | `1` | macOS: cap on MLX's buffer cache. Without it, a long generation can leave ~6 GB cached |
+| `AUDIO_STUDIO_DEVICE` | `cuda` if available | Windows/Linux: PyTorch device, e.g. `cuda`, `cuda:1` or `cpu` |
| `AUDIO_STUDIO_SA3_DIR` | `<repo>/vendor/stable-audio-3` | Use another stable-audio-3 checkout |
-| `AUDIO_STUDIO_BACKEND` | `auto` | `auto` or `sa3-mlx` |
+| `AUDIO_STUDIO_BACKEND` | `auto` | `auto`, `sa3-mlx` (Apple Silicon) or `sa3-torch` (PyTorch, NVIDIA) |
| `AUDIO_STUDIO_FFMPEG` | `ffmpeg` on `PATH` | Path to ffmpeg |
Pass them with `claude mcp add ... -e NAME=value` or in the `env` block of your client config.
@@ -172,6 +201,8 @@ Each client session normally starts its own server process. Models load on the f
.venv/bin/audio-studio-mcp --http 8765 --preload
claude mcp add --scope user --transport http audio-studio http://127.0.0.1:8765/mcp
```
+
+On Windows, start it with `.venv\Scripts\audio-studio-mcp.exe --http 8765 --preload`.
</details>
## ⚡ Performance
@@ -185,7 +216,17 @@ Medium model on an M1 Mac with 16 GB:
| Continue to 35 s, incl. loading the encoder | ~27 s |
| 15 s of music with `sm-music`, warm | ~1 s |
-Loaded models use about 5–7 GB of memory. They are freed after the idle timeout or by `unload_models`.
+Medium model on Windows with an RTX 3060 12 GB:
+
+| Task | Time |
+|---|---|
+| Two 3 s sound effects, cold start (incl. ~20 s model load) | ~25 s |
+| 20 s of music, warm | ~1.3 s |
+| Continue to 30 s, warm | ~2.2 s |
+| 380 s of music (the maximum), warm | ~15 s |
+| 15 s of music with `sm-music`, warm | ~0.7 s |
+
+On a Mac, loaded models use about 5–7 GB of memory. On the RTX 3060, the medium model peaked at about 5.3 GB of VRAM. Models are freed after the idle timeout or by `unload_models`.
## 📝 Prompting tips
@@ -210,7 +251,11 @@ The full guide is also sent to the client as the server's instructions.
<details>
<summary><b>Does it run on Windows, Linux or Intel Macs?</b></summary>
-Not yet. It needs an Apple Silicon Mac today. The model runtime sits behind a backend interface, and a Windows backend for NVIDIA GPUs is planned.
+**Windows:** yes, with an NVIDIA GPU. See [Quick start](#windows-nvidia-gpu).
+
+**Linux:** with an NVIDIA GPU it uses the same PyTorch backend and should work, but it is untested and has no installer yet. Clone the upstream runtime into `vendor/stable-audio-3` at the commit pinned in `install.sh`, then run `uv sync --extra cuda` and `hf auth login`.
+
+**Intel Macs and AMD GPUs** are not supported.
</details>
<details>
@@ -240,7 +285,7 @@ Use WAV or OGG for loops. MP3 adds padding at the start and end, so it can't loo
## 🗺️ Roadmap
- [x] Apple Silicon backend (Stable Audio 3, MLX)
-- [ ] Windows backend for NVIDIA GPUs
+- [x] Windows backend for NVIDIA GPUs (Stable Audio 3, PyTorch)
- [ ] LoRA support (the upstream runtime already has it)
Issues and pull requests are welcome.
@@ -250,7 +295,7 @@ Issues and pull requests are welcome.
If Audio Studio made a sound you ended up using, please click **⭐ Star** at the top of the [repository page](https://github.com/kanaworksai-hue/audio-studio-mcp). It's free, takes one second, and helps more than it looks:
- **More people find it.** Stars make the project easier to discover on GitHub, so more game developers and video makers get to use it.
-- **It keeps updates coming.** Every star tells me someone finds this useful. That's what keeps me working on the next update, like the Windows backend and LoRA support.
+- **It keeps updates coming.** Every star tells me someone finds this useful. That's what keeps me working on the next update, like LoRA support.
Other ways to help: [open an issue](https://github.com/kanaworksai-hue/audio-studio-mcp/issues) for a bug or an idea, or share a sound you made on X and tag [@KanaWorks_AI](https://x.com/KanaWorks_AI).
@@ -258,16 +303,19 @@ Other ways to help: [open an issue](https://github.com/kanaworksai-hue/audio-stu
```bash
uv run pytest # offline tests, no model needed
-.venv/bin/python scripts/smoke_test.py # end-to-end with the real model (~30 s)
+.venv/bin/python scripts/smoke_test.py # end-to-end with the real model (~30 s on an M1)
```
+On Windows: `.venv\Scripts\python scripts\smoke_test.py` (~45 s on an RTX 3060, including model loading).
+
```
src/audio_studio_mcp/
server.py MCP tools (backend-independent)
prompts.py prompt building and the instructions sent to clients
post.py post-processing and export
backends/base.py backend interface
- backends/sa3_mlx.py Stable Audio 3 on Apple Silicon
+ backends/sa3_mlx.py Stable Audio 3 on Apple Silicon (MLX)
+ backends/sa3_torch.py Stable Audio 3 on NVIDIA GPUs (PyTorch)
```
A new platform is added as another backend in `backends/`.
@@ -276,11 +324,11 @@ A new platform is added as another backend in `backends/`.
- **This project:** [MIT](LICENSE).
- **Stable Audio 3 runtime:** downloaded into `vendor/` at install time. It is © Stability AI and MIT-licensed.
-- **Model weights:** licensed under the [Stability AI Community License](https://huggingface.co/stabilityai/stable-audio-3-optimized). They are downloaded from Hugging Face, not distributed here.
+- **Model weights:** licensed under the [Stability AI Community License](https://huggingface.co/stabilityai/stable-audio-3-optimized). They are downloaded from Hugging Face (macOS: `stable-audio-3-optimized`; Windows: `stable-audio-3-medium` and the small models), not distributed here.
- **Brand:** the KanaWorks_AI name, logo and the Kana character are © KanaWorks_AI and are **not** covered by the MIT license. See [docs/brand](docs/brand/README.md).
-- **Built on:** [Stable Audio 3](https://github.com/Stability-AI/stable-audio-3), [MLX](https://github.com/ml-explore/mlx) and the [Model Context Protocol](https://modelcontextprotocol.io).
+- **Built on:** [Stable Audio 3](https://github.com/Stability-AI/stable-audio-3), [MLX](https://github.com/ml-explore/mlx), [PyTorch](https://pytorch.org) and the [Model Context Protocol](https://modelcontextprotocol.io).
-This is an independent project. It is not affiliated with or endorsed by Stability AI, Apple or Anthropic.
+This is an independent project. It is not affiliated with or endorsed by Stability AI, Apple, NVIDIA or Anthropic.
<br>
diff --git a/README.zh-CN.md b/README.zh-CN.md
index 5b6483d..2d7688a 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -5,6 +5,7 @@
<p>
<a href="LICENSE"><img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-6b4dff?style=flat-square"></a>
<img alt="macOS Apple Silicon" src="https://img.shields.io/badge/macOS-Apple_Silicon-111?style=flat-square&logo=apple">
+ <img alt="Windows NVIDIA GPU" src="https://img.shields.io/badge/Windows-NVIDIA_GPU-76b900?style=flat-square&logo=nvidia&logoColor=white">
<a href="https://modelcontextprotocol.io"><img alt="MCP server" src="https://img.shields.io/badge/MCP-server-19b8d6?style=flat-square"></a>
<img alt="Python 3.10 to 3.13" src="https://img.shields.io/badge/python-3.10–3.13-3776ab?style=flat-square&logo=python&logoColor=white">
<a href="https://github.com/kanaworksai-hue/audio-studio-mcp/actions/workflows/tests.yml"><img alt="Tests" src="https://img.shields.io/github/actions/workflow/status/kanaworksai-hue/audio-studio-mcp/tests.yml?style=flat-square&label=tests"></a>
@@ -19,7 +20,7 @@
</div>
-**Audio Studio MCP** 给 Claude Code、Claude Desktop、Cursor 以及任何 [MCP](https://modelcontextprotocol.io) 客户端配上一个在你自己 Mac 上运行的音频工作室。用自然语言要一段 BGM 或一个音效,模型就会用 [Stable Audio 3](https://github.com/Stability-AI/stable-audio-3) 在本机生成。之后还能做成循环、统一响度,导出给游戏引擎或剪辑软件。不用云服务,不需要 API Key,生成不花钱。
+**Audio Studio MCP** 给 Claude Code、Claude Desktop、Cursor 以及任何 [MCP](https://modelcontextprotocol.io) 客户端配上一个在你自己的 Mac 或 Windows 电脑上运行的音频工作室。用自然语言要一段 BGM 或一个音效,模型就会用 [Stable Audio 3](https://github.com/Stability-AI/stable-audio-3) 在本机生成。之后还能做成循环、统一响度,导出给游戏引擎或剪辑软件。不用云服务,不需要 API Key,生成不花钱。
<p align="center">
<img src="docs/assets/demo-zh.png" alt="真实的 Claude Code 会话:一句话生成两个 lo-fi BGM 候选,并导出 Godot 用的无缝循环 OGG" width="820">
@@ -33,13 +34,13 @@
<td align="center" width="25%"><img src="docs/assets/icon-generate.png" width="72" alt=""><br><b>生成</b><br><sub>一句话生成 BGM、乐器 loop 和音效,每次 1–4 个候选</sub></td>
<td align="center" width="25%"><img src="docs/assets/icon-edit.png" width="72" alt=""><br><b>编辑</b><br><sub>整段换风格、重绘某个时间段、续写延长</sub></td>
<td align="center" width="25%"><img src="docs/assets/icon-process.png" width="72" alt=""><br><b>后期</b><br><sub>无缝循环、淡入淡出、响度(LUFS)、48 kHz WAV / OGG / FLAC</sub></td>
-<td align="center" width="25%"><img src="docs/assets/icon-local.png" width="72" alt=""><br><b>本机运行</b><br><sub>在 Apple Silicon 上用 MLX 运行,不用注册账号,也不上传任何东西</sub></td>
+<td align="center" width="25%"><img src="docs/assets/icon-local.png" width="72" alt=""><br><b>本机运行</b><br><sub>在 Apple Silicon(MLX)或 NVIDIA 显卡(PyTorch)上运行,不上传任何东西</sub></td>
</tr>
</table>
- **可复现:** 每个文件都带一个 `.json`,记录 prompt、seed 和参数。
- **内置 prompt 指南:** 服务器会把官方 Stable Audio 3 的 prompt 格式告诉客户端,“来个吱呀作响的木门”这种说法会被改写成模型能理解的 prompt。
-- **结果和官方一致:** 同一个 seed 的输出和官方 `sa3` 命令行逐位相同。
+- **结果和官方一致:** 在 Mac 上,同一个 seed 的输出和官方 `sa3` 命令行逐位相同;在 Windows 上直接调用官方的 Stable Audio 3 PyTorch API。
## 🎧 试听
@@ -62,12 +63,14 @@ MP3 文件在 [`docs/samples/`](docs/samples),prompt 和 seed 在 [`samples.js
flowchart LR
U["你<br/>“做一段温馨咖啡馆 BGM”"] --> C["Claude Code · Desktop<br/>Cursor · 任何 MCP 客户端"]
C -- "MCP" --> S["audio-studio-mcp<br/>生成 · 编辑 · 后期"]
- S --> M["Stable Audio 3<br/>Apple Silicon 上的 MLX"]
+ S --> M["Stable Audio 3<br/>Apple Silicon 上的 MLX<br/>NVIDIA 显卡上的 PyTorch"]
M --> F["WAV / OGG / FLAC + .json<br/>直接用于游戏和视频"]
```
## 🚀 快速开始
+### macOS(Apple Silicon)
+
**环境要求:**
- Apple Silicon Mac(M1 及以上),建议 16 GB 内存
@@ -93,6 +96,29 @@ cd audio-studio-mcp
claude mcp add --scope user audio-studio -- /path/to/audio-studio-mcp/.venv/bin/audio-studio-mcp
```
+### Windows(NVIDIA 显卡)
+
+**环境要求:**
+
+- 64 位 Windows 10 或 11,NVIDIA 显卡(显存 8 GB 以上)和较新的驱动。已在 RTX 3060 12 GB 上测试
+- 模型和 PyTorch 约占 14 GB 磁盘
+- `git`(`winget install Git.Git`)和 [`ffmpeg`](https://ffmpeg.org)(`winget install Gyan.FFmpeg`)
+- 一个免费的 [Hugging Face](https://huggingface.co) 账号。PyTorch 版权重需要先同意许可:打开 [stabilityai/stable-audio-3-medium](https://huggingface.co/stabilityai/stable-audio-3-medium),同意一次许可即可
+
+```powershell
+git clone https://github.com/kanaworksai-hue/audio-studio-mcp.git
+cd audio-studio-mcp
+powershell -ExecutionPolicy Bypass -File install.ps1
+```
+
+安装脚本的步骤和 macOS 相同,区别是会安装带 CUDA 的 PyTorch,并下载 **medium** 模型的官方 PyTorch 权重(约 10.4 GB)。如果还没登录 Hugging Face,它会让你粘贴一个 read 权限的 access token([在这里创建](https://huggingface.co/settings/tokens))。最后同样会打印注册命令:
+
+```powershell
+claude mcp add --scope user audio-studio -- "C:\path\to\audio-studio-mcp\.venv\Scripts\audio-studio-mcp.exe"
+```
+
+不需要安装 Flash Attention。没有它时,运行时会自动改用 PyTorch 自带的注意力实现。
+
<details>
<summary><b>Claude Desktop、Cursor 等客户端</b></summary>
@@ -107,18 +133,20 @@ claude mcp add --scope user audio-studio -- /path/to/audio-studio-mcp/.venv/bin/
}
}
```
+
+Windows 上 command 写成 `C:\\path\\to\\audio-studio-mcp\\.venv\\Scripts\\audio-studio-mcp.exe`(JSON 里反斜杠要写两个)。
</details>
<details>
<summary><b>安装选项</b></summary>
-| 选项 | 作用 |
-|---|---|
-| `--model all` | 额外下载小而快的 `sm-music` 和 `sm-sfx` 模型(多 2.6 GB) |
-| `--skip-weights` | 先不下载,第一次生成时再下载 |
-| `-y` | 不询问,直接安装 `uv` |
+| macOS | Windows | 作用 |
+|---|---|---|
+| `--model all` | `-Model all` | 额外下载小而快的 `sm-music` 和 `sm-sfx` 模型(macOS 多 2.6 GB,Windows 多 7 GB) |
+| `--skip-weights` | `-SkipWeights` | 先不下载,第一次生成时再下载 |
+| `-y` | `-Yes` | 不询问,直接安装 `uv` |
-下载不需要登录。用 `hf auth login` 登录后,Hugging Face 的限速会更宽松。
+macOS 上下载不需要登录,用 `hf auth login` 登录后 Hugging Face 的限速会更宽松。Windows 上的 PyTorch 权重需要先同意许可:在要下载的每个模型页面同意许可([medium](https://huggingface.co/stabilityai/stable-audio-3-medium)、[small-music](https://huggingface.co/stabilityai/stable-audio-3-small-music)、[small-sfx](https://huggingface.co/stabilityai/stable-audio-3-small-sfx)),并登录。
</details>
> [!TIP]
@@ -162,9 +190,10 @@ claude mcp add --scope user audio-studio -- /path/to/audio-studio-mcp/.venv/bin/
| `AUDIO_STUDIO_OUTPUT_DIR` | `<repo>/outputs` | 音频输出目录 |
| `AUDIO_STUDIO_IDLE_UNLOAD_MIN` | `10` | 闲置多少分钟后释放模型(`0` = 不释放) |
| `AUDIO_STUDIO_SA3_MODEL` | `medium` | `medium`(质量最好,最长 380 秒)、`sm-music` 或 `sm-sfx`(小而快,最长 120 秒) |
-| `AUDIO_STUDIO_MLX_CACHE_GB` | `1` | MLX 缓冲区缓存上限。不设的话,生成长曲子后可能多占约 6 GB |
+| `AUDIO_STUDIO_MLX_CACHE_GB` | `1` | macOS:MLX 缓冲区缓存上限。不设的话,生成长曲子后可能多占约 6 GB |
+| `AUDIO_STUDIO_DEVICE` | 有 CUDA 时为 `cuda` | Windows/Linux:PyTorch 设备,例如 `cuda`、`cuda:1` 或 `cpu` |
| `AUDIO_STUDIO_SA3_DIR` | `<repo>/vendor/stable-audio-3` | 使用别处的 stable-audio-3 checkout |
-| `AUDIO_STUDIO_BACKEND` | `auto` | `auto` 或 `sa3-mlx` |
+| `AUDIO_STUDIO_BACKEND` | `auto` | `auto`、`sa3-mlx`(Apple Silicon)或 `sa3-torch`(PyTorch,NVIDIA) |
| `AUDIO_STUDIO_FFMPEG` | `PATH` 里的 `ffmpeg` | ffmpeg 路径 |
用 `claude mcp add ... -e 名称=值` 传入,或写在客户端配置的 `env` 里。
@@ -179,6 +208,8 @@ claude mcp add --scope user audio-studio -- /path/to/audio-studio-mcp/.venv/bin/
.venv/bin/audio-studio-mcp --http 8765 --preload
claude mcp add --scope user --transport http audio-studio http://127.0.0.1:8765/mcp
```
+
+Windows 上用 `.venv\Scripts\audio-studio-mcp.exe --http 8765 --preload` 启动。
</details>
## ⚡ 性能
@@ -192,7 +223,17 @@ M1 Mac 16 GB,medium 模型:
| 续写到 35 秒(含首次加载编码器) | 约 27 秒 |
| `sm-music` 热状态,15 秒音乐 | 约 1 秒 |
-模型加载后占用约 5–7 GB 内存,闲置超时或调用 `unload_models` 后释放。
+Windows + RTX 3060 12 GB,medium 模型:
+
+| 场景 | 耗时 |
+|---|---|
+| 冷启动,2 个 3 秒音效(含约 20 秒模型加载) | 约 25 秒 |
+| 热状态,20 秒音乐 | 约 1.3 秒 |
+| 热状态,续写到 30 秒 | 约 2.2 秒 |
+| 热状态,380 秒音乐(最长) | 约 15 秒 |
+| `sm-music` 热状态,15 秒音乐 | 约 0.7 秒 |
+
+在 Mac 上,模型加载后占用约 5–7 GB 内存;在 RTX 3060 上,medium 模型的显存峰值约 5.3 GB。闲置超时或调用 `unload_models` 后释放。
## 📝 Prompt 技巧
@@ -217,7 +258,11 @@ M1 Mac 16 GB,medium 模型:
<details>
<summary><b>能在 Windows、Linux 或 Intel Mac 上用吗?</b></summary>
-暂时不行,目前需要 Apple Silicon Mac。模型运行部分已经抽成了后端接口,面向 NVIDIA 显卡的 Windows 后端在计划中。
+**Windows:** 可以,需要 NVIDIA 显卡,见[快速开始](#windowsnvidia-显卡)。
+
+**Linux:** 有 NVIDIA 显卡时用的是同一个 PyTorch 后端,理论上能用,但没有测试过,也还没有安装脚本。可以把上游运行时 clone 到 `vendor/stable-audio-3`(commit 用 `install.sh` 里固定的那个),再运行 `uv sync --extra cuda` 和 `hf auth login`。
+
+**Intel Mac 和 AMD 显卡**不支持。
</details>
<details>
@@ -247,7 +292,7 @@ M1 Mac 16 GB,medium 模型:
## 🗺️ 路线图
- [x] Apple Silicon 后端(Stable Audio 3、MLX)
-- [ ] 面向 NVIDIA 显卡的 Windows 后端
+- [x] 面向 NVIDIA 显卡的 Windows 后端(Stable Audio 3、PyTorch)
- [ ] LoRA 支持(上游运行时已经支持)
欢迎提 Issue 和 Pull Request。
@@ -257,7 +302,7 @@ M1 Mac 16 GB,medium 模型:
如果 Audio Studio 帮你做出了真正用上的声音,请在[仓库页面](https://github.com/kanaworksai-hue/audio-studio-mcp)顶部点一下 **⭐ Star**。免费,只要一秒,作用却不小:
- **让更多人发现它。** Star 越多,项目在 GitHub 上越容易被看到,更多做游戏、做视频的人就能用上。
-- **让更新更有动力。** 每一个 Star 都在告诉我“这个东西有人在用”。这就是我继续做下一版(比如 Windows 后端和 LoRA 支持)的动力。
+- **让更新更有动力。** 每一个 Star 都在告诉我“这个东西有人在用”。这就是我继续做下一版(比如 LoRA 支持)的动力。
其他支持方式:遇到问题或有新想法,欢迎[提 Issue](https://github.com/kanaworksai-hue/audio-studio-mcp/issues);也欢迎在 X 上分享你做的声音,并 @[KanaWorks_AI](https://x.com/KanaWorks_AI)。
@@ -265,16 +310,19 @@ M1 Mac 16 GB,medium 模型:
```bash
uv run pytest # 离线测试,不需要模型
-.venv/bin/python scripts/smoke_test.py # 用真实模型的端到端测试(约 30 秒)
+.venv/bin/python scripts/smoke_test.py # 用真实模型的端到端测试(M1 上约 30 秒)
```
+Windows 上:`.venv\Scripts\python scripts\smoke_test.py`(RTX 3060 上约 45 秒,含模型加载)。
+
```
src/audio_studio_mcp/
server.py MCP 工具(与后端无关)
prompts.py prompt 拼接,以及发给客户端的说明
post.py 后期处理和导出
backends/base.py 后端接口
- backends/sa3_mlx.py Apple Silicon 上的 Stable Audio 3
+ backends/sa3_mlx.py Apple Silicon 上的 Stable Audio 3(MLX)
+ backends/sa3_torch.py NVIDIA 显卡上的 Stable Audio 3(PyTorch)
```
新平台以新后端的形式加到 `backends/` 里。
@@ -283,11 +331,11 @@ src/audio_studio_mcp/
- **本项目:** [MIT](LICENSE)。
- **Stable Audio 3 运行时:** 安装时下载到 `vendor/`,© Stability AI,MIT 协议。
-- **模型权重:** 适用 [Stability AI Community License](https://huggingface.co/stabilityai/stable-audio-3-optimized)。权重从 Hugging Face 下载,本项目不分发。
+- **模型权重:** 适用 [Stability AI Community License](https://huggingface.co/stabilityai/stable-audio-3-optimized)。权重从 Hugging Face 下载(macOS:`stable-audio-3-optimized`;Windows:`stable-audio-3-medium` 及小模型),本项目不分发。
- **品牌:** KanaWorks_AI 名称、logo 和 Kana 形象版权归 KanaWorks_AI 所有,**不在** MIT 授权范围内。详见 [docs/brand](docs/brand/README.md)。
-- **基于:** [Stable Audio 3](https://github.com/Stability-AI/stable-audio-3)、[MLX](https://github.com/ml-explore/mlx) 和 [Model Context Protocol](https://modelcontextprotocol.io)。
+- **基于:** [Stable Audio 3](https://github.com/Stability-AI/stable-audio-3)、[MLX](https://github.com/ml-explore/mlx)、[PyTorch](https://pytorch.org) 和 [Model Context Protocol](https://modelcontextprotocol.io)。
-本项目是独立项目,与 Stability AI、Apple、Anthropic 都没有关联,也未获其背书。
+本项目是独立项目,与 Stability AI、Apple、NVIDIA、Anthropic 都没有关联,也未获其背书。
<br>
diff --git a/pyproject.toml b/pyproject.toml
index 9d496cf..8b315a2 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -7,10 +7,11 @@ license = "MIT"
license-files = ["LICENSE"]
authors = [{ name = "kanaworksai-hue" }]
requires-python = ">=3.10"
-keywords = ["mcp", "stable-audio", "audio-generation", "sound-effects", "bgm", "mlx"]
+keywords = ["mcp", "stable-audio", "audio-generation", "sound-effects", "bgm", "mlx", "cuda"]
classifiers = [
"Programming Language :: Python :: 3",
"Operating System :: MacOS",
+ "Operating System :: Microsoft :: Windows",
"Topic :: Multimedia :: Sound/Audio",
]
dependencies = [
diff --git a/scripts/smoke_test.py b/scripts/smoke_test.py
index 711b248..d960757 100644
--- a/scripts/smoke_test.py
+++ b/scripts/smoke_test.py
@@ -1,10 +1,12 @@
"""End-to-end test against the real model, over stdio like an MCP client.
Usage: .venv/bin/python scripts/smoke_test.py [--out DIR]
+ (Windows: .venv\Scripts\python scripts\smoke_test.py)
Runs every tool once (generate, edit: variation/inpaint/continue, process,
unload). Writes into a temporary folder unless --out is given. Takes about
-30 seconds on an M1 once the weights are downloaded.
+30 seconds on an M1 (about 45 on an RTX 3060, including model loading) once
+the weights are downloaded.
"""
from __future__ import annotations
diff --git a/src/audio_studio_mcp/backends/sa3_torch.py b/src/audio_studio_mcp/backends/sa3_torch.py
index b2047d7..61ff2ef 100644
--- a/src/audio_studio_mcp/backends/sa3_torch.py
+++ b/src/audio_studio_mcp/backends/sa3_torch.py
@@ -117,8 +117,11 @@ class SA3TorchBackend(Backend):
with contextlib.redirect_stdout(sys.stderr):
t0 = time.time()
res.included_model_load = self._load()
+ # generate() defaults sample_size to 120 s of audio and clamps to it;
+ # use the model's own maximum (380 s for medium).
kw = dict(prompt=req.prompt, duration=req.seconds, steps=req.steps,
- cfg_scale=req.cfg, apg_scale=1.0)
+ cfg_scale=req.cfg, apg_scale=1.0,
+ sample_size=int(self._model.model_config["sample_size"]))
# Like the MLX backend: the negative prompt only matters with CFG.
if req.cfg != 1.0 and req.negative_prompt.strip():
kw["negative_prompt"] = req.negative_prompt.strip()
diff --git a/tests/test_sa3_torch.py b/tests/test_sa3_torch.py
index adea284..b16455d 100644
--- a/tests/test_sa3_torch.py
+++ b/tests/test_sa3_torch.py
@@ -24,7 +24,9 @@ class _Inner:
sample_rate = 44100
class StableAudioModel:
- def __init__(self): self.model = _Inner()
+ def __init__(self):
+ self.model = _Inner()
+ self.model_config = {"sample_size": 16777216}
@staticmethod
def from_pretrained(model_name, device=None):
@@ -99,6 +101,7 @@ def test_text_to_audio_one_call_per_seed(backend, capsys):
r2 = backend._generate([7], GenerationRequest(prompt="p", seconds=3, cfg=4.0, negative_prompt="noise"))
assert [c["seed"] for c in calls] == [5, 6, 7]
assert calls[0]["steps"] == 8 and calls[0]["cfg_scale"] == 1.0 and calls[0]["apg_scale"] == 1.0
+ assert calls[0]["sample_size"] == 16777216, "upstream's 120 s default would cut long tracks"
assert "negative_prompt" not in calls[0], "negative prompt only applies with CFG"
assert calls[2]["negative_prompt"] == "noise" and calls[2]["cfg_scale"] == 4.0
assert "init_audio" not in calls[0] and "inpaint_audio" not in calls[0]