Spaces:
Sleeping
Sleeping
Upload 2 files
Browse filesVoice Cleaner and Enhancer app version 1.0
- app.py +32 -0
- requirements.txt +3 -0
app.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import torchaudio
|
| 3 |
+
import torch
|
| 4 |
+
from speechbrain.pretrained import SpectralMaskEnhancement
|
| 5 |
+
|
| 6 |
+
enhancer = SpectralMaskEnhancement.from_hparams(
|
| 7 |
+
source="speechbrain/mtl-mimic-voicebank",
|
| 8 |
+
savedir="tmpdir"
|
| 9 |
+
)
|
| 10 |
+
|
| 11 |
+
def enhance_vo(file, denoise_strength):
|
| 12 |
+
orig, fs = torchaudio.load(file)
|
| 13 |
+
enhanced = enhancer.enhance_batch(orig, fs)
|
| 14 |
+
blend_ratio = denoise_strength / 100.0
|
| 15 |
+
output = (1 - blend_ratio) * orig + blend_ratio * enhanced
|
| 16 |
+
output = output / output.abs().max()
|
| 17 |
+
output_path = "enhanced_output.wav"
|
| 18 |
+
torchaudio.save(output_path, output, fs)
|
| 19 |
+
return output_path
|
| 20 |
+
|
| 21 |
+
interface = gr.Interface(
|
| 22 |
+
fn=enhance_vo,
|
| 23 |
+
inputs=[
|
| 24 |
+
gr.Audio(type="filepath", label="Upload MP3 or WAV"),
|
| 25 |
+
gr.Slider(0, 100, value=100, label="Noise Reduction Strength (%)")
|
| 26 |
+
],
|
| 27 |
+
outputs=gr.Audio(type="filepath", label="Enhanced Audio (WAV)"),
|
| 28 |
+
title="VO Cleaner - Adobe Style",
|
| 29 |
+
description="Upload your voiceover (MP3/WAV), adjust the noise reduction slider, and get a cleaner WAV file."
|
| 30 |
+
)
|
| 31 |
+
|
| 32 |
+
interface.launch()
|
requirements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio
|
| 2 |
+
torchaudio
|
| 3 |
+
speechbrain
|