Skip to content

Commit

Permalink
Update voice_conversion.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Bebra777228 authored Aug 4, 2024
1 parent 472153a commit 0602d99
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/scripts/conversion/voice_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def convert_to_stereo(audio_path):
def display_progress(percent, message, progress=gr.Progress()):
progress(percent, desc=message)

def voice_change(voice_model, vocals_path, output_path, pitch_change, f0_method, index_rate, filter_radius, volume_envelope, protect, hop_length, f0_min, f0_max):
def voice_change(voice_model, vocals_path, output_path, pitch_change, f0_method, index_rate, filter_radius, volume_envelope, protect, hop_length, f0autotune, f0_min, f0_max):
try:
rvc_model_path, rvc_index_path = get_rvc_model(voice_model)
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
Expand All @@ -51,7 +51,7 @@ def voice_change(voice_model, vocals_path, output_path, pitch_change, f0_method,
cpt, version, net_g, tgt_sr, vc = get_vc(device, config.is_half, config, rvc_model_path)

rvc_infer(rvc_index_path, index_rate, vocals_path, output_path, pitch_change, f0_method, cpt, version, net_g,
filter_radius, tgt_sr, volume_envelope, protect, hop_length, vc, hubert_model, f0_min, f0_max)
filter_radius, tgt_sr, volume_envelope, protect, hop_length, vc, hubert_model, f0autotune, f0_min, f0_max)

del hubert_model, cpt, net_g, vc
gc.collect()
Expand All @@ -61,7 +61,7 @@ def voice_change(voice_model, vocals_path, output_path, pitch_change, f0_method,
raise

def conversion(uploaded_file, voice_model, pitch_change, index_rate=0.5, filter_radius=3, volume_envelope=0.25, f0_method='rmvpe',
hop_length=128, protect=0.33, output_format='mp3', progress=gr.Progress(), f0_min=50, f0_max=1100):
hop_length=128, protect=0.33, output_format='mp3', progress=gr.Progress(), f0autotune=False, f0_min=50, f0_max=1100):
try:
if not uploaded_file or not voice_model:
logging.error('Убедитесь, что поле ввода песни и поле модели голоса заполнены.')
Expand All @@ -81,7 +81,7 @@ def conversion(uploaded_file, voice_model, pitch_change, index_rate=0.5, filter_

display_progress(0.5, '[~] Преобразование вокала...', progress)
voice_change(voice_model, orig_song_path, voice_convert_path, pitch_change, f0_method, index_rate,
filter_radius, volume_envelope, protect, hop_length, f0_min, f0_max)
filter_radius, volume_envelope, protect, hop_length, f0autotune, f0_min, f0_max)

display_progress(1.0, '[✓] AI-кавер успешно сгенерирован!', progress)
return voice_convert_path
Expand Down

0 comments on commit 0602d99

Please sign in to comment.