optimize vc-multi
This commit is contained in:
@@ -176,45 +176,40 @@ class VC:
|
|||||||
paths = [path.name for path in paths]
|
paths = [path.name for path in paths]
|
||||||
infos = []
|
infos = []
|
||||||
for path in paths:
|
for path in paths:
|
||||||
info, opt = self.vc_single(
|
tgt_sr, audio_opt, _, info = self.vc_single(
|
||||||
sid,
|
sid,
|
||||||
path,
|
Path(path),
|
||||||
f0_up_key,
|
f0_up_key,
|
||||||
None,
|
|
||||||
f0_method,
|
f0_method,
|
||||||
file_index,
|
f0_file,
|
||||||
file_index2,
|
index_file,
|
||||||
# file_big_npy,
|
|
||||||
index_rate,
|
index_rate,
|
||||||
filter_radius,
|
filter_radius,
|
||||||
resample_sr,
|
resample_sr,
|
||||||
rms_mix_rate,
|
rms_mix_rate,
|
||||||
protect,
|
protect,
|
||||||
|
hubert_path,
|
||||||
)
|
)
|
||||||
if "Success" in info:
|
if info:
|
||||||
try:
|
try:
|
||||||
tgt_sr, audio_opt = opt
|
if output_format in ["wav", "flac"]:
|
||||||
if format1 in ["wav", "flac"]:
|
|
||||||
sf.write(
|
sf.write(
|
||||||
"%s/%s.%s"
|
f"{opt_root}/{os.path.basename(path)}.{output_format}",
|
||||||
% (opt_root, os.path.basename(path), format1),
|
|
||||||
audio_opt,
|
audio_opt,
|
||||||
tgt_sr,
|
tgt_sr,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
path = "%s/%s.%s" % (
|
|
||||||
opt_root,
|
|
||||||
os.path.basename(path),
|
|
||||||
format1,
|
|
||||||
)
|
|
||||||
with BytesIO() as wavf:
|
with BytesIO() as wavf:
|
||||||
sf.write(wavf, audio_opt, tgt_sr, format="wav")
|
sf.write(wavf, audio_opt, tgt_sr, format="wav")
|
||||||
wavf.seek(0, 0)
|
wavf.seek(0, 0)
|
||||||
with open(path, "wb") as outf:
|
with open(
|
||||||
wav2(wavf, outf, format1)
|
f"{opt_root}/{os.path.basename(path)}.{output_format}",
|
||||||
except:
|
"wb",
|
||||||
|
) as outf:
|
||||||
|
wav2(wavf, outf, output_format)
|
||||||
|
except Exception:
|
||||||
info += traceback.format_exc()
|
info += traceback.format_exc()
|
||||||
infos.append("%s->%s" % (os.path.basename(path), info))
|
infos.append(f"{os.path.basename(path)}->{info}")
|
||||||
yield "\n".join(infos)
|
yield "\n".join(infos)
|
||||||
yield "\n".join(infos)
|
yield "\n".join(infos)
|
||||||
except:
|
except:
|
||||||
|
|||||||
Reference in New Issue
Block a user