mirror of
https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI.git
synced 2025-04-26 06:28:59 +08:00
chore(format): run black on dev (#1398)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
parent
5c609190a2
commit
634ba76cfa
@ -53,8 +53,10 @@ def load_audio(file, sr):
|
||||
file = (
|
||||
file.strip(" ").strip('"').strip("\n").strip('"').strip(" ")
|
||||
) # 防止小白拷路径头尾带了空格和"和回车
|
||||
if(os.path.exists(file)==False):
|
||||
raise RuntimeError("You input a wrong audio path that does not exists, please fix it!")
|
||||
if os.path.exists(file) == False:
|
||||
raise RuntimeError(
|
||||
"You input a wrong audio path that does not exists, please fix it!"
|
||||
)
|
||||
try:
|
||||
with open(file, "rb") as f:
|
||||
with BytesIO() as out:
|
||||
|
@ -220,22 +220,22 @@ class Predictor:
|
||||
opt_path_other = path_other[:-4] + ".%s" % format
|
||||
if os.path.exists(path_vocal):
|
||||
os.system(
|
||||
"ffmpeg -i %s -vn %s -q:a 2 -y"
|
||||
% (path_vocal, opt_path_vocal)
|
||||
"ffmpeg -i %s -vn %s -q:a 2 -y" % (path_vocal, opt_path_vocal)
|
||||
)
|
||||
if(os.path.exists(opt_path_vocal)):
|
||||
if os.path.exists(opt_path_vocal):
|
||||
try:
|
||||
os.remove(path_vocal)
|
||||
except:pass
|
||||
except:
|
||||
pass
|
||||
if os.path.exists(path_other):
|
||||
os.system(
|
||||
"ffmpeg -i %s -vn %s -q:a 2 -y"
|
||||
% (path_other, opt_path_other)
|
||||
"ffmpeg -i %s -vn %s -q:a 2 -y" % (path_other, opt_path_other)
|
||||
)
|
||||
if(os.path.exists(opt_path_other)):
|
||||
if os.path.exists(opt_path_other):
|
||||
try:
|
||||
os.remove(path_other)
|
||||
except:pass
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
class MDXNetDereverb:
|
||||
|
@ -34,7 +34,7 @@ def uvr(model_name, inp_root, save_root_vocal, paths, save_root_ins, agg, format
|
||||
os.getenv("weight_uvr5_root"), model_name + ".pth"
|
||||
),
|
||||
device=config.device,
|
||||
is_half=config.is_half
|
||||
is_half=config.is_half,
|
||||
)
|
||||
is_hp3 = "HP3" in model_name
|
||||
if inp_root != "":
|
||||
|
@ -41,7 +41,9 @@ class AudioPre:
|
||||
self.mp = mp
|
||||
self.model = model
|
||||
|
||||
def _path_audio_(self, music_file, ins_root=None, vocal_root=None, format="flac",is_hp3=False):
|
||||
def _path_audio_(
|
||||
self, music_file, ins_root=None, vocal_root=None, format="flac", is_hp3=False
|
||||
):
|
||||
if ins_root is None and vocal_root is None:
|
||||
return "No save root."
|
||||
name = os.path.basename(music_file)
|
||||
@ -120,8 +122,10 @@ class AudioPre:
|
||||
else:
|
||||
wav_instrument = spec_utils.cmb_spectrogram_to_wave(y_spec_m, self.mp)
|
||||
logger.info("%s instruments done" % name)
|
||||
if(is_hp3==True):head="vocal_"
|
||||
else:head="instrument_"
|
||||
if is_hp3 == True:
|
||||
head = "vocal_"
|
||||
else:
|
||||
head = "instrument_"
|
||||
if format in ["wav", "flac"]:
|
||||
sf.write(
|
||||
os.path.join(
|
||||
@ -142,17 +146,17 @@ class AudioPre:
|
||||
)
|
||||
if os.path.exists(path):
|
||||
opt_format_path = path[:-4] + ".%s" % format
|
||||
os.system(
|
||||
"ffmpeg -i %s -vn %s -q:a 2 -y"
|
||||
% (path, opt_format_path)
|
||||
)
|
||||
os.system("ffmpeg -i %s -vn %s -q:a 2 -y" % (path, opt_format_path))
|
||||
if os.path.exists(opt_format_path):
|
||||
try:
|
||||
os.remove(path)
|
||||
except:pass
|
||||
except:
|
||||
pass
|
||||
if vocal_root is not None:
|
||||
if(is_hp3==True):head="instrument_"
|
||||
else:head="vocal_"
|
||||
if is_hp3 == True:
|
||||
head = "instrument_"
|
||||
else:
|
||||
head = "vocal_"
|
||||
if self.data["high_end_process"].startswith("mirroring"):
|
||||
input_high_end_ = spec_utils.mirroring(
|
||||
self.data["high_end_process"], v_spec_m, input_high_end, self.mp
|
||||
@ -183,14 +187,12 @@ class AudioPre:
|
||||
)
|
||||
if os.path.exists(path):
|
||||
opt_format_path = path[:-4] + ".%s" % format
|
||||
os.system(
|
||||
"ffmpeg -i %s -vn %s -q:a 2 -y"
|
||||
% (path, opt_format_path)
|
||||
)
|
||||
os.system("ffmpeg -i %s -vn %s -q:a 2 -y" % (path, opt_format_path))
|
||||
if os.path.exists(opt_format_path):
|
||||
try:
|
||||
os.remove(path)
|
||||
except:pass
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
class AudioPreDeEcho:
|
||||
@ -321,14 +323,12 @@ class AudioPreDeEcho:
|
||||
)
|
||||
if os.path.exists(path):
|
||||
opt_format_path = path[:-4] + ".%s" % format
|
||||
os.system(
|
||||
"ffmpeg -i %s -vn %s -q:a 2 -y"
|
||||
% (path, opt_format_path)
|
||||
)
|
||||
os.system("ffmpeg -i %s -vn %s -q:a 2 -y" % (path, opt_format_path))
|
||||
if os.path.exists(opt_format_path):
|
||||
try:
|
||||
os.remove(path)
|
||||
except:pass
|
||||
except:
|
||||
pass
|
||||
if vocal_root is not None:
|
||||
if self.data["high_end_process"].startswith("mirroring"):
|
||||
input_high_end_ = spec_utils.mirroring(
|
||||
@ -360,11 +360,9 @@ class AudioPreDeEcho:
|
||||
)
|
||||
if os.path.exists(path):
|
||||
opt_format_path = path[:-4] + ".%s" % format
|
||||
os.system(
|
||||
"ffmpeg -i %s -vn %s -q:a 2 -y"
|
||||
% (path, opt_format_path)
|
||||
)
|
||||
os.system("ffmpeg -i %s -vn %s -q:a 2 -y" % (path, opt_format_path))
|
||||
if os.path.exists(opt_format_path):
|
||||
try:
|
||||
os.remove(path)
|
||||
except:pass
|
||||
except:
|
||||
pass
|
||||
|
Loading…
x
Reference in New Issue
Block a user