mirror of
https://github.com/RVC-Boss/GPT-SoVITS.git
synced 2026-07-12 11:01:09 +08:00
feat:添加了是否启用参考音频的变量
This commit is contained in:
parent
f6e8ec8a78
commit
012eb93ef8
@ -821,6 +821,7 @@ def get_tts_wav(
|
|||||||
InjectSvEmbName="sv_emb.voice",
|
InjectSvEmbName="sv_emb.voice",
|
||||||
InjectRefersName="refers.voice",
|
InjectRefersName="refers.voice",
|
||||||
|
|
||||||
|
EnableAudioLoad=True,
|
||||||
):
|
):
|
||||||
global cache
|
global cache
|
||||||
if ref_wav_path:
|
if ref_wav_path:
|
||||||
@ -954,20 +955,29 @@ def get_tts_wav(
|
|||||||
sv_emb = []
|
sv_emb = []
|
||||||
if sv_cn_model == None:
|
if sv_cn_model == None:
|
||||||
init_sv_cn()
|
init_sv_cn()
|
||||||
if inp_refs:
|
|
||||||
for path in inp_refs:
|
try:
|
||||||
try: #####这里加上提取sv的逻辑,要么一堆sv一堆refer,要么单个sv单个refer
|
if EnableAudioLoad:
|
||||||
refer, audio_tensor = get_spepc(hps, path.name, dtype, device, is_v2pro)
|
if inp_refs:
|
||||||
refers.append(refer)
|
for path in inp_refs:
|
||||||
|
try: #####这里加上提取sv的逻辑,要么一堆sv一堆refer,要么单个sv单个refer
|
||||||
|
refer, audio_tensor = get_spepc(hps, path.name, dtype, device, is_v2pro)
|
||||||
|
refers.append(refer)
|
||||||
|
if is_v2pro:
|
||||||
|
sv_emb.append(sv_cn_model.compute_embedding3(audio_tensor))
|
||||||
|
#print("refer:", refer.shape)
|
||||||
|
except:
|
||||||
|
traceback.print_exc()
|
||||||
|
if len(refers) == 0:
|
||||||
|
refers, audio_tensor = get_spepc(hps, ref_wav_path, dtype, device, is_v2pro)
|
||||||
|
refers = [refers]
|
||||||
if is_v2pro:
|
if is_v2pro:
|
||||||
sv_emb.append(sv_cn_model.compute_embedding3(audio_tensor))
|
sv_emb = [sv_cn_model.compute_embedding3(audio_tensor)]
|
||||||
except:
|
else:
|
||||||
traceback.print_exc()
|
refers = []
|
||||||
if len(refers) == 0:
|
sv_emb = []
|
||||||
refers, audio_tensor = get_spepc(hps, ref_wav_path, dtype, device, is_v2pro)
|
except:
|
||||||
refers = [refers]
|
traceback.print_exc()
|
||||||
if is_v2pro:
|
|
||||||
sv_emb = [sv_cn_model.compute_embedding3(audio_tensor)]
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if SaveSvEmb and is_v2pro:
|
if SaveSvEmb and is_v2pro:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user