From 70af5f2f1921061c7b04f02a1f5a9a9ad6ca5010 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=9D=A8=E5=B8=86?= <39647285+leno23@users.noreply.github.com> Date: Sun, 17 May 2026 10:50:28 +0800 Subject: [PATCH] fix(vc): avoid duplicate output extensions --- infer/modules/vc/modules.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/infer/modules/vc/modules.py b/infer/modules/vc/modules.py index 6f695cc394..e9bf5f3f37 100644 --- a/infer/modules/vc/modules.py +++ b/infer/modules/vc/modules.py @@ -1,3 +1,4 @@ +import os import traceback import logging @@ -277,23 +278,24 @@ def vc_multi( if "Success" in info: try: tgt_sr, audio_opt = opt + input_name = os.path.basename(path) + clean_name = os.path.splitext(input_name)[0] if format1 in ["wav", "flac"]: sf.write( - "%s/%s.%s" - % (opt_root, os.path.basename(path), format1), + "%s/%s.%s" % (opt_root, clean_name, format1), audio_opt, tgt_sr, ) else: - path = "%s/%s.%s" % ( + save_path = "%s/%s.%s" % ( opt_root, - os.path.basename(path), + clean_name, format1, ) with BytesIO() as wavf: sf.write(wavf, audio_opt, tgt_sr, format="wav") wavf.seek(0, 0) - with open(path, "wb") as outf: + with open(save_path, "wb") as outf: wav2(wavf, outf, format1) except: info += traceback.format_exc()