audio-validation 0.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- audio_validation-0.1.2/.github/workflows/code_checker.yml +42 -0
- audio_validation-0.1.2/.github/workflows/publish_to_pypi.yml +35 -0
- audio_validation-0.1.2/.github/workflows/unit_tests.yml +36 -0
- audio_validation-0.1.2/.gitignore +189 -0
- audio_validation-0.1.2/.pylint_ignore +0 -0
- audio_validation-0.1.2/LICENSE +21 -0
- audio_validation-0.1.2/PKG-INFO +144 -0
- audio_validation-0.1.2/README.md +85 -0
- audio_validation-0.1.2/RELEASE_NOTES.md +3 -0
- audio_validation-0.1.2/_ci/is_dev_version.sh +11 -0
- audio_validation-0.1.2/docs/Makefile +31 -0
- audio_validation-0.1.2/docs/conf.py +46 -0
- audio_validation-0.1.2/docs/contribute.rst +18 -0
- audio_validation-0.1.2/docs/index.rst +22 -0
- audio_validation-0.1.2/docs/installation.rst +40 -0
- audio_validation-0.1.2/docs/release_notes.rst +5 -0
- audio_validation-0.1.2/docs/requirements.txt +4 -0
- audio_validation-0.1.2/docs/tutorials/index.rst +4 -0
- audio_validation-0.1.2/pyproject.toml +32 -0
- audio_validation-0.1.2/requirements-dev.txt +3 -0
- audio_validation-0.1.2/requirements-test.txt +4 -0
- audio_validation-0.1.2/requirements.txt +5 -0
- audio_validation-0.1.2/setup.cfg +4 -0
- audio_validation-0.1.2/src/audio_validation/__init__.py +0 -0
- audio_validation-0.1.2/src/audio_validation/_version.py +24 -0
- audio_validation-0.1.2/src/audio_validation/audio_features.py +430 -0
- audio_validation-0.1.2/src/audio_validation/audio_verification.py +567 -0
- audio_validation-0.1.2/src/audio_validation/utils/audio_generation.py +168 -0
- audio_validation-0.1.2/src/audio_validation.egg-info/PKG-INFO +144 -0
- audio_validation-0.1.2/src/audio_validation.egg-info/SOURCES.txt +34 -0
- audio_validation-0.1.2/src/audio_validation.egg-info/dependency_links.txt +1 -0
- audio_validation-0.1.2/src/audio_validation.egg-info/requires.txt +30 -0
- audio_validation-0.1.2/src/audio_validation.egg-info/top_level.txt +1 -0
- audio_validation-0.1.2/tests/__init__.py +0 -0
- audio_validation-0.1.2/tests/test_template.py +10 -0
- audio_validation-0.1.2/tox.ini +66 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
name: Code-checker
|
|
2
|
+
|
|
3
|
+
on: [push]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
build:
|
|
7
|
+
runs-on: ubuntu-latest
|
|
8
|
+
strategy:
|
|
9
|
+
matrix:
|
|
10
|
+
python-version: ["3.12"]
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
14
|
+
uses: actions/setup-python@v3
|
|
15
|
+
with:
|
|
16
|
+
python-version: ${{ matrix.python-version }}
|
|
17
|
+
- name: Install dependencies
|
|
18
|
+
run: |
|
|
19
|
+
python -m pip install --upgrade pip
|
|
20
|
+
pip install .[dev]
|
|
21
|
+
- name: Gathering the changed files
|
|
22
|
+
id: gather
|
|
23
|
+
run: |
|
|
24
|
+
git fetch origin
|
|
25
|
+
files=$(git diff --name-only origin/main -- "*.py" | xargs)
|
|
26
|
+
echo "Changed files: $files"
|
|
27
|
+
echo "$files" > changed_files.txt
|
|
28
|
+
echo "files=$files" >> "$GITHUB_OUTPUT"
|
|
29
|
+
|
|
30
|
+
- name: Analysing the code with pylint
|
|
31
|
+
if: steps.gather.outputs.files != ''
|
|
32
|
+
run: |
|
|
33
|
+
files=$(cat changed_files.txt)
|
|
34
|
+
pylint \
|
|
35
|
+
--disable duplicate-code \
|
|
36
|
+
--ignore=$(paste -sd, - < .pylint_ignore) $files
|
|
37
|
+
|
|
38
|
+
- name: Analysing the code style with black
|
|
39
|
+
if: steps.gather.outputs.files != ''
|
|
40
|
+
run: |
|
|
41
|
+
files=$(cat changed_files.txt)
|
|
42
|
+
black --check --diff $files
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
name: Publish Python Package
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- '*'
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build-and-publish:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
steps:
|
|
14
|
+
- name: Check out code
|
|
15
|
+
uses: actions/checkout@v3
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
- name: Set up Python
|
|
19
|
+
uses: actions/setup-python@v4
|
|
20
|
+
with:
|
|
21
|
+
python-version: '3.11'
|
|
22
|
+
|
|
23
|
+
- name: Install dependencies
|
|
24
|
+
run: |
|
|
25
|
+
python -m pip install --upgrade pip
|
|
26
|
+
pip install build twine
|
|
27
|
+
|
|
28
|
+
- name: Build package
|
|
29
|
+
run: python -m build
|
|
30
|
+
|
|
31
|
+
- name: Publish to PyPI
|
|
32
|
+
env:
|
|
33
|
+
TWINE_USERNAME: __token__
|
|
34
|
+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
|
|
35
|
+
run: python -m twine upload --verbose dist/*
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
name: Unit-tests
|
|
2
|
+
|
|
3
|
+
on: [push]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
build:
|
|
7
|
+
runs-on: ubuntu-latest
|
|
8
|
+
strategy:
|
|
9
|
+
matrix:
|
|
10
|
+
python-version: ["3.12"]
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
14
|
+
uses: actions/setup-python@v3
|
|
15
|
+
with:
|
|
16
|
+
python-version: ${{ matrix.python-version }}
|
|
17
|
+
- name: Install dependencies
|
|
18
|
+
run: |
|
|
19
|
+
python -m pip install --upgrade pip
|
|
20
|
+
pip install .[test]
|
|
21
|
+
- name: Gathering the changed files
|
|
22
|
+
run: |
|
|
23
|
+
pytest -vv --log-level DEBUG \
|
|
24
|
+
--cov src \
|
|
25
|
+
--cov-branch \
|
|
26
|
+
--cov-report html:reports/pytest_coverage \
|
|
27
|
+
--cov-fail-under 0 \
|
|
28
|
+
--junitxml=reports/junit/test-results-${{ matrix.python-version }}.xml
|
|
29
|
+
- name: Upload pytest test results
|
|
30
|
+
uses: actions/upload-artifact@v4
|
|
31
|
+
with:
|
|
32
|
+
name: reports-${{ matrix.python-version }}
|
|
33
|
+
path: |
|
|
34
|
+
reports
|
|
35
|
+
# Use always() to always run this step to publish test results when there are test failures
|
|
36
|
+
if: ${{ always() }}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
# Created by .ignore support plugin (hsz.mobi)
|
|
2
|
+
### Python template
|
|
3
|
+
# Byte-compiled / optimized / DLL files
|
|
4
|
+
__pycache__/
|
|
5
|
+
*.py[cod]
|
|
6
|
+
*$py.class
|
|
7
|
+
|
|
8
|
+
# C extensions
|
|
9
|
+
*.so
|
|
10
|
+
|
|
11
|
+
# Distribution / packaging
|
|
12
|
+
.Python
|
|
13
|
+
env/
|
|
14
|
+
build/
|
|
15
|
+
develop-eggs/
|
|
16
|
+
dist/
|
|
17
|
+
downloads/
|
|
18
|
+
eggs/
|
|
19
|
+
.eggs/
|
|
20
|
+
lib64/
|
|
21
|
+
parts/
|
|
22
|
+
sdist/
|
|
23
|
+
var/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
|
|
28
|
+
# PyInstaller
|
|
29
|
+
# Usually these files are written by a python script from a template
|
|
30
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
31
|
+
*.manifest
|
|
32
|
+
*.spec
|
|
33
|
+
|
|
34
|
+
# Installer logs
|
|
35
|
+
pip-log.txt
|
|
36
|
+
pip-delete-this-directory.txt
|
|
37
|
+
|
|
38
|
+
# Unit test / coverage reports
|
|
39
|
+
htmlcov/
|
|
40
|
+
.tox/
|
|
41
|
+
.coverage
|
|
42
|
+
.coverage.*
|
|
43
|
+
.cache
|
|
44
|
+
nosetests.xml
|
|
45
|
+
coverage.xml
|
|
46
|
+
*,cover
|
|
47
|
+
.hypothesis/
|
|
48
|
+
|
|
49
|
+
# Translations
|
|
50
|
+
*.mo
|
|
51
|
+
*.pot
|
|
52
|
+
|
|
53
|
+
# Django stuff:
|
|
54
|
+
*.log
|
|
55
|
+
local_settings.py
|
|
56
|
+
|
|
57
|
+
# Flask stuff:
|
|
58
|
+
instance/
|
|
59
|
+
.webassets-cache
|
|
60
|
+
|
|
61
|
+
# Scrapy stuff:
|
|
62
|
+
.scrapy
|
|
63
|
+
|
|
64
|
+
# Sphinx documentation
|
|
65
|
+
docs/_build/
|
|
66
|
+
# modules are autogenerated on each merge
|
|
67
|
+
docs/modules/
|
|
68
|
+
|
|
69
|
+
# PyBuilder
|
|
70
|
+
target/
|
|
71
|
+
|
|
72
|
+
# IPython Notebook
|
|
73
|
+
.ipynb_checkpoints
|
|
74
|
+
|
|
75
|
+
# pyenv
|
|
76
|
+
.python-version
|
|
77
|
+
|
|
78
|
+
# celery beat schedule file
|
|
79
|
+
celerybeat-schedule
|
|
80
|
+
|
|
81
|
+
# dotenv
|
|
82
|
+
.env
|
|
83
|
+
|
|
84
|
+
# virtualenv
|
|
85
|
+
venv/
|
|
86
|
+
ENV/
|
|
87
|
+
|
|
88
|
+
# Spyder project settings
|
|
89
|
+
.spyderproject
|
|
90
|
+
|
|
91
|
+
# Rope project settings
|
|
92
|
+
.ropeproject
|
|
93
|
+
### VirtualEnv template
|
|
94
|
+
# Virtualenv
|
|
95
|
+
# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
|
|
96
|
+
#[Bb]in
|
|
97
|
+
[Ii]nclude
|
|
98
|
+
[Ll]ib64
|
|
99
|
+
[Ll]ocal
|
|
100
|
+
pyvenv.cfg
|
|
101
|
+
.venv
|
|
102
|
+
pip-selfcheck.json
|
|
103
|
+
|
|
104
|
+
### JetBrains template
|
|
105
|
+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
|
106
|
+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
|
107
|
+
|
|
108
|
+
**/.idea/*
|
|
109
|
+
.idea/*
|
|
110
|
+
# User-specific stuff
|
|
111
|
+
.idea/**/workspace.xml
|
|
112
|
+
.idea/**/tasks.xml
|
|
113
|
+
.idea/**/usage.statistics.xml
|
|
114
|
+
.idea/**/dictionaries
|
|
115
|
+
.idea/**/shelf
|
|
116
|
+
|
|
117
|
+
# AWS User-specific
|
|
118
|
+
.idea/**/aws.xml
|
|
119
|
+
|
|
120
|
+
# Generated files
|
|
121
|
+
.idea/**/contentModel.xml
|
|
122
|
+
|
|
123
|
+
# Sensitive or high-churn files
|
|
124
|
+
.idea/**/dataSources/
|
|
125
|
+
.idea/**/dataSources.ids
|
|
126
|
+
.idea/**/dataSources.local.xml
|
|
127
|
+
.idea/**/sqlDataSources.xml
|
|
128
|
+
.idea/**/dynamic.xml
|
|
129
|
+
.idea/**/uiDesigner.xml
|
|
130
|
+
.idea/**/dbnavigator.xml
|
|
131
|
+
|
|
132
|
+
# Gradle
|
|
133
|
+
.idea/**/gradle.xml
|
|
134
|
+
.idea/**/libraries
|
|
135
|
+
|
|
136
|
+
# Gradle and Maven with auto-import
|
|
137
|
+
# When using Gradle or Maven with auto-import, you should exclude module files,
|
|
138
|
+
# since they will be recreated, and may cause churn. Uncomment if using
|
|
139
|
+
# auto-import.
|
|
140
|
+
# .idea/artifacts
|
|
141
|
+
# .idea/compiler.xml
|
|
142
|
+
# .idea/jarRepositories.xml
|
|
143
|
+
# .idea/modules.xml
|
|
144
|
+
# .idea/*.iml
|
|
145
|
+
# .idea/modules
|
|
146
|
+
# *.iml
|
|
147
|
+
# *.ipr
|
|
148
|
+
|
|
149
|
+
# CMake
|
|
150
|
+
cmake-build-*/
|
|
151
|
+
|
|
152
|
+
# Mongo Explorer plugin
|
|
153
|
+
.idea/**/mongoSettings.xml
|
|
154
|
+
|
|
155
|
+
# File-based project format
|
|
156
|
+
*.iws
|
|
157
|
+
|
|
158
|
+
# IntelliJ
|
|
159
|
+
out/
|
|
160
|
+
|
|
161
|
+
# mpeltonen/sbt-idea plugin
|
|
162
|
+
.idea_modules/
|
|
163
|
+
|
|
164
|
+
# JIRA plugin
|
|
165
|
+
atlassian-ide-plugin.xml
|
|
166
|
+
|
|
167
|
+
# Cursive Clojure plugin
|
|
168
|
+
.idea/replstate.xml
|
|
169
|
+
|
|
170
|
+
# SonarLint plugin
|
|
171
|
+
.idea/sonarlint/
|
|
172
|
+
|
|
173
|
+
# Crashlytics plugin (for Android Studio and IntelliJ)
|
|
174
|
+
com_crashlytics_export_strings.xml
|
|
175
|
+
crashlytics.properties
|
|
176
|
+
crashlytics-build.properties
|
|
177
|
+
fabric.properties
|
|
178
|
+
|
|
179
|
+
# Editor-based Rest Client
|
|
180
|
+
.idea/httpRequests
|
|
181
|
+
|
|
182
|
+
# Android studio 3.1+ serialized cache file
|
|
183
|
+
.idea/caches/build_file_checksums.ser
|
|
184
|
+
|
|
185
|
+
#vscode
|
|
186
|
+
.vscode/
|
|
187
|
+
|
|
188
|
+
**/test_reports
|
|
189
|
+
*~
|
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 int2code
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: audio_validation
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: Tools for validating audio data, including feature extraction and visualization.
|
|
5
|
+
Maintainer-email: Hubert Stepniewski <hubert.stepniewski@int2code.com>, Marcin Tomiczek <marcin.tomiczek@int2code.com>, Piotr Sznapka <piotr.sznapka@int2code.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026 int2code
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Requires-Python: >=3.11
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
License-File: LICENSE
|
|
31
|
+
Requires-Dist: numpy
|
|
32
|
+
Requires-Dist: scipy
|
|
33
|
+
Requires-Dist: matplotlib
|
|
34
|
+
Requires-Dist: pandas
|
|
35
|
+
Requires-Dist: pytest
|
|
36
|
+
Provides-Extra: test
|
|
37
|
+
Requires-Dist: coverage; extra == "test"
|
|
38
|
+
Requires-Dist: pytest; extra == "test"
|
|
39
|
+
Requires-Dist: pytest-cov; extra == "test"
|
|
40
|
+
Requires-Dist: pytest-html; extra == "test"
|
|
41
|
+
Provides-Extra: dev
|
|
42
|
+
Requires-Dist: coverage; extra == "dev"
|
|
43
|
+
Requires-Dist: pytest; extra == "dev"
|
|
44
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
45
|
+
Requires-Dist: pytest-html; extra == "dev"
|
|
46
|
+
Requires-Dist: black; extra == "dev"
|
|
47
|
+
Requires-Dist: pylint; extra == "dev"
|
|
48
|
+
Requires-Dist: tox; extra == "dev"
|
|
49
|
+
Provides-Extra: docs
|
|
50
|
+
Requires-Dist: coverage; extra == "docs"
|
|
51
|
+
Requires-Dist: pytest; extra == "docs"
|
|
52
|
+
Requires-Dist: pytest-cov; extra == "docs"
|
|
53
|
+
Requires-Dist: pytest-html; extra == "docs"
|
|
54
|
+
Requires-Dist: sphinx; extra == "docs"
|
|
55
|
+
Requires-Dist: sphinx-rtd-theme; extra == "docs"
|
|
56
|
+
Requires-Dist: sphinxcontrib-programoutput; extra == "docs"
|
|
57
|
+
Requires-Dist: myst-parser; extra == "docs"
|
|
58
|
+
Dynamic: license-file
|
|
59
|
+
|
|
60
|
+
# audio_validation
|
|
61
|
+
|
|
62
|
+
A Python library for validating and analysing audio data, including feature extraction, bit-exact verification against a reference, and waveform generation utilities.
|
|
63
|
+
|
|
64
|
+
## Features
|
|
65
|
+
|
|
66
|
+
- **Feature extraction** — compute RMS, peak/min/max, mean, FFT-based frequency detection, and per-channel audio onset offset for multi-channel captures.
|
|
67
|
+
- **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).
|
|
68
|
+
- **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.
|
|
69
|
+
|
|
70
|
+
## Requirements
|
|
71
|
+
|
|
72
|
+
- Python ≥ 3.11
|
|
73
|
+
- See [requirements.txt](requirements.txt) for runtime dependencies (`numpy`, `scipy`, `sounddevice`, `pymodbus`, …).
|
|
74
|
+
|
|
75
|
+
## Installation
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
pip install audio_validation
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Or, for development:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
pip install -e ".[dev]"
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Usage
|
|
88
|
+
|
|
89
|
+
### Feature extraction
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
from audio_validation.audio_features import AudioFeatures
|
|
93
|
+
|
|
94
|
+
features = AudioFeatures.compute(
|
|
95
|
+
samples=raw_samples, # numpy array, shape (n_samples, n_channels)
|
|
96
|
+
sample_rate=48000,
|
|
97
|
+
expected_frequencies=[400, 800],
|
|
98
|
+
tolerance=50,
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
for ch_idx, ch in enumerate(features.channels):
|
|
102
|
+
print(f"Ch {ch_idx}: detected={ch.detected}, rms={ch.rms:.4f}, peaks={ch.peak_frequencies}")
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Audio verification
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
from audio_validation.audio_verification import verify_audio
|
|
109
|
+
|
|
110
|
+
results = verify_audio(
|
|
111
|
+
reference_path="reference.wav",
|
|
112
|
+
detected_samples=captured_array,
|
|
113
|
+
sample_rate=48000,
|
|
114
|
+
artifacts_dir="test_artifacts/",
|
|
115
|
+
)
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Waveform generation
|
|
119
|
+
|
|
120
|
+
```python
|
|
121
|
+
from audio_validation.utils.audio_generation import generate_wave_file
|
|
122
|
+
|
|
123
|
+
generate_wave_file(
|
|
124
|
+
shape="sine",
|
|
125
|
+
freq_list=[1000.0],
|
|
126
|
+
sample_rate=48000,
|
|
127
|
+
duration=5.0,
|
|
128
|
+
num_channels=2,
|
|
129
|
+
active_channels=[0, 1],
|
|
130
|
+
amplitude=0.05,
|
|
131
|
+
resolution_bits=16,
|
|
132
|
+
output_dir="output.wav",
|
|
133
|
+
)
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Maintainers
|
|
137
|
+
|
|
138
|
+
- Hubert Stepniewski — hubert.stepniewski@int2code.com
|
|
139
|
+
- Marcin Tomiczek — marcin.tomiczek@int2code.com
|
|
140
|
+
- Piotr Sznapka — piotr.sznapka@int2code.com
|
|
141
|
+
|
|
142
|
+
## License
|
|
143
|
+
|
|
144
|
+
See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# audio_validation
|
|
2
|
+
|
|
3
|
+
A Python library for validating and analysing audio data, including feature extraction, bit-exact verification against a reference, and waveform generation utilities.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Feature extraction** — compute RMS, peak/min/max, mean, FFT-based frequency detection, and per-channel audio onset offset for multi-channel captures.
|
|
8
|
+
- **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).
|
|
9
|
+
- **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.
|
|
10
|
+
|
|
11
|
+
## Requirements
|
|
12
|
+
|
|
13
|
+
- Python ≥ 3.11
|
|
14
|
+
- See [requirements.txt](requirements.txt) for runtime dependencies (`numpy`, `scipy`, `sounddevice`, `pymodbus`, …).
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pip install audio_validation
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Or, for development:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pip install -e ".[dev]"
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
### Feature extraction
|
|
31
|
+
|
|
32
|
+
```python
|
|
33
|
+
from audio_validation.audio_features import AudioFeatures
|
|
34
|
+
|
|
35
|
+
features = AudioFeatures.compute(
|
|
36
|
+
samples=raw_samples, # numpy array, shape (n_samples, n_channels)
|
|
37
|
+
sample_rate=48000,
|
|
38
|
+
expected_frequencies=[400, 800],
|
|
39
|
+
tolerance=50,
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
for ch_idx, ch in enumerate(features.channels):
|
|
43
|
+
print(f"Ch {ch_idx}: detected={ch.detected}, rms={ch.rms:.4f}, peaks={ch.peak_frequencies}")
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Audio verification
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
from audio_validation.audio_verification import verify_audio
|
|
50
|
+
|
|
51
|
+
results = verify_audio(
|
|
52
|
+
reference_path="reference.wav",
|
|
53
|
+
detected_samples=captured_array,
|
|
54
|
+
sample_rate=48000,
|
|
55
|
+
artifacts_dir="test_artifacts/",
|
|
56
|
+
)
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Waveform generation
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
from audio_validation.utils.audio_generation import generate_wave_file
|
|
63
|
+
|
|
64
|
+
generate_wave_file(
|
|
65
|
+
shape="sine",
|
|
66
|
+
freq_list=[1000.0],
|
|
67
|
+
sample_rate=48000,
|
|
68
|
+
duration=5.0,
|
|
69
|
+
num_channels=2,
|
|
70
|
+
active_channels=[0, 1],
|
|
71
|
+
amplitude=0.05,
|
|
72
|
+
resolution_bits=16,
|
|
73
|
+
output_dir="output.wav",
|
|
74
|
+
)
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Maintainers
|
|
78
|
+
|
|
79
|
+
- Hubert Stepniewski — hubert.stepniewski@int2code.com
|
|
80
|
+
- Marcin Tomiczek — marcin.tomiczek@int2code.com
|
|
81
|
+
- Piotr Sznapka — piotr.sznapka@int2code.com
|
|
82
|
+
|
|
83
|
+
## License
|
|
84
|
+
|
|
85
|
+
See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Minimal makefile for Sphinx documentation
|
|
2
|
+
#
|
|
3
|
+
|
|
4
|
+
# You can set these variables from the command line, and also
|
|
5
|
+
# from the environment for the first two.
|
|
6
|
+
SPHINXOPTS ?=
|
|
7
|
+
SPHINXBUILD ?= sphinx-build
|
|
8
|
+
SOURCEDIR = .
|
|
9
|
+
BUILDDIR = _build
|
|
10
|
+
|
|
11
|
+
PACKAGE_NAME = audio_validation
|
|
12
|
+
SRC_DIR = ../src
|
|
13
|
+
MODULES_DIR = modules
|
|
14
|
+
|
|
15
|
+
# Put it first so that "make" without argument is like "make help".
|
|
16
|
+
help:
|
|
17
|
+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
18
|
+
|
|
19
|
+
apidoc:
|
|
20
|
+
@sphinx-apidoc -f -o $(MODULES_DIR) $(SRC_DIR)/$(PACKAGE_NAME)
|
|
21
|
+
|
|
22
|
+
html: apidoc
|
|
23
|
+
$(SPHINXBUILD) -b html $(SOURCEDIR) $(BUILDDIR)/html
|
|
24
|
+
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
|
|
25
|
+
|
|
26
|
+
.PHONY: help Makefile
|
|
27
|
+
|
|
28
|
+
# Catch-all target: route all unknown targets to Sphinx using the new
|
|
29
|
+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
|
30
|
+
%: Makefile
|
|
31
|
+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Configuration file for the Sphinx documentation builder.
|
|
2
|
+
#
|
|
3
|
+
# For the full list of built-in configuration values, see the documentation:
|
|
4
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
|
5
|
+
# pylint: skip-file
|
|
6
|
+
from datetime import date
|
|
7
|
+
from pkg_resources import get_distribution
|
|
8
|
+
|
|
9
|
+
# -- Project information -----------------------------------------------------
|
|
10
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
|
|
11
|
+
|
|
12
|
+
project = "audio_validation"
|
|
13
|
+
copyright = f"{date.today().year}, int2code"
|
|
14
|
+
author = "int2code"
|
|
15
|
+
version = release = get_distribution("audio_validation").version
|
|
16
|
+
|
|
17
|
+
# -- General configuration ---------------------------------------------------
|
|
18
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
|
|
19
|
+
|
|
20
|
+
extensions = [
|
|
21
|
+
"sphinx.ext.duration",
|
|
22
|
+
"sphinx.ext.doctest",
|
|
23
|
+
"sphinx.ext.autodoc",
|
|
24
|
+
"sphinx.ext.autosummary",
|
|
25
|
+
"sphinxcontrib.programoutput",
|
|
26
|
+
"myst_parser",
|
|
27
|
+
]
|
|
28
|
+
autosummary_generate = True
|
|
29
|
+
|
|
30
|
+
# uncomment when _templates won't be empty
|
|
31
|
+
# templates_path = ['._templates']
|
|
32
|
+
exclude_patterns = [
|
|
33
|
+
"_build",
|
|
34
|
+
"Thumbs.db",
|
|
35
|
+
".DS_Store",
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
# -- Options for HTML output -------------------------------------------------
|
|
39
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
|
|
40
|
+
|
|
41
|
+
html_theme = "sphinx_rtd_theme"
|
|
42
|
+
# uncomment when static content is added
|
|
43
|
+
# html_static_path = ['_static']
|
|
44
|
+
|
|
45
|
+
# suppress warning from release notes and readme markdown files
|
|
46
|
+
suppress_warnings = ["myst.header"]
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
Contribution
|
|
3
|
+
============
|
|
4
|
+
|
|
5
|
+
To contribute to the project follow below steps:
|
|
6
|
+
|
|
7
|
+
* git clone this project repository
|
|
8
|
+
* create dev branch using your initials and an descriptive name like `user/feature_name`
|
|
9
|
+
* modify code as desired
|
|
10
|
+
* write unittests to cover your changes
|
|
11
|
+
* verify that pylint, pytest and other checkers pass
|
|
12
|
+
* update `RELEASE_NOTES.rst` and `version.txt` according to `sematic versioning <https://semver.org/>`_
|
|
13
|
+
* create a pull request - add at least one reviewer
|
|
14
|
+
* fix any comments until review is accepted
|
|
15
|
+
* merge your changes
|
|
16
|
+
|
|
17
|
+
After your changes are merged to the main branch an automatic pipeline will trigger,
|
|
18
|
+
verify your changes, build the package and finally upload it to artifactory server.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
int2code-audio_validation
|
|
2
|
+
============
|
|
3
|
+
|
|
4
|
+
.. if needed use .. include:: alias.txt directive
|
|
5
|
+
.. include:: ../README.md
|
|
6
|
+
:parser: myst_parser.sphinx_
|
|
7
|
+
|
|
8
|
+
.. toctree::
|
|
9
|
+
:maxdepth: 3
|
|
10
|
+
|
|
11
|
+
Installation <installation.rst>
|
|
12
|
+
Tutorials <tutorials/index.rst>
|
|
13
|
+
API <modules/modules.rst>
|
|
14
|
+
Contributing <contribute.rst>
|
|
15
|
+
Release Notes <release_notes.rst>
|
|
16
|
+
|
|
17
|
+
Indices and tables
|
|
18
|
+
==================
|
|
19
|
+
|
|
20
|
+
* :ref:`genindex`
|
|
21
|
+
* :ref:`modindex`
|
|
22
|
+
* :ref:`search`
|