so-vits-svc README

The project's README from github.com/svc-develop-team/so-vits-svc. As one markdown file: README.md.

LOGO

SoftVC VITS Singing Voice Conversion

English | 中文简体

Open In Colab Licence

This round of limited time update is coming to an end, the warehouse will enter the Archieve state, please know

✨ A studio that contains visible f0 editor, speaker mix timeline editor and other features (Where the Onnx models are used) : MoeVoiceStudio

✨ A fork with a greatly improved user interface: 34j/so-vits-svc-fork

✨ A client supports real-time conversion: w-okada/voice-changer

This project differs fundamentally from VITS, as it focuses on Singing Voice Conversion (SVC) rather than Text-to-Speech (TTS). In this project, TTS functionality is not supported, and VITS is incapable of performing SVC tasks. It's important to note that the models used in these two projects are not interchangeable or universally applicable.

Announcement

The purpose of this project was to enable developers to have their beloved anime characters perform singing tasks. The developers' intention was to focus solely on fictional characters and avoid any involvement of real individuals, anything related to real individuals deviates from the developer's original intention.

Disclaimer

This project is an open-source, offline endeavor, and all members of SvcDevelopTeam, as well as other developers and maintainers involved (hereinafter referred to as contributors), have no control over the project. The contributors have never provided any form of assistance to any organization or individual, including but not limited to dataset extraction, dataset processing, computing support, training support, inference, and so on. The contributors do not and cannot be aware of the purposes for which users utilize the project. Therefore, any AI models and synthesized audio produced through the training of this project are unrelated to the contributors. Any issues or consequences arising from their use are the sole responsibility of the user.

This project is run completely offline and does not collect any user information or gather user input data. Therefore, contributors to this project are not aware of all user input and models and therefore are not responsible for any user input.

This project serves as a framework only and does not possess speech synthesis functionality by itself. All functionalities require users to train the models independently. Furthermore, this project does not come bundled with any models, and any secondary distributed projects are independent of the contributors of this project.

📏 Terms of Use

Warning: Please ensure that you address any authorization issues related to the dataset on your own. You bear full responsibility for any problems arising from the usage of non-authorized datasets for training, as well as any resulting consequences. The repository and its maintainer, svc develop team, disclaim any association with or liability for the consequences.

  1. This project is exclusively established for academic purposes, aiming to facilitate communication and learning. It is not intended for deployment in production environments.
  2. Any sovits-based video posted to a video platform must clearly specify in the introduction the input source vocals and audio used for the voice changer conversion, e.g., if you use someone else's video/audio and convert it by separating the vocals as the input source, you must give a clear link to the original video or music; if you use your own vocals or a voice synthesized by another voice synthesis engine as the input source, you must also state this in your introduction.
  3. You are solely responsible for any infringement issues caused by the input source and all consequences. When using other commercial vocal synthesis software as an input source, please ensure that you comply with the regulations of that software, noting that the regulations of many vocal synthesis engines explicitly state that they cannot be used to convert input sources!
  4. Engaging in illegal activities, as well as religious and political activities, is strictly prohibited when using this project. The project developers vehemently oppose the aforementioned activities. If you disagree with this provision, the usage of the project is prohibited.
  5. If you continue to use the program, you will be deemed to have agreed to the terms and conditions set forth in README and README has discouraged you and is not responsible for any subsequent problems.
  6. If you intend to employ this project for any other purposes, kindly contact and inform the maintainers of this repository in advance.

📝 Model Introduction

The singing voice conversion model uses SoftVC content encoder to extract speech features from the source audio. These feature vectors are directly fed into VITS without the need for conversion to a text-based intermediate representation. As a result, the pitch and intonations of the original audio are preserved. Meanwhile, the vocoder was replaced with NSF HiFiGAN to solve the problem of sound interruption.

🆕 4.1-Stable Version Update Content

🆕 Questions about compatibility with the 4.0 model

  "model": {
    .........
    "ssl_dim": 256,
    "n_speakers": 200,
    "speech_encoder":"vec256l9"
  }

🆕 Shallow diffusion

Diagram

💬 Python Version

Based on our testing, we have determined that the project runs stable on Python 3.8.9.

📥 Pre-trained Model Files

Required

You need to select one encoder from the list below

1. If using contentvec as speech encoder(recommended)

vec768l12 and vec256l9 require the encoder

Or download the following ContentVec, which is only 199MB in size but has the same effect:

