supertone-inc/supertonic

GitHub: supertone-inc/supertonic

基于 ONNX Runtime 的轻量级本地多语言文本转语音系统,无需云端和 GPU 即可在各类设备上实现高速语音合成。

Stars: 11314 | Forks: 1177

# Supertonic — 极速、本地运行、高精度 TTS [![v3 Demo](https://img.shields.io/badge/🤗%20v3-Demo-yellow)](https://huggingface.co/spaces/Supertone/supertonic-3) [![v3 Models](https://img.shields.io/badge/🤗%20v3-Models-blue)](https://huggingface.co/Supertone/supertonic-3) [![v2 Branch](https://img.shields.io/badge/v2-release%2Fsupertonic--2-lightgrey)](https://github.com/supertone-inc/supertonic/tree/release/supertonic-2) [![v1 Demo](https://img.shields.io/badge/🤗%20v1%20(old)-Demo-lightgrey)](https://huggingface.co/spaces/Supertone/supertonic#interactive-demo) [![v1 Models](https://img.shields.io/badge/🤗%20v1%20(old)-Models-lightgrey)](https://huggingface.co/Supertone/supertonic)

Supertonic 3 Banner

**Supertonic** 是一个极速、本地运行的文本转语音系统,专为开销最小的本地推理而设计。它由 ONNX Runtime 驱动,完全在您的设备上运行——无需云端、无需 API 调用、无隐私担忧。 ### 📰 更新新闻 - **2026.04.29** - 🎉 **Supertonic 3** 发布,支持 **31 种语言**,提升了朗读准确率,减少了重复/跳读故障,并提供与 v2 兼容的公开 ONNX 资产。[演示](https://huggingface.co/spaces/Supertone/supertonic-3) | [模型](https://huggingface.co/Supertone/supertonic-3) - **2026.01.22** - **[Voice Builder](https://supertonic.supertone.ai/voice_builder)** 现已上线!将您的声音转换为可部署、边缘原生的 TTS,并享有永久所有权。 - **2026.01.06** - 🎉 **Supertonic 2** 发布,支持 5 种语言。v2 代码路径保留在 [`release/supertonic-2`](https://github.com/supertone-inc/supertonic/tree/release/supertonic-2) 分支中。 - **2025.12.10** - 添加了 `supertonic` PyPI 包!可通过 `pip install supertonic` 安装。详情请访问 [supertonic-py 文档](https://supertone-inc.github.io/supertonic-py) - **2025.12.10** - 添加了 [6 种新语音风格](https://huggingface.co/Supertone/supertonic/tree/b10dbaf18b316159be75b34d24f740008fddd381) (M3, M4, M5, F3, F4, F5)。详情请参见 [语音列表](https://supertone-inc.github.io/supertonic-py/voices/) - **2025.12.08** - 通过 [OnnxSlim](https://github.com/inisis/OnnxSlim) 优化的 ONNX 模型现已在 [Hugging Face Models](https://huggingface.co/Supertone/supertonic) 上提供 - **2025.11.24** - 添加了 Flutter SDK 支持并兼容 macOS ## 快速开始 安装 Python SDK 并立即生成语音。首次运行时,Supertonic 会自动从 Hugging Face 下载模型资产。 ``` pip install supertonic ``` ### Python ``` from supertonic import TTS # 首次运行会自动从 Hugging Face 下载模型。 tts = TTS(auto_download=True) style = tts.get_voice_style(voice_name="M1") text = "A gentle breeze moved through the open window while everyone listened to the story." wav, duration = tts.synthesize(text, voice_style=style, lang="en") tts.save_audio(wav, "output.wav") print(f"Generated {duration:.2f}s of audio") ``` ## 入门指南 首先,克隆此仓库: ``` git clone https://github.com/supertone-inc/supertonic.git cd supertonic ``` ### 前置条件 在运行示例之前,请下载 ONNX 模型和预设语音,并将它们放置在 `assets` 目录中: ``` git lfs install git clone https://huggingface.co/Supertone/supertonic-3 assets ``` 某些语言示例需要特定的原生运行环境: - **Go**: 安装 ONNX Runtime C 库。在 macOS 上,执行 `brew install onnxruntime` 即可;Go 示例会自动检测 Homebrew 路径。 - **Java**: 请使用 JDK,而不仅仅是 JRE。在 macOS 上,`brew install openjdk@17` 即可满足要求。 - **C#**: 目标框架为 .NET 9,并允许主版本向前滚动,因此 .NET 9 或更新的运行环境均可运行。 然后运行 Python 示例: ``` cd py uv sync uv run example_onnx.py ``` 这将使用默认预设语音生成 `outputs/output.wav`。 ### 其他运行环境示例
在其他语言和平台中运行 Supertonic **Node.js 示例** ([详情](nodejs/)) ``` cd nodejs npm install npm start ``` **Browser 示例** ([详情](web/)) ``` cd web npm install npm run dev ``` **Java 示例** ([详情](java/)) ``` cd java mvn clean install mvn exec:java ``` **C++ 示例** ([详情](cpp/)) ``` cd cpp mkdir build && cd build cmake .. && cmake --build . --config Release ./example_onnx ``` **C# 示例** ([详情](csharp/)) ``` cd csharp dotnet restore dotnet run ``` **Go 示例** ([详情](go/)) ``` cd go go mod download go run example_onnx.go helper.go ``` **Swift 示例** ([详情](swift/)) ``` cd swift swift build -c release .build/release/example_onnx ``` **Rust 示例** ([详情](rust/)) ``` cd rust cargo build --release ./target/release/example_onnx ``` **iOS 示例** ([详情](ios/)) ``` cd ios/ExampleiOSApp xcodegen generate open ExampleiOSApp.xcodeproj ``` 在 Xcode 中:Targets → ExampleiOSApp → Signing:选择你的 Team,然后选择你的 iPhone 作为运行目标并进行构建。
### 技术细节 - **Runtime**: 采用 ONNX Runtime 进行跨平台推理 - **Browser 支持**: 使用 onnxruntime-web 进行客户端推理 - **批处理**: 支持批处理推理以提高吞吐量 - **音频输出**: 输出 16 位 WAV 文件 ## 性能亮点 Supertonic 3 专为实用的本地推理而设计:体积小巧足以在本地运行,同时与更大型的开源 TTS 系统相比依然具有竞争力。 ### 朗读准确率

