From 4ce60dc2b2f32f9fe20c3ecb955e000f55b33047 Mon Sep 17 00:00:00 2001 From: limbang <495071565@qq.com> Date: Wed, 12 Apr 2023 23:56:41 +0800 Subject: [PATCH 1/6] =?UTF-8?q?fix:=20#140=20shell=3DTrue=20=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E7=9A=84Mac=E3=80=81Linux=E6=8A=A5=E9=94=99=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8DMac=E3=80=81Linux=20"shell=3DTrue"=20?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E7=9A=84=E6=8A=A5=E9=94=99,Win=E5=8E=BB?= =?UTF-8?q?=E9=99=A4=E8=BF=99=E4=B8=AA=E4=B9=9F=E4=BC=9A=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webUI.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/webUI.py b/webUI.py index fb81089..33ccc01 100644 --- a/webUI.py +++ b/webUI.py @@ -106,11 +106,11 @@ def tts_func(_text,_rate): elif _rate<0: ratestr="{:.0%}".format(_rate)#减号自带 - p=subprocess.Popen(["edge-tts", - "--text",_text, - "--write-media",output_file, - "--voice",voice, - "--rate="+ratestr] + p=subprocess.Popen("edge-tts "+ + " --text "+_text+ + " --write-media "+output_file+ + " --voice "+voice+ + " --rate="+ratestr ,shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE) From 86ae5963644d1219e8c57d6e24a2f7bf1bc3c934 Mon Sep 17 00:00:00 2001 From: limbang <495071565@qq.com> Date: Thu, 13 Apr 2023 00:01:10 +0800 Subject: [PATCH 2/6] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=20edge-tts=20?= =?UTF-8?q?=E7=94=9F=E6=88=90=E6=97=B6=E7=94=B7=E6=80=A7=E5=A5=B3=E6=80=A7?= =?UTF-8?q?=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webUI.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/webUI.py b/webUI.py index 33ccc01..034d41b 100644 --- a/webUI.py +++ b/webUI.py @@ -93,11 +93,12 @@ def vc_fn(sid, input_audio, vc_transform, auto_f0,cluster_ratio, slice_db, noise raise gr.Error(e) -def tts_func(_text,_rate): +def tts_func(_text,_rate,_voice): #使用edge-tts把文字转成音频 # voice = "zh-CN-XiaoyiNeural"#女性,较高音 # voice = "zh-CN-YunxiNeural"#男性 voice = "zh-CN-YunxiNeural"#男性 + if ( _voice == "女" ) : voice = "zh-CN-XiaoyiNeural" output_file = _text[0:10]+".wav" # communicate = edge_tts.Communicate(_text, voice) # await communicate.save(output_file) @@ -114,13 +115,13 @@ def tts_func(_text,_rate): ,shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE) - p.wait() + p.wait() return output_file -def vc_fn2(sid, input_audio, vc_transform, auto_f0,cluster_ratio, slice_db, noise_scale,pad_seconds,cl_num,lg_num,lgr_num,text2tts,tts_rate,F0_mean_pooling,enhancer_adaptive_key): +def vc_fn2(sid, input_audio, vc_transform, auto_f0,cluster_ratio, slice_db, noise_scale,pad_seconds,cl_num,lg_num,lgr_num,text2tts,tts_rate,tts_voice,F0_mean_pooling,enhancer_adaptive_key): #使用edge-tts把文字转成音频 - output_file=tts_func(text2tts,tts_rate) + output_file=tts_func(text2tts,tts_rate,tts_voice) #调整采样率 sr2=44100 @@ -130,7 +131,7 @@ def vc_fn2(sid, input_audio, vc_transform, auto_f0,cluster_ratio, slice_db, nois wavfile.write(save_path2,sr2, (wav2 * np.iinfo(np.int16).max).astype(np.int16) ) - + #读取音频 sample_rate, data=gr_pu.audio_from_file(save_path2) vc_input=(sample_rate, data) @@ -172,7 +173,7 @@ with gr.Blocks( sid = gr.Dropdown(label="音色(说话人)") sid_output = gr.Textbox(label="Output Message") - + with gr.Row(variant="panel"): with gr.Column(): gr.Markdown(value=""" @@ -184,7 +185,7 @@ with gr.Blocks( cluster_ratio = gr.Number(label="聚类模型混合比例,0-1之间,0即不启用聚类。使用聚类模型能提升音色相似度,但会导致咬字下降(如果使用建议0.5左右)", value=0) slice_db = gr.Number(label="切片阈值", value=-40) noise_scale = gr.Number(label="noise_scale 建议不要动,会影响音质,玄学参数", value=0.4) - with gr.Column(): + with gr.Column(): pad_seconds = gr.Number(label="推理音频pad秒数,由于未知原因开头结尾会有异响,pad一小段静音段后就不会出现", value=0.5) cl_num = gr.Number(label="音频自动切片,0为不切片,单位为秒(s)", value=0) lg_num = gr.Number(label="两端音频切片的交叉淡入长度,如果自动切片后出现人声不连贯可调整该数值,如果连贯建议采用默认值0,注意,该设置会影响推理速度,单位为秒/s", value=0) @@ -197,6 +198,7 @@ with gr.Blocks( with gr.TabItem("文字转音频"): text2tts=gr.Textbox(label="在此输入要转译的文字。注意,使用该功能建议打开F0预测,不然会很怪") tts_rate = gr.Number(label="tts语速", value=0) + tts_voice = gr.Radio(label="性别",choices=["男","女"], value="男") vc_submit2 = gr.Button("文字转换", variant="primary") with gr.Row(): with gr.Column(): @@ -205,7 +207,7 @@ with gr.Blocks( vc_output2 = gr.Audio(label="Output Audio", interactive=False) vc_submit.click(vc_fn, [sid, vc_input3, vc_transform,auto_f0,cluster_ratio, slice_db, noise_scale,pad_seconds,cl_num,lg_num,lgr_num,F0_mean_pooling,enhancer_adaptive_key], [vc_output1, vc_output2]) - vc_submit2.click(vc_fn2, [sid, vc_input3, vc_transform,auto_f0,cluster_ratio, slice_db, noise_scale,pad_seconds,cl_num,lg_num,lgr_num,text2tts,tts_rate,F0_mean_pooling,enhancer_adaptive_key], [vc_output1, vc_output2]) + vc_submit2.click(vc_fn2, [sid, vc_input3, vc_transform,auto_f0,cluster_ratio, slice_db, noise_scale,pad_seconds,cl_num,lg_num,lgr_num,text2tts,tts_rate,tts_voice,F0_mean_pooling,enhancer_adaptive_key], [vc_output1, vc_output2]) model_load_button.click(modelAnalysis,[model_path,config_path,cluster_model_path,device,enhance],[sid,sid_output]) model_unload_button.click(modelUnload,[],[sid,sid_output]) app.launch() From ce38277539f2f58b74756d721d7176f47fef4106 Mon Sep 17 00:00:00 2001 From: EngsShi Date: Thu, 13 Apr 2023 03:31:53 +0800 Subject: [PATCH 3/6] add webUI.py input text clear fun edge-tts parameters must be pure --- webUI.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/webUI.py b/webUI.py index 8fc29f2..14c2736 100644 --- a/webUI.py +++ b/webUI.py @@ -124,9 +124,12 @@ def tts_func(_text,_rate,_voice): p.wait() return output_file +def text_clear(text): + return re.sub(r"[\n\,\(\) ]", "", text) def vc_fn2(sid, input_audio, vc_transform, auto_f0,cluster_ratio, slice_db, noise_scale,pad_seconds,cl_num,lg_num,lgr_num,text2tts,tts_rate,tts_voice,F0_mean_pooling,enhancer_adaptive_key): #使用edge-tts把文字转成音频 + text2tts=text_clear(text2tts) output_file=tts_func(text2tts,tts_rate,tts_voice) #调整采样率 From 4b27899f5383709b4200a838eb13b74a1b5975fd Mon Sep 17 00:00:00 2001 From: EngsShi Date: Thu, 13 Apr 2023 03:34:33 +0800 Subject: [PATCH 4/6] remove double btn --- webUI.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/webUI.py b/webUI.py index 14c2736..af2aa72 100644 --- a/webUI.py +++ b/webUI.py @@ -224,9 +224,8 @@ with gr.Blocks( """) debug_button = gr.Checkbox(label="Debug模式,如果向社区反馈BUG需要打开,打开后控制台可以显示具体错误提示", value=debug) vc_submit.click(vc_fn, [sid, vc_input3, vc_transform,auto_f0,cluster_ratio, slice_db, noise_scale,pad_seconds,cl_num,lg_num,lgr_num,F0_mean_pooling,enhancer_adaptive_key], [vc_output1, vc_output2]) - vc_submit2.click(vc_fn2, [sid, vc_input3, vc_transform,auto_f0,cluster_ratio, slice_db, noise_scale,pad_seconds,cl_num,lg_num,lgr_num,text2tts,tts_rate,F0_mean_pooling,enhancer_adaptive_key], [vc_output1, vc_output2]) - debug_button.change(debug_change,[],[]) vc_submit2.click(vc_fn2, [sid, vc_input3, vc_transform,auto_f0,cluster_ratio, slice_db, noise_scale,pad_seconds,cl_num,lg_num,lgr_num,text2tts,tts_rate,tts_voice,F0_mean_pooling,enhancer_adaptive_key], [vc_output1, vc_output2]) + debug_button.change(debug_change,[],[]) model_load_button.click(modelAnalysis,[model_path,config_path,cluster_model_path,device,enhance],[sid,sid_output]) model_unload_button.click(modelUnload,[],[sid,sid_output]) app.launch() From 35706ca0b479b5a5be4411c3f5ad8d17b7982a9a Mon Sep 17 00:00:00 2001 From: Miuzarte <982809597@qq.com> Date: Fri, 14 Apr 2023 13:29:19 +0800 Subject: [PATCH 5/6] Update inference_main.py --- inference_main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inference_main.py b/inference_main.py index b6c9ff8..3f600bb 100644 --- a/inference_main.py +++ b/inference_main.py @@ -31,13 +31,13 @@ def main(): parser.add_argument('-s', '--spk_list', type=str, nargs='+', default=['nen'], help='合成目标说话人名称') # 可选项部分 - parser.add_argument('-a', '--auto_predict_f0', action='store_true', default=False,help='语音转换自动预测音高,转换歌声时不要打开这个会严重跑调') + parser.add_argument('-a', '--auto_predict_f0', type=bool, default=False, help='语音转换自动预测音高,转换歌声时不要打开这个会严重跑调') parser.add_argument('-cm', '--cluster_model_path', type=str, default="logs/44k/kmeans_10000.pt", help='聚类模型路径,如果没有训练聚类则随便填') parser.add_argument('-cr', '--cluster_infer_ratio', type=float, default=0, help='聚类方案占比,范围0-1,若没有训练聚类模型则默认0即可') parser.add_argument('-lg', '--linear_gradient', type=float, default=0, help='两段音频切片的交叉淡入长度,如果强制切片后出现人声不连贯可调整该数值,如果连贯建议采用默认值0,单位为秒') parser.add_argument('-fmp', '--f0_mean_pooling', type=bool, default=False, help='是否对F0使用均值滤波器(池化),对部分哑音有改善。注意,启动该选项会导致推理速度下降,默认关闭') parser.add_argument('-eh', '--enhance', type=bool, default=False, help='是否使用NSF_HIFIGAN增强器,该选项对部分训练集少的模型有一定的音质增强效果,但是对训练好的模型有反面效果,默认关闭') - + # 不用动的部分 parser.add_argument('-sd', '--slice_db', type=int, default=-40, help='默认-40,嘈杂的音频可以-30,干声保留呼吸可以-50') parser.add_argument('-d', '--device', type=str, default=None, help='推理设备,None则为自动选择cpu和gpu') From d20461d247f17fc8c2aae938d7a9264eec2ce84e Mon Sep 17 00:00:00 2001 From: Miuzarte <982809597@qq.com> Date: Fri, 14 Apr 2023 13:55:09 +0800 Subject: [PATCH 6/6] Update colab notebook --- README.md | 4 +++- README_zh_CN.md | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3253df2..3adb936 100644 --- a/README.md +++ b/README.md @@ -205,7 +205,9 @@ Introduction: The mean filtering of F0 can effectively reduce the hoarse sound c ### [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1kv-3y2DmZo0uya8pEr1xk7cSB-4e_Pct?usp=sharing) [sovits4_for_colab.ipynb](https://colab.research.google.com/drive/1kv-3y2DmZo0uya8pEr1xk7cSB-4e_Pct?usp=sharing) -#### [23/03/16] No longer need to download hubert manually +**[23/03/16] No longer need to download hubert manually** + +**[23/04/14] Support NSF_HIFIGAN enhancer** ## 📤 Exporting to Onnx diff --git a/README_zh_CN.md b/README_zh_CN.md index 9bb1a0d..710a8e7 100644 --- a/README_zh_CN.md +++ b/README_zh_CN.md @@ -205,7 +205,9 @@ python inference_main.py -m "logs/44k/G_30400.pth" -c "configs/config.json" -n " ### [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1kv-3y2DmZo0uya8pEr1xk7cSB-4e_Pct?usp=sharing) [sovits4_for_colab.ipynb](https://colab.research.google.com/drive/1kv-3y2DmZo0uya8pEr1xk7cSB-4e_Pct?usp=sharing) -#### [23/03/16] 不再需要手动下载hubert +**[23/03/16] 不再需要手动下载hubert** + +**[23/04/14] 支持NSF_HIFIGAN增强器** ## 📤 Onnx导出