helloWorld199 commited on
Commit
d883f24
1 Parent(s): 3410dc0

Upload main.py

Browse files
Files changed (1) hide show
  1. src/main.py +10 -11
src/main.py CHANGED
@@ -285,17 +285,16 @@ def vocal_only_pipeline(song_input, voice_model, pitch_change, is_webui=0,index_
285
  #orig_song_path, vocals_path = preprocess_vocals_only(song_input, mdx_model_params, song_id, is_webui, input_type, progress)
286
 
287
  pitch_change = pitch_change * 12 + pitch_change_all
288
- ai_vocals_path = os.path.join(song_dir, f'{os.path.splitext(os.path.basename(orig_song_path))[0]}_{voice_model}_p{pitch_change}_i{index_rate}_fr{filter_radius}_rms{rms_mix_rate}_pro{protect}_{f0_method}{"" if f0_method != "mangio-crepe" else f"_{crepe_hop_length}"}_covervocals.wav')
289
  display_progress(f'[~] Post reverb {ai_vocals_path}', 0.5, is_webui, progress)
 
 
 
 
 
 
290
 
291
- # TODO: Add a bool parameter to condition this execution...
292
- if(False):
293
- display_progress('[~] Converting voice using RVC...', 0.5, is_webui, progress)
294
- voice_change(voice_model, vocals_path, ai_vocals_path, pitch_change, f0_method, index_rate, filter_radius, rms_mix_rate, protect, crepe_hop_length, is_webui)
295
- display_progress('[~] Applying audio effects to Vocals...', 0.8, is_webui, progress)
296
- ai_vocals_mixed_path = add_audio_effects(ai_vocals_path, reverb_rm_size, reverb_wet, reverb_dry, reverb_damping)
297
-
298
- return ai_vocals_path
299
  except Exception as e:
300
  raise_exception(str(e), is_webui)
301
 
@@ -352,7 +351,7 @@ def song_cover_pipeline(song_input, voice_model, pitch_change, keep_files,
352
  orig_song_path, instrumentals_path, main_vocals_dereverb_path, backup_vocals_path = paths
353
 
354
  pitch_change = pitch_change * 12 + pitch_change_all
355
- ai_vocals_path = os.path.join(song_dir, f'{os.path.splitext(os.path.basename(orig_song_path))[0]}_{voice_model}_p{pitch_change}_i{index_rate}_fr{filter_radius}_rms{rms_mix_rate}_pro{protect}_{f0_method}{"" if f0_method != "mangio-crepe" else f"_{crepe_hop_length}"}_covervocals.wav')
356
  # Added _cover at the end of filename
357
  ai_cover_path = os.path.join(song_dir, f'{os.path.splitext(os.path.basename(orig_song_path))[0]} ({voice_model} Ver)_cover.{output_format}')
358
 
@@ -383,7 +382,7 @@ def song_cover_pipeline(song_input, voice_model, pitch_change, keep_files,
383
 
384
  # Returning the stems: AI cover, original vocal, original instrumental, AI generated vocal
385
 
386
- return ai_cover_path, vocals_path, instrumentals_path, ai_vocals_path
387
 
388
  except Exception as e:
389
  raise_exception(str(e), is_webui)
 
285
  #orig_song_path, vocals_path = preprocess_vocals_only(song_input, mdx_model_params, song_id, is_webui, input_type, progress)
286
 
287
  pitch_change = pitch_change * 12 + pitch_change_all
288
+ ai_vocals_path = os.path.join(song_dir, f'{os.path.splitext(os.path.basename(orig_song_path))[0]}_{voice_model}_p{pitch_change}_i{index_rate}_fr{filter_radius}_rms{rms_mix_rate}_pro{protect}_{f0_method}{"" if f0_method != "mangio-crepe" else f"_{crepe_hop_length}"}.wav')
289
  display_progress(f'[~] Post reverb {ai_vocals_path}', 0.5, is_webui, progress)
290
+ time.sleep(10)
291
+
292
+ display_progress('[~] Converting voice using RVC...', 0.5, is_webui, progress)
293
+ voice_change(voice_model, vocals_path, ai_vocals_path, pitch_change, f0_method, index_rate, filter_radius, rms_mix_rate, protect, crepe_hop_length, is_webui)
294
+ display_progress('[~] Applying audio effects to Vocals...', 0.8, is_webui, progress)
295
+ ai_vocals_mixed_path = add_audio_effects(ai_vocals_path, reverb_rm_size, reverb_wet, reverb_dry, reverb_damping)
296
 
297
+ return ai_vocals_mixed_path
 
 
 
 
 
 
 
298
  except Exception as e:
299
  raise_exception(str(e), is_webui)
300
 
 
351
  orig_song_path, instrumentals_path, main_vocals_dereverb_path, backup_vocals_path = paths
352
 
353
  pitch_change = pitch_change * 12 + pitch_change_all
354
+ ai_vocals_path = os.path.join(song_dir, f'{os.path.splitext(os.path.basename(orig_song_path))[0]}_{voice_model}_p{pitch_change}_i{index_rate}_fr{filter_radius}_rms{rms_mix_rate}_pro{protect}_{f0_method}{"" if f0_method != "mangio-crepe" else f"_{crepe_hop_length}"}.wav')
355
  # Added _cover at the end of filename
356
  ai_cover_path = os.path.join(song_dir, f'{os.path.splitext(os.path.basename(orig_song_path))[0]} ({voice_model} Ver)_cover.{output_format}')
357
 
 
382
 
383
  # Returning the stems: AI cover, original vocal, original instrumental, AI generated vocal
384
 
385
+ return ai_cover_path, vocals_path, instrumentals_path, ai_vocals_mixed_path
386
 
387
  except Exception as e:
388
  raise_exception(str(e), is_webui)