Skip to content

Commit

Permalink
Merge pull request Ikaros-521#130 from Ikaros-521/owner
Browse files Browse the repository at this point in the history
GUI适配DDSP-SVC;补充说明文档
  • Loading branch information
Ikaros-521 authored Jul 19, 2023
2 parents 84ff0eb + ecd5f4b commit f1a19e7
Show file tree
Hide file tree
Showing 6 changed files with 213 additions and 10 deletions.
30 changes: 29 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -800,11 +800,36 @@ ChatterBot 的核心思想是:基于历史对话数据,使用机器学习和
个人提供的已训练好的模型:[点我跳转](https://github.com/Ikaros-521/VITS-fast-fine-tuning/releases)
视频教程:[【AI语音合成-数据集篇#00】模型使用简单讲解,手把手演示](https://www.bilibili.com/video/BV1Lm4y1r7Pi)

### DDSP-SVC
官方仓库:[DDSP-SVC](https://github.com/yxlllc/DDSP-SVC)
个人提供的已训练好的模型:[点我跳转](https://github.com/Ikaros-521/DDSP-SVC/releases)
羽毛佬视频教程:[【AI翻唱/变声/整合包】有张N卡就能跑!媲美So-VITS却不吃配置,全新的DDSP-SVC 3.0训练/推理教程](https://www.bilibili.com/video/BV1rs4y1Q7BQ)
修改`flask_api.py`最后几行中的模型路径,其他配置自行调整,另外需要注意!`enable_spk_id_cover`改为`False`,即可接入。
```
# config和模型得同一目录。 这是我自己训练的DDSP模型,新鲜出炉
checkpoint_path = "exp/combsub-test/model_68000.pt"
# 是否使用预训练的基于声码器的增强器增强输出,但对硬件要求更高。
use_vocoder_based_enhancer = True
# 结合增强器使用,0为正常音域范围(最高G5)内的高音频质量,大于0则可以防止超高音破音
enhancer_adaptive_key = 0
# f0提取器,有parselmouth, dio, harvest, crepe
select_pitch_extractor = 'crepe'
# f0范围限制(Hz)
limit_f0_min = 50
limit_f0_max = 1100
# 音量响应阈值(dB)
threhold = -60
# 默认说话人。
spk_id = 1
# 是否优先使用默认说话人覆盖vst传入的参数,改为False,不要覆盖!!!
enable_spk_id_cover = False
```

### so-vits-svc
官方仓库:[so-vits-svc](https://github.com/svc-develop-team/so-vits-svc)
个人提供的已训练好的模型:[点我跳转](https://github.com/Ikaros-521/so-vits-svc/releases)
视频教程:[【AI歌姬】so-vits-svc 简单使用讲解 + 伊卡洛斯 模型开源](https://www.bilibili.com/video/BV1k24y1F7Us)
修改`flask_api_full_song.py`最后几行中的模型和配置路径,运行,配置相关信息即可接入。
修改`flask_api_full_song.py`最后几行中的模型路径,运行,配置相关信息即可接入。
```
if __name__ == '__main__':
model_name = "logs/44k/ikaros_G_54600.pth" # 你的模型地址
Expand Down Expand Up @@ -1062,6 +1087,9 @@ cmd输入命令即可:`doctoc /path/to/file`
- 优化抖音日志信息,只输出info信息,不在输出debug日志,更加清爽。
- 接入DDSP-SVC,简单测试了下,效果好像不太对。优化了变声部分的代码

### 2023-07-19
- GUI适配DDSP-SVC;补充说明文档

</details>


Expand Down
61 changes: 60 additions & 1 deletion UI_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def setupUi(self, MainWindow):
self.scrollArea.setWidgetResizable(True)
self.scrollArea.setObjectName("scrollArea")
self.scrollAreaWidgetContents = QtWidgets.QWidget()
self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 980, 5794))
self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, -4345, 980, 6162))
self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents")
self.verticalLayout = QtWidgets.QVBoxLayout(self.scrollAreaWidgetContents)
self.verticalLayout.setContentsMargins(35, 20, 35, 20)
Expand Down Expand Up @@ -746,6 +746,56 @@ def setupUi(self, MainWindow):
self.gridLayout_33.addWidget(self.lineEdit_choose_song_match_fail_copy, 4, 1, 1, 1)
self.gridLayout_34.addLayout(self.gridLayout_33, 0, 0, 1, 1)
self.verticalLayout.addWidget(self.groupBox_choose_song)
self.groupBox_ddsp_svc = QtWidgets.QGroupBox(self.scrollAreaWidgetContents)
self.groupBox_ddsp_svc.setObjectName("groupBox_ddsp_svc")
self.gridLayout_49 = QtWidgets.QGridLayout(self.groupBox_ddsp_svc)
self.gridLayout_49.setObjectName("gridLayout_49")
self.gridLayout_48 = QtWidgets.QGridLayout()
self.gridLayout_48.setObjectName("gridLayout_48")
self.label_ddsp_svc_enable = QtWidgets.QLabel(self.groupBox_ddsp_svc)
self.label_ddsp_svc_enable.setObjectName("label_ddsp_svc_enable")
self.gridLayout_48.addWidget(self.label_ddsp_svc_enable, 0, 0, 1, 1)
self.label_ddsp_svc_fSafePrefixPadLength = QtWidgets.QLabel(self.groupBox_ddsp_svc)
self.label_ddsp_svc_fSafePrefixPadLength.setObjectName("label_ddsp_svc_fSafePrefixPadLength")
self.gridLayout_48.addWidget(self.label_ddsp_svc_fSafePrefixPadLength, 3, 0, 1, 1)
self.lineEdit_ddsp_svc_sSpeakId = QtWidgets.QLineEdit(self.groupBox_ddsp_svc)
self.lineEdit_ddsp_svc_sSpeakId.setObjectName("lineEdit_ddsp_svc_sSpeakId")
self.gridLayout_48.addWidget(self.lineEdit_ddsp_svc_sSpeakId, 5, 1, 1, 1)
self.checkBox_ddsp_svc_enable = QtWidgets.QCheckBox(self.groupBox_ddsp_svc)
self.checkBox_ddsp_svc_enable.setObjectName("checkBox_ddsp_svc_enable")
self.gridLayout_48.addWidget(self.checkBox_ddsp_svc_enable, 0, 1, 1, 1)
self.lineEdit_ddsp_svc_api_ip_port = QtWidgets.QLineEdit(self.groupBox_ddsp_svc)
self.lineEdit_ddsp_svc_api_ip_port.setObjectName("lineEdit_ddsp_svc_api_ip_port")
self.gridLayout_48.addWidget(self.lineEdit_ddsp_svc_api_ip_port, 2, 1, 1, 1)
self.label_ddsp_svc_api_ip_port = QtWidgets.QLabel(self.groupBox_ddsp_svc)
self.label_ddsp_svc_api_ip_port.setObjectName("label_ddsp_svc_api_ip_port")
self.gridLayout_48.addWidget(self.label_ddsp_svc_api_ip_port, 2, 0, 1, 1)
self.label_ddsp_svc_config_path = QtWidgets.QLabel(self.groupBox_ddsp_svc)
self.label_ddsp_svc_config_path.setObjectName("label_ddsp_svc_config_path")
self.gridLayout_48.addWidget(self.label_ddsp_svc_config_path, 1, 0, 1, 1)
self.lineEdit_ddsp_svc_fSafePrefixPadLength = QtWidgets.QLineEdit(self.groupBox_ddsp_svc)
self.lineEdit_ddsp_svc_fSafePrefixPadLength.setObjectName("lineEdit_ddsp_svc_fSafePrefixPadLength")
self.gridLayout_48.addWidget(self.lineEdit_ddsp_svc_fSafePrefixPadLength, 3, 1, 1, 1)
self.lineEdit_ddsp_svc_fPitchChange = QtWidgets.QLineEdit(self.groupBox_ddsp_svc)
self.lineEdit_ddsp_svc_fPitchChange.setObjectName("lineEdit_ddsp_svc_fPitchChange")
self.gridLayout_48.addWidget(self.lineEdit_ddsp_svc_fPitchChange, 4, 1, 1, 1)
self.label_ddsp_svc_sSpeakId = QtWidgets.QLabel(self.groupBox_ddsp_svc)
self.label_ddsp_svc_sSpeakId.setObjectName("label_ddsp_svc_sSpeakId")
self.gridLayout_48.addWidget(self.label_ddsp_svc_sSpeakId, 5, 0, 1, 1)
self.lineEdit_ddsp_svc_config_path = QtWidgets.QLineEdit(self.groupBox_ddsp_svc)
self.lineEdit_ddsp_svc_config_path.setObjectName("lineEdit_ddsp_svc_config_path")
self.gridLayout_48.addWidget(self.lineEdit_ddsp_svc_config_path, 1, 1, 1, 1)
self.label_ddsp_svc_fPitchChange = QtWidgets.QLabel(self.groupBox_ddsp_svc)
self.label_ddsp_svc_fPitchChange.setObjectName("label_ddsp_svc_fPitchChange")
self.gridLayout_48.addWidget(self.label_ddsp_svc_fPitchChange, 4, 0, 1, 1)
self.label_ddsp_svc_sampleRate = QtWidgets.QLabel(self.groupBox_ddsp_svc)
self.label_ddsp_svc_sampleRate.setObjectName("label_ddsp_svc_sampleRate")
self.gridLayout_48.addWidget(self.label_ddsp_svc_sampleRate, 6, 0, 1, 1)
self.lineEdit_ddsp_svc_sampleRate = QtWidgets.QLineEdit(self.groupBox_ddsp_svc)
self.lineEdit_ddsp_svc_sampleRate.setObjectName("lineEdit_ddsp_svc_sampleRate")
self.gridLayout_48.addWidget(self.lineEdit_ddsp_svc_sampleRate, 6, 1, 1, 1)
self.gridLayout_49.addLayout(self.gridLayout_48, 0, 0, 1, 1)
self.verticalLayout.addWidget(self.groupBox_ddsp_svc)
self.groupBox_so_vits_svc = QtWidgets.QGroupBox(self.scrollAreaWidgetContents)
self.groupBox_so_vits_svc.setObjectName("groupBox_so_vits_svc")
self.gridLayout_36 = QtWidgets.QGridLayout(self.groupBox_so_vits_svc)
Expand Down Expand Up @@ -1440,6 +1490,15 @@ def retranslateUi(self, MainWindow):
self.label_choose_song_song_path.setText(_translate("MainWindow", "歌曲路径"))
self.checkBox_choose_song_enable.setText(_translate("MainWindow", "是"))
self.label_choose_song_match_fail_copy.setText(_translate("MainWindow", "匹配失败文案"))
self.groupBox_ddsp_svc.setTitle(_translate("MainWindow", "DDSP_SVC"))
self.label_ddsp_svc_enable.setText(_translate("MainWindow", "启用"))
self.label_ddsp_svc_fSafePrefixPadLength.setText(_translate("MainWindow", "安全前缀填充长度"))
self.checkBox_ddsp_svc_enable.setText(_translate("MainWindow", "是"))
self.label_ddsp_svc_api_ip_port.setText(_translate("MainWindow", "API地址"))
self.label_ddsp_svc_config_path.setText(_translate("MainWindow", "配置文件路径"))
self.label_ddsp_svc_sSpeakId.setText(_translate("MainWindow", "说话人ID"))
self.label_ddsp_svc_fPitchChange.setText(_translate("MainWindow", "变调"))
self.label_ddsp_svc_sampleRate.setText(_translate("MainWindow", "采样率"))
self.groupBox_so_vits_svc.setTitle(_translate("MainWindow", "so-vits-svc"))
self.checkBox_so_vits_svc_enable.setText(_translate("MainWindow", "是"))
self.label_so_vits_svc_config_path.setText(_translate("MainWindow", "配置文件路径"))
Expand Down
6 changes: 3 additions & 3 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@
"enable": false,
"config_path": "E:\\DDSP-SVC-3.0\\exp\\combsub-test\\config.yaml",
"api_ip_port": "http://127.0.0.1:6844",
"fSafePrefixPadLength": 0,
"fPitchChange": 0,
"sSpeakId": 3,
"fSafePrefixPadLength": 0.0,
"fPitchChange": 0.0,
"sSpeakId": 0,
"sampleRate": 44100
},
"so_vits_svc": {
Expand Down
6 changes: 3 additions & 3 deletions config.json.bak
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@
"enable": false,
"config_path": "E:\\DDSP-SVC-3.0\\exp\\combsub-test\\config.yaml",
"api_ip_port": "http://127.0.0.1:6844",
"fSafePrefixPadLength": 0,
"fPitchChange": 0,
"sSpeakId": 3,
"fSafePrefixPadLength": 0.0,
"fPitchChange": 0.0,
"sSpeakId": 0,
"sampleRate": 44100
},
"so_vits_svc": {
Expand Down
29 changes: 29 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,15 @@ def init_config(self):
self.ui.label_choose_song_song_path.setToolTip("歌曲音频路径(默认为本项目的song文件夹)")
self.ui.label_choose_song_match_fail_copy.setToolTip("匹配失败返回的音频文案 注意 {content} 这个是用于替换用户发送的歌名的,请务必不要乱删!影响使用!")

# DDSP-SVC
self.ui.label_ddsp_svc_enable.setToolTip("是否启用DDSP-SVC进行音频的变声")
self.ui.label_ddsp_svc_config_path.setToolTip("模型配置文件config.yaml的路径(此处可以不配置,暂时没有用到)")
self.ui.label_ddsp_svc_api_ip_port.setToolTip("flask_api服务运行的ip端口,例如:http://127.0.0.1:6844")
self.ui.label_ddsp_svc_fSafePrefixPadLength.setToolTip("安全前缀填充长度,不知道干啥用,默认为0")
self.ui.label_ddsp_svc_fPitchChange.setToolTip("音调设置,默认为0")
self.ui.label_ddsp_svc_sSpeakId.setToolTip("说话人ID,需要和模型数据对应,默认为0")
self.ui.label_ddsp_svc_sampleRate.setToolTip("DAW所需的采样率,默认为44100")

# so-vits-svc
self.ui.label_so_vits_svc_enable.setToolTip("是否启用so-vits-svc进行音频的变声")
self.ui.label_so_vits_svc_config_path.setToolTip("模型配置文件config.json的路径")
Expand Down Expand Up @@ -648,6 +657,16 @@ def init_config(self):
self.ui.lineEdit_choose_song_song_path.setText(self.choose_song_config['song_path'])
self.ui.lineEdit_choose_song_match_fail_copy.setText(self.choose_song_config['match_fail_copy'])

# ddsp-svc
if config.get("ddsp_svc", "enable"):
self.ui.checkBox_ddsp_svc_enable.setChecked(True)
self.ui.lineEdit_ddsp_svc_config_path.setText(config.get("ddsp_svc", "config_path"))
self.ui.lineEdit_ddsp_svc_api_ip_port.setText(config.get("ddsp_svc", "api_ip_port"))
self.ui.lineEdit_ddsp_svc_fSafePrefixPadLength.setText(str(config.get("ddsp_svc", "fSafePrefixPadLength")))
self.ui.lineEdit_ddsp_svc_fPitchChange.setText(str(config.get("ddsp_svc", "fPitchChange")))
self.ui.lineEdit_ddsp_svc_sSpeakId.setText(str(config.get("ddsp_svc", "sSpeakId")))
self.ui.lineEdit_ddsp_svc_sampleRate.setText(str(config.get("ddsp_svc", "sampleRate")))

if self.so_vits_svc_config['enable']:
self.ui.checkBox_so_vits_svc_enable.setChecked(True)
self.ui.lineEdit_so_vits_svc_config_path.setText(self.so_vits_svc_config['config_path'])
Expand Down Expand Up @@ -1084,6 +1103,16 @@ def save(self):
config_data["choose_song"]["song_path"] = self.ui.lineEdit_choose_song_song_path.text()
config_data["choose_song"]["match_fail_copy"] = self.ui.lineEdit_choose_song_match_fail_copy.text()

# DDSP-SVC
config_data["ddsp_svc"]["enable"] = self.ui.checkBox_ddsp_svc_enable.isChecked()
config_data["ddsp_svc"]["config_path"] = self.ui.lineEdit_ddsp_svc_config_path.text()
config_data["ddsp_svc"]["api_ip_port"] = self.ui.lineEdit_ddsp_svc_api_ip_port.text()
config_data["ddsp_svc"]["fSafePrefixPadLength"] = round(float(self.ui.lineEdit_ddsp_svc_fSafePrefixPadLength.text()), 1)
config_data["ddsp_svc"]["fPitchChange"] = round(float(self.ui.lineEdit_ddsp_svc_fPitchChange.text()), 1)
config_data["ddsp_svc"]["sSpeakId"] = int(self.ui.lineEdit_ddsp_svc_sSpeakId.text())
config_data["ddsp_svc"]["sampleRate"] = int(self.ui.lineEdit_ddsp_svc_sampleRate.text())

# so-vits-svc
config_data["so_vits_svc"]["enable"] = self.ui.checkBox_so_vits_svc_enable.isChecked()
config_data["so_vits_svc"]["config_path"] = self.ui.lineEdit_so_vits_svc_config_path.text()
config_data["so_vits_svc"]["api_ip_port"] = self.ui.lineEdit_so_vits_svc_api_ip_port.text()
Expand Down
91 changes: 89 additions & 2 deletions ui/main.ui
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ font: 75 12pt &quot;微软雅黑&quot;;</string>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<y>-4345</y>
<width>980</width>
<height>5794</height>
<height>6162</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
Expand Down Expand Up @@ -1448,6 +1448,93 @@ font: 75 12pt &quot;微软雅黑&quot;;</string>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_ddsp_svc">
<property name="title">
<string>DDSP_SVC</string>
</property>
<layout class="QGridLayout" name="gridLayout_49">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_48">
<item row="0" column="0">
<widget class="QLabel" name="label_ddsp_svc_enable">
<property name="text">
<string>启用</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_ddsp_svc_fSafePrefixPadLength">
<property name="text">
<string>安全前缀填充长度</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="lineEdit_ddsp_svc_sSpeakId"/>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="checkBox_ddsp_svc_enable">
<property name="text">
<string>是</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEdit_ddsp_svc_api_ip_port"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_ddsp_svc_api_ip_port">
<property name="text">
<string>API地址</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_ddsp_svc_config_path">
<property name="text">
<string>配置文件路径</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="lineEdit_ddsp_svc_fSafePrefixPadLength"/>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="lineEdit_ddsp_svc_fPitchChange"/>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_ddsp_svc_sSpeakId">
<property name="text">
<string>说话人ID</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEdit_ddsp_svc_config_path"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_ddsp_svc_fPitchChange">
<property name="text">
<string>变调</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_ddsp_svc_sampleRate">
<property name="text">
<string>采样率</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLineEdit" name="lineEdit_ddsp_svc_sampleRate"/>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_so_vits_svc">
<property name="title">
Expand Down

0 comments on commit f1a19e7

Please sign in to comment.