tee342 commited on
Commit
cb5b337
Β·
verified Β·
1 Parent(s): 08388e7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -13
app.py CHANGED
@@ -164,9 +164,10 @@ def auto_eq(audio, genre="Pop"):
164
  "Funk": [(80, 200, +5), (1000, 3000, +3)],
165
  "Default": []
166
  }
 
167
  from scipy.signal import butter, sosfilt
168
  def band_eq(samples, sr, lowcut, highcut, gain):
169
- sos = butter(10, [lowcut, highhighcut], btype='band', output='sos', fs=sr)
170
  filtered = sosfilt(sos, samples)
171
  return samples + gain * filtered
172
 
@@ -210,9 +211,9 @@ def stem_split(audio_path):
210
  output_dir = tempfile.mkdtemp()
211
  stem_paths = [
212
  gr.File(value=os.path.join(output_dir, f"{name}.wav"))
213
- for name in ['vocals', 'drums', 'bass', 'other']
214
  ]
215
- for i, name in enumerate(['vocals', 'drums', 'bass', 'other']):
216
  path = os.path.join(output_dir, f"{name}.wav")
217
  save_track(path, sources[i].cpu(), model.samplerate)
218
  return stem_paths
@@ -322,7 +323,7 @@ preset_choices = {
322
  "🎀 R&B Vocal": ["Noise Reduction", "Bass Boost (100-300Hz)", "Treble Boost (2000-4000Hz)"],
323
  "πŸ’ƒ Soul Vocal": ["Noise Reduction", "Bass Boost (80-200Hz)", "Treble Boost (1500-3500Hz)"],
324
  "πŸ•Ί Funk Groove": ["Bass Boost (80-200Hz)", "Treble Boost (1000-3000Hz)"],
325
-
326
  # New presets
327
  "Studio Master": ["Noise Reduction", "Normalize", "Bass Boost", "Treble Boost", "Limiter"],
328
  "Podcast Voice": ["Noise Reduction", "Auto Gain", "High Pass Filter (85Hz)"],
@@ -518,13 +519,6 @@ def export_full_mix(stems, final_mix):
518
  zipf.write(final_mix, "final_mix.wav")
519
  return zip_path
520
 
521
- # Text-to-Sound
522
- def text_to_sound(prompt):
523
- tts = TTS(model="tts_models/en/vctk/vits")
524
- out_path = os.path.join(tempfile.gettempdir(), "generated_sound.wav")
525
- tts.tts_to_file(text=prompt, speaker="p225", file_path=out_path)
526
- return out_path
527
-
528
  # Main UI
529
  with gr.Blocks(css="""
530
  body {
@@ -737,7 +731,7 @@ with gr.Blocks(css="""
737
  fn=auto_eq,
738
  inputs=[
739
  gr.Audio(label="Upload Track", type="filepath"),
740
- gr.Dropdown(choices=list(auto_eq.__defaults__[0].keys()), label="Genre", value="Pop")
741
  ],
742
  outputs=gr.Audio(label="EQ-Enhanced Output", type="filepath"),
743
  title="Custom EQ by Genre",
@@ -841,7 +835,7 @@ with gr.Blocks(css="""
841
  inputs=[gr.File(label="Upload Stems", file_count="multiple")],
842
  outputs=gr.File(label="DAW Template (.json/.als/.flp)"),
843
  title="Generate Ableton/Live/FLP Template",
844
- description="Export ready-to-use templates for popular DAWs"
845
  )
846
 
847
  # --- Export Full Mix ZIP – Added Back ===
 
164
  "Funk": [(80, 200, +5), (1000, 3000, +3)],
165
  "Default": []
166
  }
167
+
168
  from scipy.signal import butter, sosfilt
169
  def band_eq(samples, sr, lowcut, highcut, gain):
170
+ sos = butter(10, [lowcut, highcut], btype='band', output='sos', fs=sr)
171
  filtered = sosfilt(sos, samples)
172
  return samples + gain * filtered
173
 
 
211
  output_dir = tempfile.mkdtemp()
212
  stem_paths = [
213
  gr.File(value=os.path.join(output_dir, f"{name}.wav"))
214
+ for name in ['drums', 'bass', 'other', 'vocals']
215
  ]
216
+ for i, name in enumerate(['drums', 'bass', 'other', 'vocals']):
217
  path = os.path.join(output_dir, f"{name}.wav")
218
  save_track(path, sources[i].cpu(), model.samplerate)
219
  return stem_paths
 
323
  "🎀 R&B Vocal": ["Noise Reduction", "Bass Boost (100-300Hz)", "Treble Boost (2000-4000Hz)"],
324
  "πŸ’ƒ Soul Vocal": ["Noise Reduction", "Bass Boost (80-200Hz)", "Treble Boost (1500-3500Hz)"],
325
  "πŸ•Ί Funk Groove": ["Bass Boost (80-200Hz)", "Treble Boost (1000-3000Hz)"],
326
+
327
  # New presets
328
  "Studio Master": ["Noise Reduction", "Normalize", "Bass Boost", "Treble Boost", "Limiter"],
329
  "Podcast Voice": ["Noise Reduction", "Auto Gain", "High Pass Filter (85Hz)"],
 
519
  zipf.write(final_mix, "final_mix.wav")
520
  return zip_path
521
 
 
 
 
 
 
 
 
522
  # Main UI
523
  with gr.Blocks(css="""
524
  body {
 
731
  fn=auto_eq,
732
  inputs=[
733
  gr.Audio(label="Upload Track", type="filepath"),
734
+ gr.Dropdown(choices=list(auto_eq.__defaults__[0].keys(), label="Genre", value="Pop")
735
  ],
736
  outputs=gr.Audio(label="EQ-Enhanced Output", type="filepath"),
737
  title="Custom EQ by Genre",
 
835
  inputs=[gr.File(label="Upload Stems", file_count="multiple")],
836
  outputs=gr.File(label="DAW Template (.json/.als/.flp)"),
837
  title="Generate Ableton/Live/FLP Template",
838
+ description="Export ready-to-use templates for DAWs"
839
  )
840
 
841
  # --- Export Full Mix ZIP – Added Back ===