tee342 commited on
Commit
786e848
·
verified ·
1 Parent(s): d7c6a5a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -25
app.py CHANGED
@@ -140,31 +140,30 @@ def match_loudness(audio_path, target_lufs=-14.0):
140
  out_path = save_audiosegment_to_temp(adjusted, ".wav")
141
  return out_path
142
 
143
- # === Auto-EQ per Genre – With R&B, Soul, Funk ===
144
- def auto_eq(audio, genre="Pop"):
145
- eq_map = {
146
- "Pop": [(200, 500, -3), (2000, 4000, +4)],
147
- "EDM": [(60, 250, +6), (8000, 12000, +3)],
148
- "Rock": [(1000, 3000, +4), (7000, 10000, -3)],
149
- "Hip-Hop": [(20, 100, +6), (7000, 10000, -4)],
150
- "Acoustic": [(100, 300, -3), (4000, 8000, +2)],
151
- "Metal": [(100, 500, -4), (2000, 5000, +6), (7000, 12000, -3)],
152
- "Trap": [(80, 120, +6), (3000, 6000, -4)],
153
- "LoFi": [(20, 200, +3), (1000, 3000, -2)],
154
- "Jazz": [(100, 400, +2), (1500, 3000, +1)],
155
- "Classical": [(200, 1000, +1), (3000, 6000, +2)],
156
- "Chillhop": [(50, 200, +3), (2000, 5000, +1)],
157
- "Ambient": [(100, 500, +4), (6000, 12000, +2)],
158
- "Jazz Piano": [(100, 1000, +3), (2000, 5000, +2)],
159
- "Trap EDM": [(60, 120, +6), (2000, 5000, -3)],
160
- "Indie Rock": [(150, 400, +2), (2000, 5000, +3)],
161
- "Lo-Fi Jazz": [(80, 200, +3), (2000, 4000, -1)],
162
- "R&B": [(100, 300, +4), (2000, 4000, +3)],
163
- "Soul": [(80, 200, +3), (1500, 3500, +4)],
164
- "Funk": [(80, 200, +5), (1000, 3000, +3)],
165
- "Default": []
166
- }
167
 
 
168
  from scipy.signal import butter, sosfilt
169
 
170
  def band_eq(samples, sr, lowcut, highcut, gain):
@@ -710,7 +709,6 @@ with gr.Blocks(css="""
710
  )
711
  # --- Custom EQ Editor ---
712
  with gr.Tab("🎛 Custom EQ Editor"):
713
- eq_map = auto_eq.__defaults__[0]
714
  gr.Interface(
715
  fn=auto_eq,
716
  inputs=[
 
140
  out_path = save_audiosegment_to_temp(adjusted, ".wav")
141
  return out_path
142
 
143
+ # Define eq_map directly
144
+ eq_map = {
145
+ "Pop": [(200, 500, -3), (2000, 4000, +4)],
146
+ "EDM": [(60, 250, +6), (8000, 12000, +3)],
147
+ "Rock": [(1000, 3000, +4), (7000, 10000, -3)],
148
+ "Hip-Hop": [(20, 100, +6), (7000, 10000, -4)],
149
+ "Acoustic": [(100, 300, -3), (4000, 8000, +2)],
150
+ "Metal": [(100, 500, -4), (2000, 5000, +6), (7000, 12000, -3)],
151
+ "Trap": [(80, 120, +6), (3000, 6000, -4)],
152
+ "LoFi": [(20, 200, +3), (1000, 3000, -2)],
153
+ "Jazz": [(100, 400, +2), (1500, 3000, +1)],
154
+ "Classical": [(200, 1000, +1), (3000, 6000, +2)],
155
+ "Chillhop": [(50, 200, +3), (2000, 5000, +1)],
156
+ "Ambient": [(100, 500, +4), (6000, 12000, +2)],
157
+ "Jazz Piano": [(100, 1000, +3), (2000, 5000, +2)],
158
+ "Trap EDM": [(60, 120, +6), (2000, 5000, -3)],
159
+ "Indie Rock": [(150, 400, +2), (2000, 5000, +3)],
160
+ "Lo-Fi Jazz": [(80, 200, +3), (2000, 4000, -1)],
161
+ "R&B": [(100, 300, +4), (2000, 4000, +3)],
162
+ "Soul": [(80, 200, +3), (1500, 3500, +4)],
163
+ "Funk": [(80, 200, +5), (1000, 3000, +3)]
164
+ }
 
 
165
 
166
+ def auto_eq(audio, genre="Pop"):
167
  from scipy.signal import butter, sosfilt
168
 
169
  def band_eq(samples, sr, lowcut, highcut, gain):
 
709
  )
710
  # --- Custom EQ Editor ---
711
  with gr.Tab("🎛 Custom EQ Editor"):
 
712
  gr.Interface(
713
  fn=auto_eq,
714
  inputs=[