Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -134,28 +134,29 @@ def match_loudness(audio_path, target_lufs=-14.0):
|
|
134 |
|
135 |
# === Auto-EQ per Genre – With R&B, Soul, Funk ===
|
136 |
def auto_eq(audio, genre="Pop"):
|
137 |
-
eq_map
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
|
|
159 |
from scipy.signal import butter, sosfilt
|
160 |
def band_eq(samples, sr, lowcut, highcut, gain):
|
161 |
sos = butter(10, [lowcut, highcut], btype='band', output='sos', fs=sr)
|
|
|
134 |
|
135 |
# === Auto-EQ per Genre – With R&B, Soul, Funk ===
|
136 |
def auto_eq(audio, genre="Pop"):
|
137 |
+
# Define eq_map at the global scope
|
138 |
+
eq_map = {
|
139 |
+
"Pop": [(200, 500, -3), (2000, 4000, +4)],
|
140 |
+
"EDM": [(60, 250, +6), (8000, 12000, +3)],
|
141 |
+
"Rock": [(1000, 3000, +4), (7000, 10000, -3)],
|
142 |
+
"Hip-Hop": [(20, 100, +6), (7000, 10000, -4)],
|
143 |
+
"Acoustic": [(100, 300, -3), (4000, 8000, +2)],
|
144 |
+
"Metal": [(100, 500, -4), (2000, 5000, +6), (7000, 12000, -3)],
|
145 |
+
"Trap": [(80, 120, +6), (3000, 6000, -4)],
|
146 |
+
"LoFi": [(20, 200, +3), (1000, 3000, -2)],
|
147 |
+
"Jazz": [(100, 400, +2), (1500, 3000, +1)],
|
148 |
+
"Classical": [(200, 1000, +1), (3000, 6000, +2)],
|
149 |
+
"Chillhop": [(50, 200, +3), (2000, 5000, +1)],
|
150 |
+
"Ambient": [(100, 500, +4), (6000, 12000, +2)],
|
151 |
+
"Jazz Piano": [(100, 1000, +3), (2000, 5000, +2)],
|
152 |
+
"Trap EDM": [(60, 120, +6), (2000, 5000, -3)],
|
153 |
+
"Indie Rock": [(150, 400, +2), (2000, 5000, +3)],
|
154 |
+
"Lo-Fi Jazz": [(80, 200, +3), (2000, 4000, -1)],
|
155 |
+
"R&B": [(100, 300, +4), (2000, 4000, +3)],
|
156 |
+
"Soul": [(80, 200, +3), (1500, 3500, +4)],
|
157 |
+
"Funk": [(80, 200, +5), (1000, 3000, +3)],
|
158 |
+
"Default": []
|
159 |
+
}
|
160 |
from scipy.signal import butter, sosfilt
|
161 |
def band_eq(samples, sr, lowcut, highcut, gain):
|
162 |
sos = butter(10, [lowcut, highcut], btype='band', output='sos', fs=sr)
|