Skip to content

Commit

Permalink
remove unused things
Browse files Browse the repository at this point in the history
  • Loading branch information
blaisewf committed Feb 21, 2024
1 parent adc2329 commit 1e2dfc4
Showing 1 changed file with 11 additions and 45 deletions.
56 changes: 11 additions & 45 deletions rvc/infer/infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import sys
import time
import torch
import logging
import numpy as np
import soundfile as sf
from vc_infer_pipeline import VC
Expand All @@ -14,16 +15,11 @@
SynthesizerTrnMs768NSFsid,
SynthesizerTrnMs768NSFsid_nono,
)

from rvc.configs.config import Config

import logging

logging.getLogger("fairseq").setLevel(logging.WARNING)

config = Config()

torch.manual_seed(114514)
hubert_model = None


Expand Down Expand Up @@ -101,7 +97,7 @@ def vc_single(
]
try:
for path in paths:
info, opt = vc_single(
vc_single(
sid,
path,
f0_up_key,
Expand All @@ -117,10 +113,9 @@ def vc_single(
False,
f0autotune,
)
# new_dir_path
except Exception as error:
print(error)
return "Error", None
return f"Error {error}"
print("Finished processing segmented audio, now merging audio...")
merge_timestamps_file = os.path.join(
os.path.dirname(new_dir_path),
Expand Down Expand Up @@ -225,69 +220,40 @@ def get_vc(weight_root, sid):
index_rate = float(sys.argv[3])
hop_length = sys.argv[4]
f0method = sys.argv[5]

audio_input_path = sys.argv[6]
audio_output_path = sys.argv[7]

model_path = sys.argv[8]
index_path = sys.argv[9]


try:
split_audio = sys.argv[10]
except IndexError:
split_audio = None

split_audio = sys.argv[10]
f0autotune = sys.argv[11]
rms_mix_rate = float(sys.argv[12])
protect = float(sys.argv[13])

input_audio = audio_input_path
f0_pitch = f0up_key
f0_file = None
f0_method = f0method

index_rate = index_rate
output_file = audio_output_path
split_audio = split_audio
protect = protect
rms_mix_rate = rms_mix_rate
f0autotune = f0autotune
f0_up_key = f0_pitch

file_index = index_path
file_pth = model_path

get_vc(model_path, 0)


try:
start_time = time.time()
result, audio_opt = vc_single(
vc_single(
sid=0,
input_audio_path=input_audio,
f0_up_key=f0_up_key,
input_audio_path=audio_input_path,
f0_up_key=f0up_key,
f0_file=None,
f0_method=f0_method,
file_index=file_index,
f0_method=f0method,
file_index=index_path,
index_rate=index_rate,
rms_mix_rate=rms_mix_rate,
protect=protect,
hop_length=hop_length,
output_path=output_file,
output_path=audio_output_path,
split_audio=split_audio,
f0autotune=f0autotune,
)

if os.path.exists(output_file) and os.path.getsize(output_file) > 0:
message = result
else:
message = result

end_time = time.time()
elapsed_time = end_time - start_time
print(
f"Conversion completed. Output file: '{output_file}' in {elapsed_time:.2f} seconds."
f"Conversion completed. Output file: '{audio_output_path}' in {elapsed_time:.2f} seconds."
)

except Exception as error:
Expand Down

0 comments on commit 1e2dfc4

Please sign in to comment.