LiveKit Agent Plugins for FlashTTS
Project description
livekit-plugins-flashtts
FlashTTS 开源TTS推理框架专用的 LiveKit Agents 插件,支持Spark-TTS、MegaTTS等开源模型部署。
✨ 特性
- 🗣️ 语音合成 (TTS) - 支持FlashTTS框架的多种开源TTS模型
- 🚀 高性能 - 快速的TTS推理速度
- 🔧 灵活部署 - 支持本地和远程API部署
- 📦 开箱即用 - 完整的 Python 包支持
📋 支持的服务
| 服务 | 描述 | 文档链接 |
|---|---|---|
| TTS | 语音合成 | FlashTTS |
🛠️ 安装
使用 pip 安装
pip install livekit-plugins-flashtts
从源码安装
git clone https://github.com/your-repo/livekit-plugins-volcengine.git
cd livekit-plugins-volcengine
pip install -e ./livekit-plugins/livekit-plugins-flashtts
系统要求
- Python >= 3.9
- LiveKit Agents >= 1.2.9
⚙️ 配置
环境变量
在使用插件前,请配置以下环境变量:
| 环境变量 | 描述 | 默认值 |
|---|---|---|
FLASHTTS_API_URL |
FlashTTS API地址 | http://localhost:8000 |
FLASHTTS_API_KEY |
FlashTTS API密钥 | 空 |
.env 文件示例
# .env
FLASHTTS_API_URL=http://localhost:8000
FLASHTTS_API_KEY=your_api_key_here
📖 使用指南
基础使用
from livekit.agents import Agent, AgentSession, JobContext, cli, WorkerOptions
from livekit.plugins import flashtts
from dotenv import load_dotenv
async def entry_point(ctx: JobContext):
agent = Agent(instructions="You are a helpful assistant.")
session = AgentSession(
# 语音合成
tts=flashtts.TTS(voice="female")
)
await session.start(agent=agent, room=ctx.room)
await ctx.connect()
if __name__ == "__main__":
load_dotenv()
cli.run_app(WorkerOptions(entrypoint_fnc=entry_point))
高级配置
from livekit.plugins import flashtts
# 自定义TTS配置
tts = flashtts.TTS(
voice="female", # 语音类型
api_url="http://localhost:8000", # API地址 (可选,从环境变量获取)
api_key="your_api_key" # API密钥 (可选,从环境变量获取)
)
🔧 API 参考
TTS (语音合成)
flashtts.TTS(
voice: str = "female", # 语音类型
api_url: str = None, # API地址 (从环境变量获取)
api_key: str = None # API密钥 (从环境变量获取)
)
❓ 常见问题
Q: 如何部署FlashTTS服务?
A: 请参考FlashTTS官方文档进行部署。部署完成后,将API地址配置到环境变量中。
Q: 支持哪些TTS模型?
A: FlashTTS支持多种开源TTS模型,包括:
- Spark-TTS
- MegaTTS
- 其他兼容的开源TTS模型
Q: 如何自定义语音类型?
A: 语音类型参数 voice 取决于您部署的FlashTTS服务支持的语音模型。可用选项请参考您的FlashTTS服务配置。
Q: 如何提高TTS性能?
A: 可以通过以下方式优化性能:
- 使用高性能GPU部署FlashTTS服务
- 选择合适的模型大小
- 优化网络连接质量
- 使用本地部署减少网络延迟
📝 更新日志
v1.2.9
- 支持FlashTTS框架的多种开源TTS模型
- 支持本地和远程API部署
- 完善的API文档和使用示例
🤝 贡献
欢迎提交 Issue 和 Pull Request!
📄 许可证
本项目采用 Apache 2.0 许可证。
🙏 致谢
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file livekit_plugins_flashtts-1.2.9.post0.tar.gz.
File metadata
- Download URL: livekit_plugins_flashtts-1.2.9.post0.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9526cd6d5d0e622b93f98a454c410b4dfc9afcf12b2505b3383584cc05b893f5
|
|
| MD5 |
43eb5df79f54d32af548ecea6859e177
|
|
| BLAKE2b-256 |
9a3033fefc850f96e98146dd43b0fff495f203db6a2c50dbce5b1e9f92c1b725
|
File details
Details for the file livekit_plugins_flashtts-1.2.9.post0-py3-none-any.whl.
File metadata
- Download URL: livekit_plugins_flashtts-1.2.9.post0-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96bbde7f83dd6672ad72d9ec9d6588743f65ab81c0e5a7897e6b545dcf01434c
|
|
| MD5 |
2557db68545385eece05fe821e9c3978
|
|
| BLAKE2b-256 |
ca885d86955ff3796cc0f08fbe9af74745444443b0c8215b4ce07f1bb1e66d6f
|