Skip to main content

CLI-first deterministic audio/video quality gate with optional AI probing

Project description

Sonic Gate

PyPI Python License Downloads CI

Stop paying humans to listen to corrupted audio files. Fix them automatically.

Sonic Gate is a CLI-first audio/video quality gate that uses deterministic audio analysis to catch corrupted, invalid, or low-quality audio files before they reach human reviewers or downstream pipelines.

Optional AI Probe: Includes an experimental Whisper-based speech quality probe (disabled by default) for users who want to detect language mismatches or speech quality issues.

Features

  • Traditional Analysis (Fast & Deterministic):
    • LUFS loudness measurement (FFmpeg ebur128)
    • Silence detection (pydub)
    • Duration validation
    • Format/corruption checking
  • Video Support: Auto-extract audio from MP4, MOV, AVI, MKV, WebM
  • Fix Mode: Auto-trim silence, normalize LUFS, non-destructive repairs
  • Multiple Formats: Table, JSON, CSV, Markdown output
  • Optional AI Probe: Whisper-based speech detection (off by default)

Installation

# Install the deterministic core (fast, no AI dependencies)
pip install sonic-gate

# With optional AI probe (includes Whisper)
pip install "sonic-gate[ai]"

Or install from source:

git clone https://github.com/Codinglone/sonic-gate.git
cd sonic-gate
pip install -e .

Demo

Sonic Gate Demo

Quick Start

# Analyze a single file (deterministic only, fast)
sonic-gate interview.wav

# Analyze a directory
sonic-gate ./recordings/

# With custom config
sonic-gate --config gate.yaml ./podcasts/

# Fix failed files automatically
sonic-gate --fix ./recordings/

# JSON output for CI
sonic-gate --format json ./files/ > report.json

# Demo mode
sonic-gate demo

Configuration

Default (Deterministic Only - Fast)

rules:
  traditional:
    max_silence_seconds: 3.0
    lufs_range: [-24, -16]
  
  ai_probe:
    enabled: false  # Whisper is OFF by default

output:
  format: table
  show_passed: false

With AI Probe Enabled (Experimental)

rules:
  traditional:
    max_silence_seconds: 3.0
    lufs_range: [-24, -16]
  
  ai_probe:
    enabled: true           # Enable Whisper
    whisper_model: base     # tiny/base/small/medium/large
    min_confidence: -1.0    # Logprob threshold (negative values)
    expected_language: en   # Optional language check
    speaking_rate_range: [100, 180]

fix:
  enabled: false
  output_dir: ./fixed
  normalize_lufs: -16.0

output:
  format: table
  show_passed: false

Note: The AI probe uses Whisper logprob-based confidence scores which are always negative. Typical values range from -0.5 (good) to -5.0 (poor). Adjust min_confidence based on your audio quality and language.

Performance

Analyzer Speed Notes
Traditional (LUFS, silence, format) ~4ms/file Deterministic, always accurate
AI Probe (Whisper tiny) ~200ms/file Optional, experimental
Video extraction +100ms/file One-time FFmpeg extract

Recommendation: Use traditional analysis for batch processing. Enable AI probe only when you need speech-specific checks.

Requirements

  • Python 3.9+
  • FFmpeg (for LUFS and video support)

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sonic_gate-0.1.3.tar.gz (18.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sonic_gate-0.1.3-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

Details for the file sonic_gate-0.1.3.tar.gz.

File metadata

  • Download URL: sonic_gate-0.1.3.tar.gz
  • Upload date:
  • Size: 18.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for sonic_gate-0.1.3.tar.gz
Algorithm Hash digest
SHA256 7aafe5d7b3c84d6db86ea781f16f2a5098b3114d093b14eb6d8e7f0f10bb829f
MD5 efa653e0bacb9127612dcd18289fed6a
BLAKE2b-256 1db75b8501b8ed5e5cc24acf9361d4993a971a1c9ccefb224055fd959e5c4977

See more details on using hashes here.

File details

Details for the file sonic_gate-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: sonic_gate-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 18.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for sonic_gate-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6048d1d80066202648f03c10e9141ce1bba46166028174964b0299b009bc5691
MD5 a2f560317848d717d0d5b7d207e66579
BLAKE2b-256 f307641de32e91b7ccd06a5cb2d4c49977339607997ae201bc3877d16805d5c1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page