Project02

Fake Audio Detection

Gallery
Architecture Diagram
Training Pipeline
Results Chart
System Overview

Real-time Deepfake Voice Detection using acoustic feature extraction and deep learning.

Overview

Fake Audio Detection is a production-ready system for identifying AI-generated speech in audio streams. It processes audio in real-time, extracts multi-dimensional acoustic features, and classifies speech as authentic or synthetic with low latency.

Problem

Deepfake audio has become a significant threat — from voice cloning scams to political misinformation. Existing detectors are either too slow for real-time use, too brittle across recording conditions, or rely on proprietary models with limited transparency. This project addresses all three constraints.

Architecture

The system follows a two-stage pipeline:

`

Audio Stream → Feature Extraction → Ensemble Classifier → Verdict

Waveform Visualization

Live Confidence Dashboard

`

Stage 1: Feature Extraction

Three complementary feature sets are extracted simultaneously:

  • MFCCs (Mel-Frequency Cepstral Coefficients)
  • 40 MFCC coefficients
  • Delta and delta-delta features
  • Captures vocal tract envelope characteristics
  • Pitch Features
  • Fundamental frequency (F0) contour
  • Pitch jitter and shimmer
  • Voiced/unvoiced decision boundaries
  • Artificial deepfakes often fail to replicate natural pitch dynamics
  • Spectral Features
  • Spectral centroid and bandwidth
  • Mel spectrogram (128 bins)
  • Spectral contrast
  • Zero-crossing rate
  • Spectral flatness measure
  • Stage 2: Classification

    A stacked ensemble approach for robustness:

  • 1D CNN: Captures local temporal patterns in spectrograms
  • LSTM: Models long-range temporal dependencies in MFCC sequences
  • SVM (RBF kernel): Provides a strong baseline for high-dimensional feature spaces
  • Meta-learner: Logistic regression combining all three predictions
  • `

    MFCC → LSTM ─┐

    ├→ Meta-Learner → Real/Fake

    Spectrum → CNN ─┤

    Pitch → SVM ────┘

    `

    Training

    Dataset

  • Dataset: Combined from VoxCeleb2, LibriSpeech, and DeepFake audio corpuses
  • Authentic samples: 12,000 samples from diverse speakers and conditions
  • Synthetic samples: 15,000 samples from 8 different TTS engines (VITS, Tacotron2, Bark, ElevenLabs, etc.)
  • Train/Val/Test split: 70/15/15
  • Augmentation: Noise injection, room impulse response convolution, pitch shifting, speed perturbation, volume normalization
  • Model Training

    ParameterValue
    ------------------
    FrameworkTensorFlow 2.15
    CNN Architecture5 Conv2D layers with BatchNorm
    LSTM Units256 (bi-directional)
    CNN Classifier512 → 256 → 2
    SVM KernelRBF (C=10, gamma='scale')
    Meta LearnerLogistic Regression (liblinear)
    Epochs50 (early stopping patience=5)
    Batch Size32
    OptimizerAdamW (lr=1e-3)
    AugmentationRandom 12

    Training Results

    ModelAccuracyPrecisionRecallF1-Score
    ----------------------------------------------
    1D CNN94.2%93.8%94.1%93.9%
    BiLSTM91.7%91.2%90.9%91.1%
    SVM89.3%88.7%89.0%88.8%
    Ensemble96.8%96.4%96.7%96.5%

    Challenges

    Real-Time Latency

    Processing audio streams at <50ms per chunk required careful optimization of the feature extraction pipeline. Solution: pre-cached lookup tables for MFCC computation, batch-friendly chunk sizes of 800ms with 200ms overlap.

    Domain Gap

    Models trained on studio-quality audio performed poorly on phone-call recordings. Solved through extensive augmentation with room impulse responses and noise profiles from real-world call recordings.

    Emerging TTS Models

    New TTS engines constantly improve their output quality, making detection harder. The ensemble approach with complementary feature sets provides robustness against any single model's improvement.

    Class Imbalance

    Synthetic samples were over-represented in early training data. Applied class-weighted loss and oversampling of authentic samples to balance the training distribution.

    Optimization

    Inference Speed

  • Feature extraction vectorized with NumPy (no Python loops)
  • TensorFlow Lite converter for CNN and LSTM models (4x faster inference)
  • GPU-accelerated preprocessing with CUDA
  • Total inference time: <30ms per 800ms audio chunk on CPU
  • Memory Efficiency

  • All models quantized to INT8 for production deployment
  • Streaming feature extraction without loading full audio into memory
  • Peak memory usage under 200MB
  • Model Serving

  • TensorFlow Serving with gRPC endpoint
  • Containerized with Docker for deployment consistency
  • Horizontal scaling with model replica load balancing
  • Results

    Performance Metrics

    MetricValue
    ---------------
    Ensemble Accuracy96.8%
    False Positive Rate1.4%
    False Negative Rate3.2%
    Inference Latency28ms (CPU)
    Model Size (quantized)14MB
    Throughput150 streams concurrent

    Visualization

    The system includes a live waveform visualization dashboard:

  • Real-time spectrogram rendering
  • MFCC heatmap overlay
  • Confidence score animation
  • Frame-level prediction graph
  • Speaker embedding comparison
  • Applications

  • Call centers: Detect AI-generated voices in customer service calls
  • Media verification: Verify authenticity of audio clips in journalism
  • Security: Voice authentication systems with liveness detection
  • Content platforms: Flag synthetic audio in user uploads
  • Forensics: Assist in audio fraud investigation
  • Lessons Learned

  • Ensemble methods dominate single models: The 2.6% accuracy gain over the best single model justifies the added complexity.
  • MFCCs + Pitch are the most complementary features: CNN and SVM together capture spatial and temporal artifacts that each misses alone.
  • Augmentation is more important than architecture: Adding RIR and noise augmentation improved results more than deeper networks.
  • Real-time requires streaming design: Batch processing everything at once defeats the purpose. Streaming with overlap is essential.
  • Model interpretability matters: Grad-CAM on spectrograms reveals exactly which frequencies the model focuses on — useful for debugging failures.
  • Future Work

  • Integrate self-supervised speech embeddings (wav2vec 2.0) as additional features
  • Build a real-time browser-based detection demo with WebAudio API
  • Explore multilingual deepfake detection across languages
  • Add speaker verification to detect voice cloning from known speakers
  • Deploy as a REST API with rate-limiting and authentication
  • Source Code

    GitHub Repository

    Sivadeth PS — AI Engineer