Politrees commited on
Commit
12bbb7d
1 Parent(s): c73191a

Update src/audio_effects.py

Browse files
Files changed (1) hide show
  1. src/audio_effects.py +4 -5
src/audio_effects.py CHANGED
@@ -42,13 +42,12 @@ def add_audio_effects(vocal_audio_path, instrumental_audio_path, reverb_rm_size,
42
  chorus_mix, output_format, vocal_gain, instrumental_gain, progress=gr.Progress()):
43
 
44
  if not vocal_audio_path or not instrumental_audio_path:
45
- raise ValueError("Оба пути к аудиофайлам должны быть заполнены.")
46
 
47
- # Convert vocal file to stereo if necessary
48
  stereo_vocal_path = 'Vocal_Stereo.wav'
49
  convert_to_stereo(vocal_audio_path, stereo_vocal_path)
50
 
51
- display_progress(0.2, "Применение аудиоэффектов к вокалу...", progress)
52
  board = Pedalboard(
53
  [
54
  HighpassFilter(),
@@ -69,7 +68,7 @@ def add_audio_effects(vocal_audio_path, instrumental_audio_path, reverb_rm_size,
69
  effected = board(chunk, f.samplerate, reset=False)
70
  o.write(effected)
71
 
72
- display_progress(0.5, "Объединение вокала и инструментальной части...", progress)
73
  output_dir = os.path.join(BASE_DIR, 'processed_output')
74
  os.makedirs(output_dir, exist_ok=True)
75
  combined_output_path = os.path.join(output_dir, f'AiCover_combined.{output_format}')
@@ -79,6 +78,6 @@ def add_audio_effects(vocal_audio_path, instrumental_audio_path, reverb_rm_size,
79
 
80
  combine_audio(vocal_output_path, instrumental_audio_path, combined_output_path, vocal_gain, instrumental_gain, output_format)
81
 
82
- display_progress(1.0, "Готово!", progress)
83
 
84
  return combined_output_path
 
42
  chorus_mix, output_format, vocal_gain, instrumental_gain, progress=gr.Progress()):
43
 
44
  if not vocal_audio_path or not instrumental_audio_path:
45
+ raise ValueError("Both audio file paths must be filled in.")
46
 
 
47
  stereo_vocal_path = 'Vocal_Stereo.wav'
48
  convert_to_stereo(vocal_audio_path, stereo_vocal_path)
49
 
50
+ display_progress(0.2, "Apply audio effects to vocals...", progress)
51
  board = Pedalboard(
52
  [
53
  HighpassFilter(),
 
68
  effected = board(chunk, f.samplerate, reset=False)
69
  o.write(effected)
70
 
71
+ display_progress(0.5, "Combining vocals and instrumental parts...", progress)
72
  output_dir = os.path.join(BASE_DIR, 'processed_output')
73
  os.makedirs(output_dir, exist_ok=True)
74
  combined_output_path = os.path.join(output_dir, f'AiCover_combined.{output_format}')
 
78
 
79
  combine_audio(vocal_output_path, instrumental_audio_path, combined_output_path, vocal_gain, instrumental_gain, output_format)
80
 
81
+ display_progress(1.0, "Done!", progress)
82
 
83
  return combined_output_path