helloWorld199 commited on
Commit
34564e2
1 Parent(s): 111965c

Update src/main.py

Browse files
Files changed (1) hide show
  1. src/main.py +11 -11
src/main.py CHANGED
@@ -181,7 +181,7 @@ def preprocess_song(song_input, mdx_model_params, song_id, is_webui, input_type,
181
  orig_song_path = convert_to_stereo(orig_song_path)
182
 
183
  display_progress('[~] Separating Vocals from Instrumental...', 0.1, is_webui, progress)
184
- vocals_path, instrumentals_path = run_mdx(mdx_model_params, song_output_dir, os.path.join(mdxnet_models_dir, 'UVR-MDX-NET-Voc_FT.onnx'), orig_song_path, denoise=True, keep_orig=keep_orig)
185
 
186
  display_progress('[~] Separating Main Vocals from Backup Vocals...', 0.2, is_webui, progress)
187
  backup_vocals_path, main_vocals_path = run_mdx(mdx_model_params, song_output_dir, os.path.join(mdxnet_models_dir, 'UVR_MDXNET_KARA_2.onnx'), vocals_path, suffix='Backup', invert_suffix='Main', denoise=True)
@@ -217,7 +217,7 @@ def voice_change(voice_model, vocals_path, output_path, pitch_change, f0_method,
217
 
218
 
219
  def add_audio_effects(audio_path, reverb_rm_size, reverb_wet, reverb_dry, reverb_damping):
220
- output_path = f'{os.path.splitext(audio_path)[0]}_mixed.wav'
221
 
222
  # Initialize audio effects plugins
223
  board = Pedalboard(
@@ -336,7 +336,7 @@ def song_cover_pipeline(song_input, voice_model, pitch_change, keep_files,
336
 
337
  pitch_change = pitch_change * 12 + pitch_change_all
338
  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')
339
- ai_cover_path = os.path.join(song_dir, f'{os.path.splitext(os.path.basename(orig_song_path))[0]} ({voice_model} Ver).{output_format}')
340
 
341
  if not os.path.exists(ai_vocals_path):
342
  display_progress('[~] Converting voice using RVC...', 0.5, is_webui, progress)
@@ -364,17 +364,17 @@ def song_cover_pipeline(song_input, voice_model, pitch_change, keep_files,
364
 
365
  # Add _stemname to each stem
366
  #ai_cover_path = add_stem_name(ai_cover_path, "_cover")
367
- #display_progress(f'[~] ai_cover_path FINAL PATH {ai_cover_path}', 0.9, is_webui, progress)
368
- #time.sleep(5)
369
  #vocals_path = add_stem_name(vocals_path, "_origvocals")
370
- #display_progress(f'[~] vocals_path FINAL PATH {vocals_path}', 0.9, is_webui, progress)
371
- #time.sleep(5)
372
  #instrumentals_path = add_stem_name(instrumentals_path, "_originstr")
373
- #display_progress(f'[~] instrumentals_path FINAL PATH {instrumentals_path}', 0.9, is_webui, progress)
374
- #time.sleep(5)
375
  #ai_vocals_mixed_path = add_stem_name(ai_vocals_mixed_path, "_covervocals")
376
- #display_progress(f'[~] ai_vocals_mixed_path FINAL PATH {ai_vocals_mixed_path}', 0.9, is_webui, progress)
377
- #time.sleep(5)
378
 
379
  # Returning the stems: AI cover, original vocal, original instrumental, AI generated vocal
380
 
 
181
  orig_song_path = convert_to_stereo(orig_song_path)
182
 
183
  display_progress('[~] Separating Vocals from Instrumental...', 0.1, is_webui, progress)
184
+ vocals_path, instrumentals_path = run_mdx(mdx_model_params, song_output_dir, os.path.join(mdxnet_models_dir, 'UVR-MDX-NET-Voc_FT.onnx'), orig_song_path, denoise=True, keep_orig=keep_orig, _stemname1 = "_origvocals", _stemname2="_originstr")
185
 
186
  display_progress('[~] Separating Main Vocals from Backup Vocals...', 0.2, is_webui, progress)
187
  backup_vocals_path, main_vocals_path = run_mdx(mdx_model_params, song_output_dir, os.path.join(mdxnet_models_dir, 'UVR_MDXNET_KARA_2.onnx'), vocals_path, suffix='Backup', invert_suffix='Main', denoise=True)
 
217
 
218
 
219
  def add_audio_effects(audio_path, reverb_rm_size, reverb_wet, reverb_dry, reverb_damping):
220
+ output_path = f'{os.path.splitext(audio_path)[0]}_mixed_covervocals.wav'
221
 
222
  # Initialize audio effects plugins
223
  board = Pedalboard(
 
336
 
337
  pitch_change = pitch_change * 12 + pitch_change_all
338
  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')
339
+ 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}')
340
 
341
  if not os.path.exists(ai_vocals_path):
342
  display_progress('[~] Converting voice using RVC...', 0.5, is_webui, progress)
 
364
 
365
  # Add _stemname to each stem
366
  #ai_cover_path = add_stem_name(ai_cover_path, "_cover")
367
+ display_progress(f'[~] ai_cover_path FINAL PATH {ai_cover_path}', 0.9, is_webui, progress)
368
+ time.sleep(5)
369
  #vocals_path = add_stem_name(vocals_path, "_origvocals")
370
+ display_progress(f'[~] vocals_path FINAL PATH {vocals_path}', 0.9, is_webui, progress)
371
+ time.sleep(5)
372
  #instrumentals_path = add_stem_name(instrumentals_path, "_originstr")
373
+ display_progress(f'[~] instrumentals_path FINAL PATH {instrumentals_path}', 0.9, is_webui, progress)
374
+ time.sleep(5)
375
  #ai_vocals_mixed_path = add_stem_name(ai_vocals_mixed_path, "_covervocals")
376
+ display_progress(f'[~] ai_vocals_mixed_path FINAL PATH {ai_vocals_mixed_path}', 0.9, is_webui, progress)
377
+ time.sleep(5)
378
 
379
  # Returning the stems: AI cover, original vocal, original instrumental, AI generated vocal
380