Supertonic 3 reading accuracy compared with measured model ranges and VoxCPM2

在所测量的语言中,Supertonic 3 的 WER/CER 范围与 VoxCPM2 等更大型的开源 TTS 模型保持在一个极具竞争力的水平,同时保留了轻量级的本地部署路径。带星号的语言使用 CER;其余的使用 WER。 ### 从 Supertonic 2 到 Supertonic 3

Supertonic 2 and Supertonic 3 comparison

与 Supertonic 2 相比,Supertonic 3 减少了重复和跳读故障,提高了共享语言集中的说话人相似度,并将语言覆盖范围从 5 种扩展到了 31 种。它保留了与 v2 兼容的公开 ONNX 接口,因此现有的集成可以使用相同的推理契约平滑迁移到 v3。 ### 运行时占用

Supertonic CPU runtime compared with GPU baselines

即使在 CPU 上,Supertonic 3 的运行速度也非常快,甚至与在 A100 GPU 上测量的更大基线模型相比也毫不逊色,且内存占用大幅减少。开源的固定语音设置不需要 GPU,这使得本地、浏览器和边缘部署变得容易得多。 ### 模型大小

Model size comparison

在公开的 ONNX 资产中,Supertonic 3 的参数量约为 99M,远小于 0.7B 到 2B 级别的开源 TTS 系统。更小的模型大小在下载大小、启动时间和本地推理方面是一个实际优势。 ## 演示 ### Raspberry Pi 观看 Supertonic 在 **Raspberry Pi** 上的运行情况,展示了本地实时的文本转语音合成: https://github.com/user-attachments/assets/ea66f6d6-7bc5-4308-8a88-1ce3e07400d2 ### 电子阅读器 体验 Supertonic 在开启飞行模式的 **Onyx Boox Go 6** 电子阅读器上的表现,实现平均 0.3× 的 RTF,且完全零网络依赖: https://github.com/user-attachments/assets/64980e58-ad91-423a-9623-78c2ffc13680 ### Chrome 扩展程序 在一秒钟内将任何网页转换为音频,提供极速、本地运行的文本转语音服务,且零网络依赖——免费、私密、易用: https://github.com/user-attachments/assets/cc8a45fc-5c3e-4b2c-8439-a14c3d00d91c ## 为什么选择 Supertonic? - **极速**: 针对桌面、浏览器和边缘部署中的低延迟、本地语音生成进行了优化 - **轻量**: 紧凑的 ONNX 资产专为高效的本地执行而设计 - **本地运行能力**: 完全保护隐私且零网络依赖 - **朗读准确**: 提高了朗读稳定性,减少了重复和跳读故障 - **表现力标签**: 支持简单的表现力标签,例如 ``、`` 和 `` - **灵活部署**: 跨 Python、JavaScript、浏览器、移动端和原生运行环境的现成示例 ## 支持语言 Supertonic 3 支持 31 种语言: | 代码 | 语言 | 代码 | 语言 | 代码 | 语言 | 代码 | 语言 | |------|----------|------|----------|------|----------|------|----------| | `en` | 英语 | `ko` | 韩语 | `ja` | 日语 | `ar` | 阿拉伯语 | | `bg` | 保加利亚语 | `cs` | 捷克语 | `da` | 丹麦语 | `de` | 德语 | | `el` | 希腊语 | `es` | 西班牙语 | `et` | 爱沙尼亚语 | `fi` | 芬兰语 | | `fr` | 法语 | `hi` | 印地语 | `hr` | 克罗地亚语 | `hu` | 匈牙利语 | | `id` | 印度尼西亚语 | `it` | 意大利语 | `lt` | 立陶宛语 | `lv` | 拉脱维亚语 | | `nl` | 荷兰语 | `pl` | 波兰语 | `pt` | 葡萄牙语 | `ro` | 罗马尼亚语 | | `ru` | 俄语 | `sk` | 斯洛伐克语 | `sl` | 斯洛文尼亚语 | `sv` | 瑞典语 | | `tr` | 土耳其语 | `uk` | 乌克兰语 | `vi` | 越南语 | | | 我们跨多个生态系统提供了现成的 TTS 推理示例: | 语言/平台 | 路径 | 描述 | |-------------------|------|-------------| | [**Python**](py/) | `py/` | ONNX Runtime 推理 | | [**Node.js**](nodejs/) | `nodejs/` | 服务器端 JavaScript | | [**Browser**](web/) | `web/` | WebGPU/WASM 推理 | | [**Java**](java/) | `java/` | 跨平台 JVM | | [**C++**](cpp/) | `cpp/` | 高性能 C++ | | [**C#**](csharp/) | `csharp/` | .NET 生态系统 | | [**Go**](go/) | `go/` | Go 实现 | | [**Swift**](swift/) | `swift/` | macOS 应用程序 | | [**iOS**](ios/) | `ios/` | 原生 iOS 应用 | | [**Rust**](rust/) | `rust/` | 内存安全系统 | | [**Flutter**](flutter/) | `flutter/` | 跨平台应用 | ## 自然语言处理 Supertonic 专为处理包含自然散文、标点符号、缩写和专有名词的复杂、真实文本输入而设计。 **测试用例概览:** | 类别 | 主要挑战 | Supertonic | ElevenLabs | OpenAI | Gemini | Microsoft | |:--------:|:--------------:|:----------:|:----------:|:------:|:------:|:---------:| | 金融表达式 | 小数货币、缩写量级 (M, K)、货币符号、货币代码 | ✅ | ❌ | ❌ | ❌ | ❌ | | 电话号码 | 区号、连字符、分机号 | ✅ | ❌ | ❌ | ❌ | ❌ | | 技术单位 | 带小数的数字和单位、缩写技术符号 | ✅ | ❌ | ❌ | ❌ | ❌ |
示例 1:金融表达式
**文本:** **挑战:** - 货币中的小数点($5.2M 应读作“five point two million”) - 缩写的量级单位(M 代表百万,K 代表千) - 货币符号 ($) 需要正确发音为“dollars” **音频样本:** | 系统 | 结果 | 音频样本 | |--------|--------|--------------| | **Supertonic** | ✅ | [🎧 播放音频](https://drive.google.com/file/d/1eancUOhiSXCVoTu9ddh4S-OcVQaWrPV-/view?usp=sharing) | | ElevenLabs Flash v2.5 | ❌ | [🎧 播放音频](https://drive.google.com/file/d/1-r2scv7XQ1crIDu6QOh3eqVl445W6ap_/view?usp=sharing) | | OpenAI TTS-1 | ❌ | [🎧 播放音频](https://drive.google.com/file/d/1MFDXMjfmsAVOqwPx7iveS0KUJtZvcwxB/view?usp=sharing) | | Gemini 2.5 Flash TTS | ❌ | [🎧 播放音频](https://drive.google.com/file/d/1dEHpNzfMUucFTJPQK0k4RcFZvPwQTt09/view?usp=sharing) | | VibeVoice Realtime 0.5B | ❌ | [🎧 放音频](https://drive.google.com/file/d/1b69XWBQnSZZ0WZeR3avv7E8mSdoN6p6P/view?usp=sharing) |
示例 2:电话号码
**文本:** **挑战:** - 括号中的区号应作为单独的数字读取 - 带有连字符分隔符的电话号码 (555-0142) - 缩写的分机号表示法 - 分机号码 (402) **音频样本:** | 系统 | 结果 | 音频样本 | |--------|--------|--------------| | **Supertonic** | ✅ | [🎧 播放音频](https://drive.google.com/file/d/1z-e5iTsihryMR8ll1-N1YXkB2CIJYJ6F/view?usp=sharing) | | ElevenLabs Flash v2.5 | ❌ | [🎧 播放音频](https://drive.google.com/file/d/1HAzVXFTZfZm0VEK2laSpsMTxzufcuaxA/view?usp=sharing) | | OpenAI TTS-1 | ❌ | [🎧 播放音频](https://drive.google.com/file/d/15tjfAmb3GbjP_kmvD7zSdIWkhtAaCPOg/view?usp=sharing) | | Gemini 2.5 Flash TTS | ❌ | [🎧 播放音频](https://drive.google.com/file/d/1BCL8n7yligUZyso970ud7Gf5NWb1OhKD/view?usp=sharing) | | VibeVoice Realtime 0.5B | ❌ | [🎧 播放音频](https://drive.google.com/file/d/1c0c0YM_Qm7XxSk2uSVYLbITgEDTqaVzL/view?usp=sharing) |
示例 3:技术单位
**文本:** **挑战:** - 带有缩写的小数持续时间 (2.3h = two point three hours) - 带有缩写的速度单位 (30kph = thirty kilometers per hour) - 技术缩写(h 代表小时,kph 代表每小时公里数) - 需要正确发音的技术/工程上下文 **音频样本:** | 系统 | 结果 | 音频样本 | |--------|--------|--------------| | **Supertonic** | ✅ | [🎧 播放音频](https://drive.google.com/file/d/1kvOBvswFkLfmr8hGplH0V2XiMxy1shYf/view?usp=sharing) | | ElevenLabs Flash v2.5 | ❌ | [🎧 播放音频](https://drive.google.com/file/d/1_SzfjWJe5YEd0t3R7DztkYhHcI_av48p/view?usp=sharing) | | OpenAI TTS-1 | ❌ | [🎧 播放音频](https://drive.google.com/file/d/1P5BSilj5xFPTV2Xz6yW5jitKZohO9o-6/view?usp=sharing) | | Gemini 2.5 Flash TTS | ❌ | [🎧 播放音频](https://drive.google.com/file/d/1GU82SnWC50OvC8CZNjhxvNZFKQb7I9_Y/view?usp=sharing) | | VibeVoice Realtime 0.5B | ❌ | [🎧 播放音频](https://drive.google.com/file/d/1lUTrxrAQy_viEK2Hlu3KLLtTCe8jvbdV/view?usp=sharing) |
## 基于 Supertonic 构建 | 项目 | 描述 | 链接 | |---------|-------------|-------| | **TLDRL** | 免费、本地运行的 TTS 扩展,用于朗读任何网页 | [Chrome](https://chromewebstore.google.com/detail/tldrl-lightning-tts-power/mdbiaajonlkomihpcaffhkagodbcgbme) | | **Read Aloud** | 开源 TTS 浏览器扩展 | [Chrome](https://chromewebstore.google.com/detail/read-aloud-a-text-to-spee/hdhinadidafjejdhmfkjgnolgimiaplp) · [Edge](https://microsoftedge.microsoft.com/addons/detail/read-aloud-a-text-to-spe/pnfonnnmfjnpfgagnklfaccicnnjcdkm) · [GitHub](https://github.com/ken107/read-aloud) | | **PageEcho** | iOS 上的电子书阅读器应用 | [App Store](https://apps.apple.com/us/app/pageecho/id6755965837) | | **VoiceChat** | 浏览器中本地运行的端到端语音 LLM 聊天机器人 | [演示](https://huggingface.co/spaces/RickRossTN/ai-voice-chat) · [GitHub](https://github.com/irelate-ai/voice-chat) | | **OmniAvatar** | 通过照片 + 语音生成会说话的头像视频 | [演示](https://huggingface.co/spaces/alexnasa/OmniAvatar) | | **CopiloTTS** | 通过 ONNX Runtime 实现的 Kotlin 多平台 TTS SDK | [GitHub](https://github.com/sigmadeltasoftware/CopiloTTS) | | **Voice Mixer** | 用于混合和修改语音风格的 PyQt5 工具 | [GitHub](https://github.com/Topping1/Supertonic-Voice-Mixer) | | **Supertonic MNN** | 基于 MNN 的轻量级库 (fp32/fp16/int8) | [GitHub](https://github.com/vra/supertonic-mnn) · [PyPI](https://pypi.org/project/supertonic-mnn/) | | **Transformers.js** | 支持 Supertonic 的 Hugging Face JS 库 | [GitHub PR](https://github.com/huggingface/transformers.js/pull/1459) · [演示](https://huggingface.co/spaces/webml-community/Supertonic-TTS-WebGPU) | | **Pinokio** | 适用于 Mac、Windows 和 Linux 的一键式本地云 | [Pinokio](https://pinokio.co/) · [GitHub](https://github.com/SUP3RMASS1VE/SuperTonic-TTS) | ## 引用 以下论文描述了 Supertonic 中使用的核心技术。如果您在研究中使用了本系统,或发现这些技术非常有用,请考虑引用相关论文: ### SupertonicTTS:主要架构 本文介绍了 SupertonicTTS 的整体架构,包括语音自编码器、基于流匹配的文本到潜在表示模块以及高效的设计选择。 ``` @article{kim2025supertonic, title={SupertonicTTS: Towards Highly Efficient and Streamlined Text-to-Speech System}, author={Kim, Hyeongju and Yang, Jinhyeok and Yu, Yechan and Ji, Seunghun and Morton, Jacob and Bous, Frederik and Byun, Joon and Lee, Juheon}, journal={arXiv preprint arXiv:2503.23108}, year={2025}, url={https://arxiv.org/abs/2503.23108} } ``` ### Length-Aware RoPE:文本-语音对齐 本文介绍了 Length-Aware Rotary Position Embedding (LARoPE),它改进了交叉注意力机制中的文本-语音对齐。 ``` @article{kim2025larope, title={Length-Aware Rotary Position Embedding for Text-Speech Alignment}, author={Kim, Hyeongju and Lee, Juheon and Yang, Jinhyeok and Morton, Jacob}, journal={arXiv preprint arXiv:2509.11084}, year={2025}, url={https://arxiv.org/abs/2509.11084} } ``` ### Self-Purifying Flow Matching:含噪标签训练 本文描述了在使用有噪声或不可靠标签的情况下,稳健地训练流匹配模型的自净化技术。 ``` @article{kim2025spfm, title={Training Flow Matching Models with Reliable Labels via Self-Purification}, author={Kim, Hyeongju and Yu, Yechan and Yi, June Young and Lee, Juheon}, journal={arXiv preprint arXiv:2509.19091}, year={2025}, url={https://arxiv.org/abs/2509.19091} } ``` ## 许可证 本项目的示例代码在 MIT 许可证下发布。 - 详情请参见 [LICENSE](https://github.com/supertone-inc/supertonic?tab=MIT-1-ov-file)。 随附的模型在 OpenRAIL-M 许可证下发布。 - 详情请参见 [LICENSE](https://huggingface.co/Supertone/supertonic-3/blob/main/LICENSE) 文件。 此模型使用 PyTorch 进行训练,PyTorch 在 BSD 3-Clause 许可证下发布,但并未随本项目一起重新分发。 - 详情请参见 [LICENSE](https://docs.pytorch.org/FBGEMM/general/License.html)。 版权所有 (c) 2026 Supertone Inc.
标签:Hugging Face, JS文件枚举, MITM代理, NLP, ONNX, ONNX Runtime, Supertone, TTS, 人工智能, 凭据扫描, 可视化界面, 声音克隆, 多语言支持, 安全测试框架, 开源模型, 文本转语音, 无网络依赖, 日志审计, 本地推理, 深度学习, 用户模式Hook绕过, 端侧AI, 端侧推理, 网络安全, 语音合成, 语音生成, 轻量级模型, 边缘计算, 逆向工具, 隐私保护