Skip to content

Commit

Permalink
Update rvc_cli.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Bebra777228 authored Aug 4, 2024
1 parent 9169a1e commit 5637f60
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions rvc_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
rvc_models_dir = os.path.join(now_dir, 'models', 'rvc_models')
output_dir = os.path.join(now_dir, 'song_output')

if not os.path.exists(rvc_models_dir):
os.makedirs(rvc_models_dir)

if not os.path.exists(output_dir):
os.makedirs(output_dir)

Expand All @@ -21,19 +24,22 @@
parser.add_argument('-m', '--method', type=str, default='rmvpe')
parser.add_argument('-hop', '--hop_length', type=int, default=128)
parser.add_argument('-pro', '--protect', type=float, default=0.33)
parser.add_argument('-tune', '--autotune', type=str, default='False')
parser.add_argument('-f', '--format', type=str, default='mp3')
args = parser.parse_args()

rvc_dirname = args.rvc_dirname
if not os.path.exists(os.path.join(rvc_models_dir, rvc_dirname)):
raise Exception(f'Папки {os.path.join(rvc_models_dir, rvc_dirname)} не существует.')

cover_path = conversion(
args.song_input, rvc_dirname, args.pitch,
index_rate=args.index_rate, filter_radius=args.filter_radius,
volume_envelope=args.volume_envelope, f0_method=args.method,
hop_length=args.hop_length, protect=args.protect,
output_format=args.format
)

print(f'\033[1;92m\nГолос успешно заменен!\n\033[0m')
try:
cover_path = conversion(
args.song_input, rvc_dirname, args.pitch,
index_rate=args.index_rate, filter_radius=args.filter_radius,
volume_envelope=args.volume_envelope, f0_method=args.method,
hop_length=args.hop_length, protect=args.protect,
f0autotune=args.autotune, output_format=args.format
)
print(f'\033[1;92m\nГолос успешно заменен!\nПуть к файлу: {cover_path}\033[0m')
except Exception as e:
print(f'\033[1;91m\nОшибка при замене голоса: {e}\033[0m')

0 comments on commit 5637f60

Please sign in to comment.