# contentvec
wget -P pretrain/ https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/hubert_base.pt -O checkpoint_best_legacy_500.pt
# Alternatively, you can manually download and place it in the hubert directory
2. If hubertsoft is used as the speech encoder
3. If whisper-ppg as the encoder
4. If cnhubertlarge as the encoder
5. If dphubert as the encoder
6. If WavLM is used as the encoder
7. If OnnxHubert/ContentVec as the encoder

List of Encoders

Optional(Strongly recommend)

Get Sovits Pre-trained model from svc-develop-team(TBD) or anywhere else.

Diffusion model references Diffusion-SVC diffusion model. The pre-trained diffusion model is universal with the DDSP-SVC's. You can go to Diffusion-SVC's repo to get the pre-trained diffusion model.

While the pretrained model typically does not pose copyright concerns, it is essential to remain vigilant. It is advisable to consult with the author beforehand or carefully review the description to ascertain the permissible usage of the model. This helps ensure compliance with any specified guidelines or restrictions regarding its utilization.

Optional(Select as Required)

NSF-HIFIGAN

If you are using the NSF-HIFIGAN enhancer or shallow diffusion, you will need to download the pre-trained NSF-HIFIGAN model.

# nsf_hifigan
wget -P pretrain/ https://github.com/openvpi/vocoders/releases/download/nsf-hifigan-v1/nsf_hifigan_20221211.zip
unzip -od pretrain/nsf_hifigan pretrain/nsf_hifigan_20221211.zip
# Alternatively, you can manually download and place it in the pretrain/nsf_hifigan directory
# URL: https://github.com/openvpi/vocoders/releases/tag/nsf-hifigan-v1
RMVPE

If you are using the rmvpe F0 Predictor, you will need to download the pre-trained RMVPE model.

FCPE(Preview version)

FCPE(Fast Context-base Pitch Estimator) is a dedicated F0 predictor designed for real-time voice conversion and will become the preferred F0 predictor for sovits real-time voice conversion in the future.(The paper is being written)

If you are using the fcpe F0 Predictor, you will need to download the pre-trained FCPE model.

📊 Dataset Preparation

Simply place the dataset in the dataset_raw directory with the following file structure:

dataset_raw
├───speaker0
│   ├───xxx1-xxx1.wav
│   ├───...
│   └───Lxx-0xx8.wav
└───speaker1
    ├───xx2-0xxx2.wav
    ├───...
    └───xxx7-xxx007.wav

