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
- Hubert Stepniewski — hubert.stepniewski@int2code.com
- Marcin Tomiczek — marcin.tomiczek@int2code.com
- Piotr Sznapka — piotr.sznapka@int2code.com
License
See LICENSE.
Metadata
Release files for audio-validation 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| audio_validation-0.4.1.tar.gz | 53.1 kB | Without provenance | Details for audio_validation-0.4.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| audio_validation-0.4.1-py3-none-any.whl | Python 3 | none | any | Details for audio_validation-0.4.1-py3-none-any.whl |
Total release size: 98.6 kB
Release files / audio_validation-0.4.1.tar.gz
| Download URL | audio_validation-0.4.1.tar.gz |
|---|---|
| Size | 53.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1d3fd0ed083c995f9968c825d8c461ef326981a87ae29bbdd1378b8f9f6e2e57
|
|
BLAKE2b-256 checksum How to use checksums |
1ff502abe71abf73043f14cb3f116a42f08946311b359e8675339afd1c849aa2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.17
|
Release files / audio_validation-0.4.1-py3-none-any.whl
| Download URL | audio_validation-0.4.1-py3-none-any.whl |
|---|---|
| Size | 45.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e4525b261ad38e54afe099f6843fcce3a92f8ccdfec140d81560b5ab81216751
|
|
BLAKE2b-256 checksum How to use checksums |
ea26b54ee9e644e3418c9ca89a6cd4e76eb7f7cf881d9868cdb980bb9f111a96
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.17
|
Security for audio-validation 0.4.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.