AI Voice Detection API - HCL GUVI Buildathon
Multi-language AI voice detection system that determines whether a voice sample is AI-generated or human-generated.
Features
- Supports 5 languages: Tamil, English, Hindi, Malayalam, Telugu
- Base64-encoded MP3 input
- JSON response with classification, confidence, and explanation
- API key authentication
- Language-agnostic audio feature analysis
- REST API with FastAPI
API Specification
Endpoint
POST /detect-voice
Headers
X-API-Key: HCL_GUVI_2024_VOICE_DETECTION_KEY
Content-Type: application/json
Request Body
{
"audio_base64": "BASE64_ENCODED_MP3_AUDIO"
}Response
{
"classification": "AI_GENERATED" or "HUMAN",
"confidence_score": 0.85,
"explanation": "Analysis detected: Very consistent spectral characteristics; Low formant variation; Unnaturally smooth pitch contour",
"language_detected": null,
"processing_time_ms": 234
}The system analyzes multiple audio features:
- MFCC (Mel-frequency cepstral coefficients) - Spectral envelope analysis
- Spectral Features - Centroid, rolloff, bandwidth consistency
- Pitch Variation - AI voices have unnaturally smooth pitch
- Energy Consistency - AI maintains too-consistent energy levels
- Zero Crossing Rate - Noise pattern analysis
- Formant Patterns - Natural vs artificial voice characteristics
- Too consistent spectral characteristics
- Unnaturally smooth pitch contour
- Highly consistent energy levels
- Controlled spectral bandwidth
- Lack of natural noise/breathing patterns
- Natural spectral variation
- Natural pitch fluctuations
- Energy variation (breathing, pauses)
- Natural noise patterns
- Formant pattern variation
pip install -r requirements.txtpython app.pyThe server will start at http://localhost:8000
# Visit the interactive docs
http://localhost:8000/docs
# Or use the test script
python test_api.pythe /docs endpoint for interactive API documentation.