There are no specific restrictions on the format of the name for each audio file (naming conventions such as 000001.wav to 999999.wav are also valid), but the file type must be `WAV``.

You can customize the speaker's name as showed below:

dataset_raw
└───suijiSUI
    ├───1.wav
    ├───...
    └───25788785-20221210-200143-856_01_(Vocals)_0_0.wav

🛠️ Preprocessing

0. Slice audio

To avoid video memory overflow during training or pre-processing, it is recommended to limit the length of audio clips. Cutting the audio to a length of "5s - 15s" is more recommended. Slightly longer times are acceptable, however, excessively long clips may cause problems such as torch.cuda.OutOfMemoryError.

To facilitate the slicing process, you can use audio-slicer-GUI or audio-slicer-CLI

In general, only the Minimum Interval needs to be adjusted. For spoken audio, the default value usually suffices, while for singing audio, it can be adjusted to around 100 or even 50, depending on the specific requirements.

After slicing, it is recommended to remove any audio clips that are excessively long or too short.

If you are using whisper-ppg encoder for training, the audio clips must shorter than 30s.

1. Resample to 44100Hz and mono

python resample.py

Cautions

Although this project has resample.py scripts for resampling, mono and loudness matching, the default loudness matching is to match to 0db. This can cause damage to the sound quality. While python's loudness matching package pyloudnorm does not limit the level, this can lead to sonic boom. Therefore, it is recommended to consider using professional sound processing software, such as adobe audition for loudness matching. If you are already using other software for loudness matching, add the parameter -skip_loudnorm to the run command:

python resample.py --skip_loudnorm

2. Automatically split the dataset into training and validation sets, and generate configuration files.

python preprocess_flist_config.py --speech_encoder vec768l12

speech_encoder has the following options

vec768l12
vec256l9
hubertsoft
whisper-ppg
cnhubertlarge
dphubert
whisper-ppg-large
wavlmbase+

If the speech_encoder argument is omitted, the default value is vec768l12

Use loudness embedding

Add --vol_aug if you want to enable loudness embedding:

python preprocess_flist_config.py --speech_encoder vec768l12 --vol_aug

After enabling loudness embedding, the trained model will match the loudness of the input source; otherwise, it will match the loudness of the training set.

You can modify some parameters in the generated config.json and diffusion.yaml

diffusion.yaml
List of Vocoders
nsf-hifigan
nsf-snake-hifigan

3. Generate hubert and f0

python preprocess_hubert_f0.py --f0_predictor dio

f0_predictor has the following options

crepe
dio
pm
harvest
rmvpe
fcpe

If the training set is too noisy,it is recommended to use crepe to handle f0

If the f0_predictor parameter is omitted, the default value is rmvpe

If you want shallow diffusion (optional), you need to add the --use_diff parameter, for example:

python preprocess_hubert_f0.py --f0_predictor dio --use_diff

Speed Up preprocess

If your dataset is pretty large,you can increase the param --num_processes like that:

python preprocess_hubert_f0.py --f0_predictor dio --num_processes 8

All the worker will be assigned to different GPU if you have more than one GPUs.

After completing the above steps, the dataset directory will contain the preprocessed data, and the dataset_raw folder can be deleted.

🏋️‍ Training

Sovits Model

python train.py -c configs/config.json -m 44k

Diffusion Model (optional)

If the shallow diffusion function is needed, the diffusion model needs to be trained. The diffusion model training method is as follows:

python train_diff.py -c configs/diffusion.yaml

During training, the model files will be saved to logs/44k, and the diffusion model will be saved to logs/44k/diffusion

🤖 Inference

Use inference_main.py

# Example
python inference_main.py -m "logs/44k/G_30400.pth" -c "configs/config.json" -n "君の知らない物語-src.wav" -t 0 -s "nen"

Required parameters:

Optional parameters: see the next section

so-vits-svc (svc-develop-team/so-vits-svc)

Searching Database…

28.1K ·GitHub
archived
这是什么东西?一个开源的 AI 歌声转换(SVC)框架:它训练 PyTorch 模型,让一个声音去唱另一个人的歌,做法是把 SoftVC 语音特征输入基于 VITS 的模型,再搭配 NSF-HiFiGAN 声码器。
它是拿来就能用的变声软件,还是得我自己训练?它是一个训练和推理框架,不是做好的成品软件——不附带任何模型,每个功能都需要你自己训练。与 VITS 不同的是它只做歌声转换:不支持文字转语音(TTS),两者的模型也不能互换使用。
要得到一个能用的声音模型,大概要做什么?把 WAV 音频准备好(切成 5-15 秒一段,重采样为 44100 Hz 单声道)放进 datasetraw 文件夹,把预训练语音编码器和基础检查点下载到 pretrain/ 和 logs/44k,然后运行预处理和训练脚本。
训练之前需要装好、下载好哪些东西?Python 3.8.9(经测试稳定的版本),另外还要下载预训练文件:一个语音编码器(推荐 ContentVec)、G0.pth 和 D0.pth 基础模型,可选下载 NSF-HiFiGAN 声码器和 RMVPE 音高预测器。
这个项目还在更新吗?不在了——README 已宣布最后一轮限时更新已经结束,仓库进入归档状态,所以别指望后续还有修复或新功能。
我的音频或数据会传到别的地方吗?什么都不会离开你的电脑:项目完全离线运行,不收集任何用户信息或输入数据。
许可证或使用条款里有什么需要注意的地方?采用 AGPL-3.0,另有严格的附加条款:仅限学术用途,不得用于生产环境;发布 SVC 视频时必须注明输入人声的来源;明确禁止用于违法、宗教或政治用途。
我的笔记本能带得动训练,还是必须有真正的显卡?训练实际上需要 CUDA 显卡:批次大小必须装得进显存,音频切得太长会报 torch.cuda.OutOfMemoryError——这也是推荐切成 5-15 秒一段的原因。
作者为什么要做这个项目?是为了让开发者能让自己心爱的动漫角色来唱歌。团队强调它只面向虚构角色——任何涉及真人的使用都偏离了他们的初衷。
它能做实时变声吗?这个仓库本身不行,但 README 推荐了支持实时转换的客户端 w-okada/voice-changer,而 FCPE 音高预测器就是专门为实时变声设计的。
语音编码器可以选哪些?共列出 13 种,包括 vec768l12(默认,使用推荐的 ContentVec)、vec256l9、hubertsoft、whisper-ppg 和 whisper-ppg-large、cnhubertlarge、dphubert、wavlmbase+(WavLM),以及若干 ONNX 变体。
有没有更好用的分支版本或配套工具?有:34j/so-vits-svc-fork 的用户界面大幅改进;MoeVoiceStudio 是一个带可视化 f0 编辑器和说话人混合时间轴的工作室;w-okada voice-changer 客户端则覆盖实时使用场景。
Size
10.9 MB
Stars
28.1K
Updated
CommitOct 03
Age
3y
Commits · 90 Days