Skip to main content

小样本TTS,通过调用在线或本地api发送TTS语音

Project description

nonebot-plugin-fishspeech-tts

⭐基于Nonebot2的调用在线fish-audio或离线fish-speech api⭐ ⭐文本生成语音tts插件⭐

中文简体 | English


⭐ 介绍

仅需一条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-speechapi地址

⭐ 使用

[!note] 请注意你的 COMMAND_START 以及上述配置项。

指令:

指令 需要@ 范围 说明 权限
xxx说xxx 根据配置 all tts语音生成 all
语音列表 all 获取所有角色列表 all
语音余额 all 查询api余额 all

🌙 未来

  • 暂无规划
喜欢记得点个star⭐

💝 特别鸣谢

  • nonebot2: 本项目的基础,非常好用的聊天机器人框架。
  • fish-speech:零样本 & 小样本 TTS:输入 10 到 30 秒的声音样本即可生成高质量的 TTS 输出

⭐ 额外帮助

离线搭建简略教程

准备fish-speech

  • 1.将fish-speech 仓库 git clone 至本地
git clone https://github.com/fishaudio/fish-speech
  • 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nonebot_plugin_fishspeech_tts-0.2.4.tar.gz (11.8 kB view hashes)

Uploaded Source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page