From 91b9fafc4f199e4d848ec71e55d3a85a118c9e98 Mon Sep 17 00:00:00 2001 From: Blaise Date: Mon, 15 Jul 2024 13:50:07 +0200 Subject: [PATCH] sync with applio changes --- Elevenlabs-TTS/Elevenlabs-TTS.zip | Bin 4665 -> 4967 bytes Elevenlabs-TTS/plugin.py | 99 +++++++++++++++++++++--------- 2 files changed, 70 insertions(+), 29 deletions(-) diff --git a/Elevenlabs-TTS/Elevenlabs-TTS.zip b/Elevenlabs-TTS/Elevenlabs-TTS.zip index 9006453edf6a31247089ba2426b0792dddc9a126..d1c5d724354a49e1c5af5598f6d128e50c371f47 100644 GIT binary patch delta 4711 zcmZX2bx_m~&_1mo-FZlebeEDUT~gAGaKwRh;|CCs?rv$0&I686x*O?3L_j#=2*Hzj z_4}Lo&AjvO&d$!x?z6l9?atG|zQ;kNt&WXDiSbWFT~CsUxQXdqPmDGslHWL!VPMdy zBr9?OUuf-BB1N?mLb)iibn7w$5gtK)`+k(Bsv0ii%N}cPH@*etqZ#$3s;0DKWTwMv z0hcq!Y6{`6$%@>;=(2Jv^C(V(0?yMPCZnxgujoLPj^(Z&IQhG9 zE2oxpKf-3;{y9@GlA4Y{OehwN^X4qu>m4)!-1-DqWeYpfvbT@7@BK4wM5GH1O;+p& zH6;_9(|ITEkp^H zG_|rVj0Ic8*^E>hGn8Qs1=vpT)EtzF9@Qv2XBunHn9W&kOf!9Q_TEz`^FQ-GYeh*w z^vr2I#QP=Lt(IAJ_MSFTwQjX&(!Q=zGOv8+=CO@c7LYc z#hRos*oqVFF~_htrG^+RBVPFReYiNKzheX5=MHtjA5-8~zXYQ57IO2K^vL>4>F&V-aOMJkKKE6-AU@s!B$9}Sht=<^Xgu~V<&SEh@YcN-Qmcz{q= zBC52CB!}aw$zI_-pWMM7|7)QAg0p9tI6=bY*eiqhY{M7d`ZQ=WG?ReIl`zOhNP&rQ zc5p!oJu?3$!B9kAkHo1n$`iv>UJ<%eiUOW^Un30-+Lly~P=(HNM-&eQ?=Qvmc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G~$lGkxVIjc?#)QO~A`62vk(Lxt1!>x0z`V2vre@8Oe?3h1VyJRoKa zb8^VLf{JB2i^9dRen3R*Qdw6mq^pU8%L@2k!@~Hl?EiuS@c3_?CP~dLI^-1B;%xQ} zhpXvj+rKmKJoZ2Nzj1lMe_j9o8XalL)KY|B&14wer_v^<>3LZHyX*fi`A_5@*#4## o<=>SB1Obt5x4M627SsMq_J8DcH37Ue(oAJ{&2Z~y=R diff --git a/Elevenlabs-TTS/plugin.py b/Elevenlabs-TTS/plugin.py index 435423a..fb541e6 100644 --- a/Elevenlabs-TTS/plugin.py +++ b/Elevenlabs-TTS/plugin.py @@ -1,26 +1,30 @@ -import os, sys +import os +import sys +import random + import gradio as gr import regex as re -import random -import subprocess -from assets.i18n.i18n import I18nAuto +now_dir = os.getcwd() +sys.path.append(now_dir) +from assets.i18n.i18n import I18nAuto +from rvc.infer.infer import VoiceConverter from elevenlabs.client import ElevenLabs from elevenlabs import save client = ElevenLabs() - i18n = I18nAuto() - -now_dir = os.getcwd() -sys.path.append(now_dir) - -from rvc.infer.infer import VoiceConverter voice_converter = VoiceConverter() model_root = os.path.join(now_dir, "logs") model_root_relative = os.path.relpath(model_root, now_dir) +custom_embedder_root = os.path.join( + now_dir, "rvc", "models", "embedders", "embedders_custom" +) + +os.makedirs(custom_embedder_root, exist_ok=True) +custom_embedder_root_relative = os.path.relpath(custom_embedder_root, now_dir) names = [ os.path.join(root, file) @@ -117,6 +121,14 @@ def match_index(model_file: str) -> tuple: return "" +custom_embedders = [ + os.path.join(dirpath, filename) + for dirpath, _, filenames in os.walk(custom_embedder_root_relative) + for filename in filenames + if filename.endswith(".pt") +] + + def process_input(file_path): with open(file_path, "r") as file: file_contents = file.read() @@ -144,7 +156,9 @@ def run_tts_script( clean_strength, export_format, embedder_model, + embedder_model_custom, upscale_audio, + f0_file, api_key, ): if os.path.exists(output_tts_path): @@ -164,25 +178,27 @@ def run_tts_script( print(f"TTS with {tts_voice} completed. Output TTS file: '{output_tts_path}'") - voice_converter.infer_pipeline( - pitch, - filter_radius, - index_rate, - rms_mix_rate, - protect, - hop_length, - f0method, - output_tts_path, - output_rvc_path, - model_file, - index_file, - split_audio, - autotune, - clean_audio, - clean_strength, - export_format, - embedder_model, - upscale_audio, + voice_converter.convert_audio( + f0_up_key=pitch, + filter_radius=filter_radius, + index_rate=index_rate, + rms_mix_rate=rms_mix_rate, + protect=protect, + hop_length=hop_length, + f0_method=f0method, + audio_input_path=output_tts_path, + audio_output_path=output_rvc_path, + model_path=model_file, + index_path=index_file, + split_audio=split_audio, + f0_autotune=autotune, + clean_audio=clean_audio, + clean_strength=clean_strength, + export_format=export_format, + embedder_model=embedder_model, + embedder_model_custom=embedder_model_custom, + upscale_audio=upscale_audio, + f0_file=f0_file, ) return f"Text {tts_text} synthesized successfully.", output_rvc_path.replace( @@ -427,6 +443,29 @@ def applio_plugin(): value="hubert", interactive=True, ) + with gr.Column(visible=False) as embedder_custom: + with gr.Accordion(i18n("Custom Embedder"), open=True): + embedder_upload_custom = gr.File( + label=i18n("Upload Custom Embedder"), + type="filepath", + interactive=True, + ) + embedder_custom_refresh = gr.Button(i18n("Refresh")) + embedder_model_custom = gr.Dropdown( + label=i18n("Custom Embedder"), + info=i18n( + "Select the custom embedder to use for the conversion." + ), + choices=sorted(custom_embedders), + interactive=True, + allow_custom_value=True, + ) + f0_file = gr.File( + label=i18n( + "The f0 curve represents the variations in the base frequency of a voice over time, showing how pitch rises and falls." + ), + visible=True, + ) convert_button1 = gr.Button(i18n("Convert")) @@ -466,7 +505,9 @@ def applio_plugin(): clean_strength, export_format, embedder_model, + embedder_model_custom, upscale_audio, + f0_file, api_key, ], outputs=[vc_output1, vc_output2],