Skip to main content

audio_validation

A Python library for validating and analysing audio data, including feature extraction, bit-exact verification against a reference, and waveform generation utilities.

Features

  • Feature extraction — compute RMS, peak/min/max, mean, FFT-based frequency detection, and per-channel audio onset offset for multi-channel captures.
  • Audio verification — validate a captured audio stream against a reference WAV file with drift-tolerant re-synchronisation, detailed mismatch reporting, and automatic artefact generation (PNG plots and WAV snippets).
  • Waveform generation — generate multi-channel WAV files with configurable waveforms: sine, square, sawtooth, white noise, and pink noise; supports 16-, 24-, and 32-bit PCM output.

Requirements

  • Python ≥ 3.11
  • See requirements.txt for runtime dependencies (numpy, scipy, sounddevice, pymodbus, …).

Installation

pip install audio_validation

Or, for development:

pip install -e ".[dev]"

Usage

Feature extraction

from audio_validation.audio_features import AudioFeatures

features = AudioFeatures.compute(
    samples=raw_samples,           # numpy array, shape (n_samples, n_channels)
    sample_rate=48000,
    expected_frequencies=[400, 800],
    tolerance=50,
)

for ch_idx, ch in enumerate(features.channels):
    print(f"Ch {ch_idx}: detected={ch.detected}, rms={ch.rms:.4f}, peaks={ch.peak_frequencies}")

Audio verification

from audio_validation.audio_verification import verify_audio

results = verify_audio(
    reference_path="reference.wav",
    detected_samples=captured_array,
    sample_rate=48000,
    artifacts_dir="test_artifacts/",
)

Waveform generation

from audio_validation.utils.audio_generation import generate_wave_file

generate_wave_file(
    shape="sine",
    freq_list=[1000.0],
    sample_rate=48000,
    duration=5.0,
    num_channels=2,
    active_channels=[0, 1],
    amplitude=0.05,
    resolution_bits=16,
    output_dir="output.wav",
)

Maintainers

License

See LICENSE.

Metadata

Release files for audio-validation 0.4.2

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-validation 0.4.2
File Size Uploaded Provenance Actions
audio_validation-0.4.2.tar.gz 54.1 kB Without provenance Details for audio_validation-0.4.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for audio-validation 0.4.2
File Interpreter ABI Platform Actions
audio_validation-0.4.2-py3-none-any.whl Python 3 none any Details for audio_validation-0.4.2-py3-none-any.whl

Total release size: 99.6 kB

Release files / audio_validation-0.4.2.tar.gz

Download URL audio_validation-0.4.2.tar.gz
Size 54.1 kB
Tags Source
SHA-256 checksum
How to use checksums
72fd1d4f6b3282ad19d1e8ec005a1dc9f77cd65176c47457e23188ea714de5a9
BLAKE2b-256 checksum
How to use checksums
6fe85f1b48f163a9c75737e00f855e7dc5b9d575bdccdf1e8f0238c68a79ea3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.18

Release files / audio_validation-0.4.2-py3-none-any.whl

Download URL audio_validation-0.4.2-py3-none-any.whl
Size 45.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2bb3a2aedadc95b0a23e3d5ef70b70a3ee8e4ecc3db60ec415d9a967628b2b89
BLAKE2b-256 checksum
How to use checksums
cdb45c43063508cd0e3a317894aabc0af786bcbd1b89037c3d9ecf56b9154480
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.18

Security for audio-validation 0.4.2

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