Skip to main content

Audio Glitch Detector

PyPI version Python 3.12+ License: MIT

Detect audio glitches and discontinuities in sinusoidal audio signals by analyzing the signal derivative.

Important: This tool is will only work with sinusoidal audio signals.

Limitations

The algorithm detects discontinuities, so glitches that does not directly produce discontinuities might not be picked up. It can detect single sample errors in a sine wave. The test files in test_files/ show cases where the algorithm works well.

Installation

From PyPI

pip install audio-glitch-detector

From source with uv (development)

git clone https://github.com/kaspernyhus/audio-glitch-detector
cd audio-glitch-detector
uv sync --dev

Quick Start

Command Line Usage

Analyze a WAV file with automatic threshold:

audio-glitch-detector -f path/to/audio.wav

Monitor live audio stream:

audio-glitch-detector

Save glitch blocks for analysis:

audio-glitch-detector -f audio.wav --save-blocks

Library Usage

see examples/ for usage examples.

Visual Analysis

When using --save-blocks, glitch blocks (max 50) are saved as .wav files and with waveform visualizations showing the derivative analysis:

Glitch Block Visualization

Test Files

Validate the detector with test files with a known number of discontinuities:

audio-glitch-detector -f test_files/sine_discont_2_mono.wav

Expected output:

Number of discontinuities detected: 2
0:00:01.892857
0:00:03.288367

How It Works

  1. Derivative Analysis: Calculates the first derivative of audio samples
  2. Threshold Detection: Uses 99.5th percentile of derivative distribution
  3. Peak Identification: Finds samples exceeding the threshold

Development

Setup

uv sync --dev

Run the application

uv run audio-glitch-detector --help

Run tests

uv run pytest

Metadata

Release files for audio-glitch-detector 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for audio-glitch-detector 0.2.1
File Size Uploaded Provenance
audio_glitch_detector-0.2.1.tar.gz 10.6 MB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for audio-glitch-detector 0.2.1
File Interpreter ABI Platform
audio_glitch_detector-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 10.6 MB

Release files / audio_glitch_detector-0.2.1.tar.gz

Download URL audio_glitch_detector-0.2.1.tar.gz
Size 10.6 MB
Tags Source
SHA-256 checksum
How to use checksums
5e0cf581543392401bf9e4d6ec79b8c51907d12a14766a69e1f3a253c30601d1
BLAKE2b-256 checksum
How to use checksums
14eaa5ecb60596daa57617f1bc4a48d0cbe0023ee66bfccefbf46c15ffd8c730
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.12

Release files / audio_glitch_detector-0.2.1-py3-none-any.whl

Download URL audio_glitch_detector-0.2.1-py3-none-any.whl
Size 20.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d1675f1c49e72233e9b645e45307e5eeb2b5dc7e7396af71ee3d4405b92399f5
BLAKE2b-256 checksum
How to use checksums
54a9137690d07057a5e5adb1628e18a46101cde239ce20acf8a0f6d5423766c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.12

Security for audio-glitch-detector 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page