Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -323,25 +323,6 @@ def voice_conversion(input, reference, steps, guidance, speed):
|
|
323 |
final_audio = final_audio / max_val
|
324 |
print("[INFO] | Final audio normalized.")
|
325 |
|
326 |
-
# Smoothen the audio to reduce distorted audio
|
327 |
-
def butter_bandpass_filter_filtfilt(data, lowcut=80, highcut=6000, fs=sr_current, order=4):
|
328 |
-
nyq = 0.5 * fs
|
329 |
-
low = lowcut / nyq
|
330 |
-
high = highcut / nyq
|
331 |
-
b, a = butter(order, [low, high], btype='band')
|
332 |
-
y = filtfilt(b, a, data)
|
333 |
-
return y
|
334 |
-
|
335 |
-
final_audio = butter_bandpass_filter_filtfilt(final_audio)
|
336 |
-
print("[INFO] | Final audio smoothed with low-pass filter.")
|
337 |
-
|
338 |
-
noise_duration = 0.5 # in seconds
|
339 |
-
noise_sample = final_audio[:int(noise_duration * sr_current)]
|
340 |
-
|
341 |
-
# Perform noise reduction
|
342 |
-
final_audio = nr.reduce_noise(y=final_audio, sr=sr_current, y_noise=noise_sample, prop_decrease=1.0)
|
343 |
-
print("[INFO] | Final audio noise reduced using noisereduce with noise sample.")
|
344 |
-
|
345 |
# Save the audio to a temporary WAV file
|
346 |
print("[INFO] | Saving final audio to a temporary WAV file.")
|
347 |
with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as tmp_file:
|
@@ -372,7 +353,7 @@ with gr.Blocks(css=css) as main:
|
|
372 |
reference_input = gr.Audio(label="Reference Audio", type="filepath")
|
373 |
|
374 |
with gr.Column():
|
375 |
-
steps = gr.Slider(label="Steps", value=
|
376 |
guidance = gr.Slider(label="Guidance", value=0.7, minimum=0.0, maximum=1.0, step=0.1)
|
377 |
speed = gr.Slider(label="Speed", value=1.0, minimum=0.5, maximum=2.0, step=0.1)
|
378 |
|
|
|
323 |
final_audio = final_audio / max_val
|
324 |
print("[INFO] | Final audio normalized.")
|
325 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
326 |
# Save the audio to a temporary WAV file
|
327 |
print("[INFO] | Saving final audio to a temporary WAV file.")
|
328 |
with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as tmp_file:
|
|
|
353 |
reference_input = gr.Audio(label="Reference Audio", type="filepath")
|
354 |
|
355 |
with gr.Column():
|
356 |
+
steps = gr.Slider(label="Steps", value=2, minimum=1, maximum=100, step=1)
|
357 |
guidance = gr.Slider(label="Guidance", value=0.7, minimum=0.0, maximum=1.0, step=0.1)
|
358 |
speed = gr.Slider(label="Speed", value=1.0, minimum=0.5, maximum=2.0, step=0.1)
|
359 |
|