Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -549,6 +549,24 @@ def clone_voice(source_audio, reference_audio):
|
|
| 549 |
mixed.export(out_path, format="wav")
|
| 550 |
return out_path
|
| 551 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 552 |
# === Main UI – With Studio Pulse Branding ===
|
| 553 |
with gr.Blocks(css="""
|
| 554 |
body {
|
|
@@ -737,7 +755,7 @@ with gr.Blocks(css="""
|
|
| 737 |
output_other = gr.Audio(label="Processed Other", type="filepath")
|
| 738 |
btn_other.click(fn=apply_effects_to_stem, inputs=[other_path, other_effects], outputs=output_other)
|
| 739 |
|
| 740 |
-
# --- AI Remastering Tab –
|
| 741 |
with gr.Tab("🔮 AI Remastering"):
|
| 742 |
gr.Interface(
|
| 743 |
fn=ai_remaster,
|
|
@@ -899,7 +917,6 @@ with gr.Blocks(css="""
|
|
| 899 |
"Reverb",
|
| 900 |
"Auto Gain",
|
| 901 |
"Vocal Distortion",
|
| 902 |
-
"Harmony",
|
| 903 |
"Stage Mode"
|
| 904 |
]),
|
| 905 |
gr.Checkbox(label="Isolate Vocals After Effects"),
|
|
@@ -1025,7 +1042,7 @@ with gr.Blocks(css="""
|
|
| 1025 |
### Keyboard Controls
|
| 1026 |
- `Ctrl + Z`: Undo last effect
|
| 1027 |
- `Ctrl + Y`: Redo
|
| 1028 |
-
- `Spacebar`: Play/Stop
|
| 1029 |
- `Ctrl + S`: Save current session
|
| 1030 |
- `Ctrl + O`: Open session
|
| 1031 |
- `Ctrl + C`: Copy effect chain
|
|
@@ -1075,7 +1092,7 @@ with gr.Blocks(css="""
|
|
| 1075 |
gr.File(label="Final Mix")
|
| 1076 |
],
|
| 1077 |
outputs=gr.File(label="Full Mix Archive (.zip)"),
|
| 1078 |
-
title="Export Stems + Final Mix",
|
| 1079 |
description="Perfect for sharing with producers or archiving"
|
| 1080 |
)
|
| 1081 |
|
|
|
|
| 549 |
mixed.export(out_path, format="wav")
|
| 550 |
return out_path
|
| 551 |
|
| 552 |
+
# === AI Remastering – Now Fixed! ===
|
| 553 |
+
def ai_remaster(audio_path):
|
| 554 |
+
try:
|
| 555 |
+
audio = AudioSegment.from_file(audio_path)
|
| 556 |
+
samples, sr = audiosegment_to_array(audio)
|
| 557 |
+
reduced = nr.reduce_noise(y=samples, sr=sr)
|
| 558 |
+
cleaned = array_to_audiosegment(reduced, sr, channels=audio.channels)
|
| 559 |
+
cleaned_wav_path = os.path.join(tempfile.gettempdir(), "cleaned.wav")
|
| 560 |
+
cleaned.export(cleaned_wav_path, format="wav")
|
| 561 |
+
isolated_path = apply_vocal_isolation(cleaned_wav_path)
|
| 562 |
+
final_audio = AudioSegment.from_wav(isolated_path)
|
| 563 |
+
final_path = os.path.join(tempfile.gettempdir(), "remastered_output.wav")
|
| 564 |
+
final_audio.export(final_path, format="wav")
|
| 565 |
+
return final_path
|
| 566 |
+
except Exception as e:
|
| 567 |
+
print(f"Remastering Error: {str(e)}")
|
| 568 |
+
return None
|
| 569 |
+
|
| 570 |
# === Main UI – With Studio Pulse Branding ===
|
| 571 |
with gr.Blocks(css="""
|
| 572 |
body {
|
|
|
|
| 755 |
output_other = gr.Audio(label="Processed Other", type="filepath")
|
| 756 |
btn_other.click(fn=apply_effects_to_stem, inputs=[other_path, other_effects], outputs=output_other)
|
| 757 |
|
| 758 |
+
# --- AI Remastering Tab – Now Fixed & Working ===
|
| 759 |
with gr.Tab("🔮 AI Remastering"):
|
| 760 |
gr.Interface(
|
| 761 |
fn=ai_remaster,
|
|
|
|
| 917 |
"Reverb",
|
| 918 |
"Auto Gain",
|
| 919 |
"Vocal Distortion",
|
|
|
|
| 920 |
"Stage Mode"
|
| 921 |
]),
|
| 922 |
gr.Checkbox(label="Isolate Vocals After Effects"),
|
|
|
|
| 1042 |
### Keyboard Controls
|
| 1043 |
- `Ctrl + Z`: Undo last effect
|
| 1044 |
- `Ctrl + Y`: Redo
|
| 1045 |
+
- `Spacebar`: Play/Stop playback
|
| 1046 |
- `Ctrl + S`: Save current session
|
| 1047 |
- `Ctrl + O`: Open session
|
| 1048 |
- `Ctrl + C`: Copy effect chain
|
|
|
|
| 1092 |
gr.File(label="Final Mix")
|
| 1093 |
],
|
| 1094 |
outputs=gr.File(label="Full Mix Archive (.zip)"),
|
| 1095 |
+
title="Export Stems + Final Mix Together",
|
| 1096 |
description="Perfect for sharing with producers or archiving"
|
| 1097 |
)
|
| 1098 |
|