Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -185,7 +185,7 @@ def ai_mastering_chain(audio_path, genre="Pop", target_lufs=-14.0):
|
|
185 |
final_audio.export(out_path, format="wav")
|
186 |
return out_path
|
187 |
|
188 |
-
# === Harmonic Saturation / Exciter β Now
|
189 |
def harmonic_saturation(audio, saturation_type="Tube", intensity=0.2):
|
190 |
samples = np.array(audio.get_array_of_samples()).astype(np.float32)
|
191 |
|
@@ -244,7 +244,7 @@ def stem_split(audio_path):
|
|
244 |
|
245 |
return stem_paths
|
246 |
|
247 |
-
# === Process Audio Function ===
|
248 |
def process_audio(audio_file, selected_effects, isolate_vocals, preset_name, export_format):
|
249 |
status = "π Loading audio..."
|
250 |
try:
|
@@ -263,6 +263,7 @@ def process_audio(audio_file, selected_effects, isolate_vocals, preset_name, exp
|
|
263 |
"Normalize": apply_normalize,
|
264 |
"Noise Gate": lambda x: apply_noise_gate(x, threshold=-50.0),
|
265 |
"Limiter": lambda x: apply_limiter(x, limit_dB=-1),
|
|
|
266 |
"Bitcrusher": lambda x: apply_bitcrush(x, bit_depth=8),
|
267 |
"Auto Gain": lambda x: apply_auto_gain(x, target_dB=-20),
|
268 |
"Vocal Distortion": lambda x: apply_vocal_distortion(x),
|
@@ -432,7 +433,7 @@ with gr.Blocks(title="AI Audio Studio", css="style.css") as demo:
|
|
432 |
output_audio, waveform_img, session_log_out, genre_out, status_box
|
433 |
])
|
434 |
|
435 |
-
# --- AI Mastering Chain Tab β Fully Defined ===
|
436 |
with gr.Tab("π§ AI Mastering Chain"):
|
437 |
gr.Interface(
|
438 |
fn=ai_mastering_chain,
|
@@ -447,21 +448,7 @@ with gr.Blocks(title="AI Audio Studio", css="style.css") as demo:
|
|
447 |
allow_flagging="never"
|
448 |
)
|
449 |
|
450 |
-
# ---
|
451 |
-
with gr.Tab("𧬠Harmonic Saturation"):
|
452 |
-
gr.Interface(
|
453 |
-
fn=harmonic_saturation,
|
454 |
-
inputs=[
|
455 |
-
gr.Audio(label="Upload Track", type="filepath"),
|
456 |
-
gr.Dropdown(choices=["Tube", "Tape", "Console", "Mix Bus"], label="Saturation Type", value="Tube"),
|
457 |
-
gr.Slider(minimum=0.1, maximum=1.0, value=0.2, label="Intensity")
|
458 |
-
],
|
459 |
-
outputs=gr.Audio(label="Warm Output", type="filepath"),
|
460 |
-
title="Add Analog-Style Warmth",
|
461 |
-
description="Enhance clarity and presence using saturation styles like Tube or Tape."
|
462 |
-
)
|
463 |
-
|
464 |
-
# --- Remix Mode β Now Included ===
|
465 |
with gr.Tab("π Remix Mode"):
|
466 |
gr.Interface(
|
467 |
fn=stem_split,
|
@@ -478,7 +465,21 @@ with gr.Blocks(title="AI Audio Studio", css="style.css") as demo:
|
|
478 |
clear_btn=None
|
479 |
)
|
480 |
|
481 |
-
# ---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
482 |
with gr.Tab("π§ Vocal Doubler / Harmonizer"):
|
483 |
gr.Interface(
|
484 |
fn=lambda x: apply_harmony(x),
|
|
|
185 |
final_audio.export(out_path, format="wav")
|
186 |
return out_path
|
187 |
|
188 |
+
# === Harmonic Saturation / Exciter β Now Included Before Use ===
|
189 |
def harmonic_saturation(audio, saturation_type="Tube", intensity=0.2):
|
190 |
samples = np.array(audio.get_array_of_samples()).astype(np.float32)
|
191 |
|
|
|
244 |
|
245 |
return stem_paths
|
246 |
|
247 |
+
# === Process Audio Function β Fully Featured ===
|
248 |
def process_audio(audio_file, selected_effects, isolate_vocals, preset_name, export_format):
|
249 |
status = "π Loading audio..."
|
250 |
try:
|
|
|
263 |
"Normalize": apply_normalize,
|
264 |
"Noise Gate": lambda x: apply_noise_gate(x, threshold=-50.0),
|
265 |
"Limiter": lambda x: apply_limiter(x, limit_dB=-1),
|
266 |
+
"Flanger": lambda x: apply_phaser(x, rate=1.2, depth=0.9, mix=0.7),
|
267 |
"Bitcrusher": lambda x: apply_bitcrush(x, bit_depth=8),
|
268 |
"Auto Gain": lambda x: apply_auto_gain(x, target_dB=-20),
|
269 |
"Vocal Distortion": lambda x: apply_vocal_distortion(x),
|
|
|
433 |
output_audio, waveform_img, session_log_out, genre_out, status_box
|
434 |
])
|
435 |
|
436 |
+
# --- AI Mastering Chain Tab β Now Fully Defined ===
|
437 |
with gr.Tab("π§ AI Mastering Chain"):
|
438 |
gr.Interface(
|
439 |
fn=ai_mastering_chain,
|
|
|
448 |
allow_flagging="never"
|
449 |
)
|
450 |
|
451 |
+
# --- Remix Mode β Stem Splitting ===
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
452 |
with gr.Tab("π Remix Mode"):
|
453 |
gr.Interface(
|
454 |
fn=stem_split,
|
|
|
465 |
clear_btn=None
|
466 |
)
|
467 |
|
468 |
+
# --- Harmonic Saturation / Exciter ===
|
469 |
+
with gr.Tab("𧬠Harmonic Saturation"):
|
470 |
+
gr.Interface(
|
471 |
+
fn=harmonic_saturation,
|
472 |
+
inputs=[
|
473 |
+
gr.Audio(label="Upload Track", type="filepath"),
|
474 |
+
gr.Dropdown(choices=["Tube", "Tape", "Console", "Mix Bus"], label="Saturation Type", value="Tube"),
|
475 |
+
gr.Slider(minimum=0.1, maximum=1.0, value=0.2, label="Intensity")
|
476 |
+
],
|
477 |
+
outputs=gr.Audio(label="Warm Output", type="filepath"),
|
478 |
+
title="Add Analog-Style Warmth",
|
479 |
+
description="Enhance clarity and presence using saturation styles like Tube or Tape."
|
480 |
+
)
|
481 |
+
|
482 |
+
# --- Vocal Doubler / Harmonizer ===
|
483 |
with gr.Tab("π§ Vocal Doubler / Harmonizer"):
|
484 |
gr.Interface(
|
485 |
fn=lambda x: apply_harmony(x),
|