--- title: AI Voice Enhancer API emoji: 🎙️ colorFrom: purple colorTo: blue sdk: gradio sdk_version: "5.50.0" app_file: app_wrapper.py pinned: false --- # 🎙️ AI Voice Enhancer API Professional podcast-quality audio enhancement powered by AI. This Space provides a **REST API** for audio processing. ## 🚀 Quick Start ### For End Users (with Frontend) 1. **Download** the frontend from the repository 2. **Open** `frontend/index.html` in your browser 3. **Configure** API URL to this Space: `https://YOUR-SPACE-NAME.hf.space` 4. **Upload** audio and enhance! ### For Developers (API Integration) ```bash curl -X POST "https://YOUR-SPACE-NAME.hf.space/enhance" \ -F "file=@input.wav" \ -F "speech_level=80" \ -F "background_level=85" \ -o enhanced.wav ``` ## 📡 API Endpoints | Endpoint | Method | Description | |----------|--------|-------------| | `/` | GET | API information | | `/health` | GET | Health check | | `/enhance` | POST | Enhance audio file | | `/cleanup` | DELETE | Clean temp files | ## 🎚️ Parameters ### POST /enhance - **file**: Audio file (WAV, MP3, M4A, FLAC, OGG, AAC) - **speech_level**: 0-100 (default: 80) - Voice clarity - **background_level**: 0-100 (default: 85) - Noise reduction ## 🎯 Features - ✅ **Noise Suppression**: Facebook Denoiser (DNS) + FFmpeg - ✅ **Clarity Enhancement**: Multi-stage EQ, compression, de-essing - ✅ **Loudness Normalization**: EBU R128 standard (-16 LUFS) - ✅ **Adjustable Processing**: Fine-tune enhancement levels - ✅ **CPU Optimized**: Runs on free Spaces - ✅ **CORS Enabled**: Works with any frontend ## 🔧 Technical Details ### Audio Processing Pipeline: 1. **Validation** - Check format, duration, file size 2. **Noise Suppression** - DNS model or FFmpeg afftdn 3. **Clarity Enhancement** - EQ, gate, compression, de-esser 4. **Normalization** - EBU R128 loudness standard ### Processing Time: - 10-second audio: ~15-30 seconds - 60-second audio: ~60-120 seconds - Depends on CPU availability ## 📊 Quality Targets 80-90% of Adobe Podcast Enhance Speech quality: | Feature | Adobe Podcast | This API | |---------|--------------|----------| | Noise Removal | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐ | | Clarity | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐ | | Speed | ⭐⭐⭐ | ⭐⭐⭐⭐ | | Cost | 💰💰💰 | Free ✅ | ## 💻 Example: Python Client ```python import requests class VoiceEnhancer: def __init__(self, api_url): self.api_url = api_url def enhance(self, audio_file, speech=80, background=85): url = f"{self.api_url}/enhance" files = {"file": open(audio_file, "rb")} data = { "speech_level": speech, "background_level": background } response = requests.post(url, files=files, data=data) if response.ok: return response.content else: raise Exception(f"Enhancement failed: {response.text}") # Usage enhancer = VoiceEnhancer("https://YOUR-SPACE-NAME.hf.space") enhanced_audio = enhancer.enhance("input.wav", speech=80, background=85) with open("output.wav", "wb") as f: f.write(enhanced_audio) ``` ## 📝 Limitations - **Duration**: Max 60 seconds - **File Size**: Max 50MB - **Concurrent Users**: Limited on free tier - **Processing Speed**: Depends on CPU availability ## 🛠️ Tech Stack - **API Framework**: FastAPI + Uvicorn - **Audio Processing**: - PyTorch + Torchaudio - Facebook Denoiser (DNS) - FFmpeg (filters, normalization) - **ML Model**: DNS64 (pretrained) ## 📦 Deployment This Space runs: - FastAPI server on port 7860 - Gradio info page on port 7861 (this page) The actual audio processing happens via the FastAPI endpoints. ## 🔒 Privacy - No data stored permanently - Temporary files auto-deleted after 30 minutes - No analytics or tracking - Processes on-server (no external APIs) ## 📄 License MIT License - Free to use, modify, and distribute. ## 🙏 Acknowledgments - **Facebook AI**: For Denoiser library - **FFmpeg**: For robust audio tools - **Hugging Face**: For free hosting --- **Repository**: [GitHub Link Here] **Frontend**: Download from repository **Support**: Open an issue on GitHub