Sovits 项目使用教程

Sovits 项目使用教程

Sovits An unofficial implementation of the combination of Soft-VC and VITS Sovits 项目地址: https://gitcode.com/gh_mirrors/so/Sovits

1. 项目介绍

Sovits 是一个基于 Soft-VC 和 VITS 的任意对一声音转换项目。它通过将 VITS 中的 TextEncoder 的词嵌入替换为 Soft-VC 中 ContentEncoder 的输出,实现了无需并行数据即可进行任意声音转换。此外,Sovits2 利用 StarGANv2-VC 中的 f0 模型来获取输入音频的基本频率特征,并将其传递给 VITS 的编码器,从而提高声音质量。

2. 项目快速启动

环境准备

在开始之前,请确保你的环境中已安装以下依赖:

  • Python 3.x
  • pip
  • torch

使用以下命令安装必要的 Python 包:

pip install -r requirements.txt

数据准备

准备音频数据集,音频应为单声道,采样率为 22050 Hz 的 wav 文件。数据集目录结构如下:

wavs/
├── dev/
│   ├── LJ001-0001.wav
│   ├── ...
│   └── LJ050-0278.wav
└── train/
    ├── LJ002-0332.wav
    ├── ...
    └── LJ047-0007.wav

提取语音单元

使用 ContentEncoder 提取音频中的语音单元:

cd path/to/hubert
python3 encode.py soft path/to/wavs/directory -o path/to/soft/directory -e .wav

生成训练和验证的文件列表,文件列表的格式如下:

  • 单扬声器:
path/to/wav|path/to/unit
...
  • 多扬声器:
path/to/wav|id|path/to/unit
...

训练模型

根据你的需求选择以下命令之一来训练模型:

  • 单扬声器:
python train.py -c configs/config.json -m model_name
  • 多扬声器:
python train_ms.py -c configs/config.json -m model_name

你也可以参考 train.ipynb 进行训练。

推断

推断的详细步骤请参考 inference.ipynb

3. 应用案例和最佳实践

  • 案例 1:使用 Sovits 实现语音转换,适用于游戏角色、动画角色或其他音频制作场景。
  • 最佳实践:为了获得更好的转换效果,确保音频质量高,并且在训练时使用足够的训练数据。

4. 典型生态项目

  • 项目 A:一个使用 Sovits 进行实时语音转换的 Web 应用。
  • 项目 B:将 Sovits 集成到智能家居系统中,为不同设备提供个性化的语音反馈。

Sovits An unofficial implementation of the combination of Soft-VC and VITS Sovits 项目地址: https://gitcode.com/gh_mirrors/so/Sovits