Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -193,7 +193,7 @@ def apply_vocal_isolation(audio_path):
|
|
| 193 |
save_track(out_path, vocal_track, model.samplerate)
|
| 194 |
return out_path
|
| 195 |
|
| 196 |
-
# === Stem Splitting Function (Now
|
| 197 |
def stem_split(audio_path):
|
| 198 |
model = pretrained.get_model(name='htdemucs')
|
| 199 |
wav = load_track_local(audio_path, model.samplerate, channels=2)
|
|
@@ -526,6 +526,13 @@ def formant_correct(audio, shift=1.0):
|
|
| 526 |
corrected = librosa.effects.pitch_shift(samples, sr=sr, n_steps=shift)
|
| 527 |
return array_to_audiosegment(corrected.astype(np.int16), sr, channels=audio.channels)
|
| 528 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 529 |
# === Main UI โ With Studio Pulse Branding ===
|
| 530 |
with gr.Blocks(css="""
|
| 531 |
body {
|
|
@@ -714,7 +721,7 @@ with gr.Blocks(css="""
|
|
| 714 |
output_other = gr.Audio(label="Processed Other", type="filepath")
|
| 715 |
btn_other.click(fn=apply_effects_to_stem, inputs=[other_path, other_effects], outputs=output_other)
|
| 716 |
|
| 717 |
-
# --- AI Remastering Tab โ
|
| 718 |
with gr.Tab("๐ฎ AI Remastering"):
|
| 719 |
gr.Interface(
|
| 720 |
fn=ai_remaster,
|
|
@@ -735,7 +742,8 @@ with gr.Blocks(css="""
|
|
| 735 |
],
|
| 736 |
outputs=gr.Audio(label="Warm Output", type="filepath"),
|
| 737 |
title="Add Analog-Style Warmth",
|
| 738 |
-
description="Enhance clarity and presence using saturation styles like Tube or Tape."
|
|
|
|
| 739 |
)
|
| 740 |
|
| 741 |
# --- Vocal Doubler / Harmonizer โ Added ===
|
|
@@ -804,7 +812,9 @@ with gr.Blocks(css="""
|
|
| 804 |
gr.Interface(
|
| 805 |
fn=visualize_spectrum,
|
| 806 |
inputs=gr.Audio(label="Upload Track", type="filepath"),
|
| 807 |
-
outputs=gr.Image(label="Spectrum Analysis")
|
|
|
|
|
|
|
| 808 |
)
|
| 809 |
|
| 810 |
# --- Loudness Graph Tab โ EBU R128 Matching ===
|
|
@@ -940,7 +950,7 @@ with gr.Blocks(css="""
|
|
| 940 |
],
|
| 941 |
outputs=gr.Audio(label="Stretched Output", type="filepath"),
|
| 942 |
title="Match Track to BPM",
|
| 943 |
-
description="Stretch audio to match a specific tempo"
|
| 944 |
)
|
| 945 |
|
| 946 |
# --- A/B Compare ===
|
|
@@ -956,7 +966,8 @@ with gr.Blocks(css="""
|
|
| 956 |
gr.Audio(label="Version B", type="filepath")
|
| 957 |
],
|
| 958 |
title="Compare Two Versions",
|
| 959 |
-
description="Hear two mixes side-by-side"
|
|
|
|
| 960 |
)
|
| 961 |
|
| 962 |
# --- Loop Section ===
|
|
@@ -971,10 +982,10 @@ with gr.Blocks(css="""
|
|
| 971 |
],
|
| 972 |
outputs=gr.Audio(label="Looped Output", type="filepath"),
|
| 973 |
title="Repeat a Section",
|
| 974 |
-
description="Useful for editing specific
|
| 975 |
)
|
| 976 |
|
| 977 |
-
# --- Share Effect Chain ===
|
| 978 |
with gr.Tab("๐ Share Effect Chain"):
|
| 979 |
gr.Interface(
|
| 980 |
fn=share_effect_chain,
|
|
@@ -1000,7 +1011,7 @@ with gr.Blocks(css="""
|
|
| 1000 |
- `Ctrl + Z`: Undo last effect
|
| 1001 |
- `Ctrl + Y`: Redo
|
| 1002 |
- `Spacebar`: Play/Stop
|
| 1003 |
-
- `Ctrl + S`: Save session
|
| 1004 |
- `Ctrl + O`: Open session
|
| 1005 |
- `Ctrl + C`: Copy effect chain
|
| 1006 |
- `Ctrl + V`: Paste effect chain
|
|
@@ -1009,7 +1020,7 @@ with gr.Blocks(css="""
|
|
| 1009 |
- `Ctrl + Shift + M`: Export full mix ZIP
|
| 1010 |
""")
|
| 1011 |
|
| 1012 |
-
# --- Vocal Formant Correction ===
|
| 1013 |
with gr.Tab("๐งโ๐ค Vocal Formant Correction"):
|
| 1014 |
gr.Interface(
|
| 1015 |
fn=formant_correct,
|
|
@@ -1019,7 +1030,7 @@ with gr.Blocks(css="""
|
|
| 1019 |
],
|
| 1020 |
outputs=gr.Audio(label="Natural-Sounding Vocal", type="filepath"),
|
| 1021 |
title="Preserve Vocal Quality During Pitch Shift",
|
| 1022 |
-
description="Make pitch-shifted vocals sound more
|
| 1023 |
)
|
| 1024 |
|
| 1025 |
demo.launch()
|
|
|
|
| 193 |
save_track(out_path, vocal_track, model.samplerate)
|
| 194 |
return out_path
|
| 195 |
|
| 196 |
+
# === Stem Splitting Function (Now Defined!) ===
|
| 197 |
def stem_split(audio_path):
|
| 198 |
model = pretrained.get_model(name='htdemucs')
|
| 199 |
wav = load_track_local(audio_path, model.samplerate, channels=2)
|
|
|
|
| 526 |
corrected = librosa.effects.pitch_shift(samples, sr=sr, n_steps=shift)
|
| 527 |
return array_to_audiosegment(corrected.astype(np.int16), sr, channels=audio.channels)
|
| 528 |
|
| 529 |
+
# === Effect Chain Sharing Functions ===
|
| 530 |
+
def share_effect_chain(selected_effects):
|
| 531 |
+
return json.dumps(selected_effects)
|
| 532 |
+
|
| 533 |
+
def load_effect_chain(chain_json):
|
| 534 |
+
return json.loads(chain_json)
|
| 535 |
+
|
| 536 |
# === Main UI โ With Studio Pulse Branding ===
|
| 537 |
with gr.Blocks(css="""
|
| 538 |
body {
|
|
|
|
| 721 |
output_other = gr.Audio(label="Processed Other", type="filepath")
|
| 722 |
btn_other.click(fn=apply_effects_to_stem, inputs=[other_path, other_effects], outputs=output_other)
|
| 723 |
|
| 724 |
+
# --- AI Remastering Tab โ Now Fixed & Working ===
|
| 725 |
with gr.Tab("๐ฎ AI Remastering"):
|
| 726 |
gr.Interface(
|
| 727 |
fn=ai_remaster,
|
|
|
|
| 742 |
],
|
| 743 |
outputs=gr.Audio(label="Warm Output", type="filepath"),
|
| 744 |
title="Add Analog-Style Warmth",
|
| 745 |
+
description="Enhance clarity and presence using saturation styles like Tube or Tape.",
|
| 746 |
+
allow_flagging="never"
|
| 747 |
)
|
| 748 |
|
| 749 |
# --- Vocal Doubler / Harmonizer โ Added ===
|
|
|
|
| 812 |
gr.Interface(
|
| 813 |
fn=visualize_spectrum,
|
| 814 |
inputs=gr.Audio(label="Upload Track", type="filepath"),
|
| 815 |
+
outputs=gr.Image(label="Spectrum Analysis"),
|
| 816 |
+
title="Real-Time Spectrum Analyzer",
|
| 817 |
+
description="See the frequency breakdown of your audio"
|
| 818 |
)
|
| 819 |
|
| 820 |
# --- Loudness Graph Tab โ EBU R128 Matching ===
|
|
|
|
| 950 |
],
|
| 951 |
outputs=gr.Audio(label="Stretched Output", type="filepath"),
|
| 952 |
title="Match Track to BPM",
|
| 953 |
+
description="Stretch or shrink audio to match a specific tempo"
|
| 954 |
)
|
| 955 |
|
| 956 |
# --- A/B Compare ===
|
|
|
|
| 966 |
gr.Audio(label="Version B", type="filepath")
|
| 967 |
],
|
| 968 |
title="Compare Two Versions",
|
| 969 |
+
description="Hear two mixes side-by-side",
|
| 970 |
+
allow_flagging="never"
|
| 971 |
)
|
| 972 |
|
| 973 |
# --- Loop Section ===
|
|
|
|
| 982 |
],
|
| 983 |
outputs=gr.Audio(label="Looped Output", type="filepath"),
|
| 984 |
title="Repeat a Section",
|
| 985 |
+
description="Useful for editing a specific part"
|
| 986 |
)
|
| 987 |
|
| 988 |
+
# --- Share Effect Chain Tab โ Now Defined! ===
|
| 989 |
with gr.Tab("๐ Share Effect Chain"):
|
| 990 |
gr.Interface(
|
| 991 |
fn=share_effect_chain,
|
|
|
|
| 1011 |
- `Ctrl + Z`: Undo last effect
|
| 1012 |
- `Ctrl + Y`: Redo
|
| 1013 |
- `Spacebar`: Play/Stop
|
| 1014 |
+
- `Ctrl + S`: Save current session
|
| 1015 |
- `Ctrl + O`: Open session
|
| 1016 |
- `Ctrl + C`: Copy effect chain
|
| 1017 |
- `Ctrl + V`: Paste effect chain
|
|
|
|
| 1020 |
- `Ctrl + Shift + M`: Export full mix ZIP
|
| 1021 |
""")
|
| 1022 |
|
| 1023 |
+
# --- Vocal Formant Correction โ Now Defined! ===
|
| 1024 |
with gr.Tab("๐งโ๐ค Vocal Formant Correction"):
|
| 1025 |
gr.Interface(
|
| 1026 |
fn=formant_correct,
|
|
|
|
| 1030 |
],
|
| 1031 |
outputs=gr.Audio(label="Natural-Sounding Vocal", type="filepath"),
|
| 1032 |
title="Preserve Vocal Quality During Pitch Shift",
|
| 1033 |
+
description="Make pitch-shifted vocals sound more human"
|
| 1034 |
)
|
| 1035 |
|
| 1036 |
demo.launch()
|