Spaces:
Running
Running
英文语调与VC入口
Browse files
app.py
CHANGED
@@ -19,6 +19,13 @@ logging.getLogger('matplotlib').setLevel(logging.WARNING)
|
|
19 |
|
20 |
sampling_rate = 44100
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
def create_fn(model, spk):
|
24 |
def svc_fn(input_audio, vc_transform, auto_f0, f0p):
|
@@ -47,7 +54,7 @@ def create_fn(model, spk):
|
|
47 |
if input_text == '':
|
48 |
return 0, None
|
49 |
input_text = re.sub(r"[\n\,\(\) ]", "", input_text)
|
50 |
-
voice =
|
51 |
ratestr = "+{:.0%}".format(tts_rate) if tts_rate >= 0 else "{:.0%}".format(tts_rate)
|
52 |
temp_path = "temp.wav"
|
53 |
p = subprocess.Popen("edge-tts " +
|
@@ -86,7 +93,8 @@ if __name__ == '__main__':
|
|
86 |
gr.Markdown(
|
87 |
"# <center> 游戏角色语音生成\n"
|
88 |
"## <center> 模型作者:B站[Cyber蝈蝈总](https://space.bilibili.com/37706580)\n"
|
89 |
-
"<center>
|
|
|
90 |
)
|
91 |
with gr.Tabs():
|
92 |
for (name, cover, (svc_fn, tts_fn)) in models:
|
@@ -95,9 +103,9 @@ if __name__ == '__main__':
|
|
95 |
with gr.Column():
|
96 |
with gr.Row():
|
97 |
vc_transform = gr.Number(label="音高调整 (正负半音,12为1个八度)", value=0)
|
98 |
-
f0_predictor = gr.Radio(label="f0预测器 (
|
99 |
choices=['crepe', 'harvest', 'dio', 'pm'], value='crepe')
|
100 |
-
auto_f0 = gr.Checkbox(label="自动音高预测 (
|
101 |
value=False)
|
102 |
with gr.Tabs():
|
103 |
with gr.TabItem('语音转语音'):
|
@@ -110,7 +118,7 @@ if __name__ == '__main__':
|
|
110 |
placeholder='已支持无限长内容,处理时间约为说完原内容时间的5倍')
|
111 |
with gr.Row():
|
112 |
gender = gr.Radio(label='说话人性别 (男音调低,女音调高)', value='男',
|
113 |
-
choices=['男', '女'])
|
114 |
tts_rate = gr.Number(label='语速 (正负, 单位百分比)', value=0)
|
115 |
tts_submit = gr.Button("生成", variant="primary")
|
116 |
|
|
|
19 |
|
20 |
sampling_rate = 44100
|
21 |
|
22 |
+
tts_voice = {
|
23 |
+
"中文_男": "zh-CN-YunxiNeural",
|
24 |
+
"中文_女": "zh-CN-XiaoyiNeural",
|
25 |
+
"英文_男": "en-US-GuyNeural",
|
26 |
+
"英文_女": "en-US-AnaNeural"
|
27 |
+
}
|
28 |
+
|
29 |
|
30 |
def create_fn(model, spk):
|
31 |
def svc_fn(input_audio, vc_transform, auto_f0, f0p):
|
|
|
54 |
if input_text == '':
|
55 |
return 0, None
|
56 |
input_text = re.sub(r"[\n\,\(\) ]", "", input_text)
|
57 |
+
voice = tts_voice[gender]
|
58 |
ratestr = "+{:.0%}".format(tts_rate) if tts_rate >= 0 else "{:.0%}".format(tts_rate)
|
59 |
temp_path = "temp.wav"
|
60 |
p = subprocess.Popen("edge-tts " +
|
|
|
93 |
gr.Markdown(
|
94 |
"# <center> 游戏角色语音生成\n"
|
95 |
"## <center> 模型作者:B站[Cyber蝈蝈总](https://space.bilibili.com/37706580)\n"
|
96 |
+
"<center> 罪恶都市人物AI语音请移步[GTAVC_SOVITS](https://huggingface.co/spaces/GroveStreet/GTAVC_SOVITS)\n"
|
97 |
+
"<center> 使用此资源创作的作品请标明出处,CJ有两个模型,carl1更清晰,carl2音域广\n"
|
98 |
)
|
99 |
with gr.Tabs():
|
100 |
for (name, cover, (svc_fn, tts_fn)) in models:
|
|
|
103 |
with gr.Column():
|
104 |
with gr.Row():
|
105 |
vc_transform = gr.Number(label="音高调整 (正负半音,12为1个八度)", value=0)
|
106 |
+
f0_predictor = gr.Radio(label="f0预测器 (harvest适合讲话,crepe适合唱歌)",
|
107 |
choices=['crepe', 'harvest', 'dio', 'pm'], value='crepe')
|
108 |
+
auto_f0 = gr.Checkbox(label="自动音高预测 (文本转语音或讲话可选,会导致唱歌跑调)",
|
109 |
value=False)
|
110 |
with gr.Tabs():
|
111 |
with gr.TabItem('语音转语音'):
|
|
|
118 |
placeholder='已支持无限长内容,处理时间约为说完原内容时间的5倍')
|
119 |
with gr.Row():
|
120 |
gender = gr.Radio(label='说话人性别 (男音调低,女音调高)', value='男',
|
121 |
+
choices=['中文_男', '中文_女', '英文_男', '英文_女'])
|
122 |
tts_rate = gr.Number(label='语速 (正负, 单位百分比)', value=0)
|
123 |
tts_submit = gr.Button("生成", variant="primary")
|
124 |
|