一个插件,通过调用在线或本地api发送TTS语音
Project description
⭐ 介绍
仅需一条5秒语音素材,就可完美优秀克隆素材本音呐!
你只需要准备好你想克隆的角色语音,并对其语音进行文件名的标注(见下文),就可以快速生成语音。或者使用官方在线api -> fish-audio即可享受快速云端的语音生成。
📜 免责声明
[!note] 本插件仅供学习和研究使用,使用者需自行承担使用插件的风险。作者不对插件的使用造成的任何损失或问题负责。请合理使用插件,遵守相关法律法规。 使用本插件即表示您已阅读并同意遵守以上免责声明。如果您不同意或无法遵守以上声明,请不要使用本插件。
💿 安装
安装
pipx
安装
pipx install nonebot-plugin-fishspeech-tts -U
[!note] 在nonebot的pyproject.toml中的plugins = ["xxx"]添加此插件
nb-cli
安装
nb plugin install nonebot-plugin-fishspeech-tts -U
git clone
安装(不推荐)
- 命令窗口
cmd
下运行
git clone https://github.com/Cvandia/nonebot-plugin-fishspeech-tts
- 在窗口运行处
将文件夹
nonebot-plugin-fishspeech-tts
复制到bot根目录下的src/plugins
(或创建bot时的其他名称xxx/plugins
)
注意
推荐镜像站下载
清华源https://pypi.tuna.tsinghua.edu.cn/simple
阿里源https://mirrors.aliyun.com/pypi/simple/
⚙️ 配置
在.env中添加以下配置
基础配置 | 类型 | 必填项 | 默认值 | 说明 |
---|---|---|---|---|
tts_is_online | bool | 是 | True | 是否使用云端api |
tts_chunk_length | literal | 否 | "normal" | 请求时音频分片长度,默认为normal,可选:short, normal, long |
tts_is_to_me | bool | 否 | True | 是否仅当被@时回复 |
tts_audio_path | str | 否 | "./data/参考音频" | 语音素材路径,默认为"./data/参考音频" |
注:参考音频的文件名格式为:[角色名]音频对应的文字标签.[音频后缀名]
! 支持同一角色的不同语音 !
音频后缀目前支持有详见files.py中的AUDIO_FILE_SUFFIX
如果你想使用官方的api,请将配置项tts_is_online
设置为True
并配置以下
配置项 | 类型 | 必填项 | 默认值 | 说明 |
---|---|---|---|---|
online_authorization | str | 是 | "xxxxx" | 官网api鉴权秘钥,详见链接 |
online_model_first | bool | 否 | True | 如果你想调用官方模型,通过自己的参考音频,定制角色音色,将此项设为False 。当然,如果你没有准备参考音频,也是会调用官网已经有的音色,具体详见链接 |
如果你想使用自搭或者其他的fish-speech项目的api,请将配置项tts_is_online
设置为Fasle
并配置以下
配置项 | 类型 | 必填项 | 默认值 | 说明 |
---|---|---|---|---|
offline_api_url | str | 是 | "http://127.0.0.1:8080" | 你的fish-speech api地址 |
⭐ 使用
[!note] 请注意你的
COMMAND_START
以及上述配置项。
指令:
指令 | 需要@ | 范围 | 说明 | 权限 |
---|---|---|---|---|
xxx说xxx | 根据配置 | all | tts语音生成 | all |
语音列表 | 是 | all | 获取所有角色列表 | all |
语音余额 | 是 | all | 查询api余额 | all |
🌙 未来
- 暂无规划
💝 特别鸣谢
- nonebot2: 本项目的基础,非常好用的聊天机器人框架。
- fish-speech:零样本 & 小样本 TTS:输入 10 到 30 秒的声音样本即可生成高质量的 TTS 输出
⭐ 额外帮助
离线搭建fish-speech
- 1.将
fish-speech
仓库git clone
至本地 - 2.运行
install_env.bat
安装虚拟环境以及所需依赖 - 3.运行
start.bat
初次启动 - 4.修改
API_FLAGS.txt
后再次启动即可
启动API服务
- 1.修改
API_FLAGS.txt
大致为,即取消api
前面的#
号
# --infer
--api
--listen 0.0.0.0:8080 \ #监听接口
...
在API_FLAGS.txt
里添加额外参数
- 1.
--complie
->是否启动编译后的模型 (更快的生成tts,但启动较慢) - 2.
--workers 数字
->启动数字
个多协程 (请务必设置,因为默认一个容易阻塞) - 3.更多参考官方文档
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
Hashes for nonebot_plugin_fishspeech_tts-0.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59e3c1726cd981e51519b3842e7c5a734c0424696f5f26f960809a74fbf4dfa7 |
|
MD5 | c69feba9501b48c0412a068946314132 |
|
BLAKE2b-256 | 0339c40ed481222153fd253c01e3ade66a0a86c00e5844dc0bbc6720fa93b3ac |
Hashes for nonebot_plugin_fishspeech_tts-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aed497a5c6e1c08f67e91e356441291dba9901149f5ddc1574ee54c3b993aa97 |
|
MD5 | 5142909b444f625f08116bc46780c32b |
|
BLAKE2b-256 | aa606c140cee4f097be3c4ad0f66d1529ea2c99565c6ebfac5b86ea4ff4e78a9 |