Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -699,7 +699,12 @@ with gr.Blocks() as demo:
|
|
| 699 |
formant_shift = gr.Slider(minimum=-2, maximum=2, value=1.0, step=0.1, label="Formant Shift")
|
| 700 |
formant_output = gr.Audio(label="Natural-Sounding Vocal", type="numpy")
|
| 701 |
formant_btn = gr.Button("Apply Correction")
|
| 702 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 703 |
|
| 704 |
# Tab: Voice Swap / Cloning
|
| 705 |
with gr.Tab("🔁 Voice Swap / Cloning"):
|
|
|
|
| 699 |
formant_shift = gr.Slider(minimum=-2, maximum=2, value=1.0, step=0.1, label="Formant Shift")
|
| 700 |
formant_output = gr.Audio(label="Natural-Sounding Vocal", type="numpy")
|
| 701 |
formant_btn = gr.Button("Apply Correction")
|
| 702 |
+
|
| 703 |
+
def formant_correct(audio, shift=1.0):
|
| 704 |
+
samples, sr = audiosegment_to_array(audio)
|
| 705 |
+
corrected_samples = librosa.effects.pitch_shift(samples, sr=sr, n_steps=shift)
|
| 706 |
+
return array_to_audiosegment(corrected_samples.astype(np.int16), sr, channels=audio.channels)
|
| 707 |
+
|
| 708 |
|
| 709 |
# Tab: Voice Swap / Cloning
|
| 710 |
with gr.Tab("🔁 Voice Swap / Cloning"):
|