osekit 1.0.1__tar.gz → 1.0.3__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.
- osekit-1.0.3/.github/dependabot.yml +36 -0
- {osekit-1.0.1 → osekit-1.0.3}/.github/workflows/documentation.yml +4 -4
- {osekit-1.0.1 → osekit-1.0.3}/.github/workflows/github_ci.yml +2 -2
- {osekit-1.0.1 → osekit-1.0.3}/.github/workflows/publish.yml +4 -4
- {osekit-1.0.1 → osekit-1.0.3}/PKG-INFO +2 -2
- {osekit-1.0.1 → osekit-1.0.3}/README.md +1 -1
- osekit-1.0.3/docs/logo/osmose_texte_sombre.png +0 -0
- osekit-1.0.3/docs/logo/osmose_texte_sombre_small.png +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/coreapi_usage.rst +27 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/example_reshaping_one_file.ipynb +27 -0
- osekit-1.0.3/docs/source/example_spectrogram.ipynb +227 -0
- {osekit-1.0.1 → osekit-1.0.3}/pyproject.toml +4 -1
- {osekit-1.0.1 → osekit-1.0.3}/src/osekit/audio_backend/audio_file_manager.py +0 -3
- {osekit-1.0.1 → osekit-1.0.3}/src/osekit/core/audio_data.py +76 -3
- {osekit-1.0.1 → osekit-1.0.3}/src/osekit/core/audio_dataset.py +22 -3
- {osekit-1.0.1 → osekit-1.0.3}/src/osekit/core/audio_file.py +11 -1
- {osekit-1.0.1 → osekit-1.0.3}/src/osekit/core/base_dataset.py +13 -5
- {osekit-1.0.1 → osekit-1.0.3}/src/osekit/core/base_file.py +1 -1
- {osekit-1.0.1 → osekit-1.0.3}/src/osekit/core/event.py +2 -2
- {osekit-1.0.1 → osekit-1.0.3}/src/osekit/core/spectro_data.py +5 -44
- {osekit-1.0.1 → osekit-1.0.3}/src/osekit/core/spectro_dataset.py +2 -2
- {osekit-1.0.1 → osekit-1.0.3}/src/osekit/core/spectro_file.py +1 -1
- {osekit-1.0.1 → osekit-1.0.3}/src/osekit/public/project.py +70 -37
- {osekit-1.0.1 → osekit-1.0.3}/src/osekit/public/transform.py +5 -1
- {osekit-1.0.1 → osekit-1.0.3}/src/osekit/utils/audio.py +101 -0
- {osekit-1.0.1 → osekit-1.0.3}/src/osekit/utils/core.py +20 -0
- {osekit-1.0.1 → osekit-1.0.3}/src/osekit/utils/path.py +2 -1
- osekit-1.0.3/src/osekit/utils/plot.py +40 -0
- osekit-1.0.3/tests/conftest.py +301 -0
- osekit-1.0.3/tests/helpers/audio.py +39 -0
- {osekit-1.0.1 → osekit-1.0.3}/tests/test_audio.py +185 -15
- {osekit-1.0.1 → osekit-1.0.3}/tests/test_core_api_base.py +24 -2
- {osekit-1.0.1 → osekit-1.0.3}/tests/test_event.py +45 -8
- {osekit-1.0.1 → osekit-1.0.3}/tests/test_export_transform.py +3 -0
- {osekit-1.0.1 → osekit-1.0.3}/tests/test_files.py +9 -2
- {osekit-1.0.1 → osekit-1.0.3}/tests/test_logging.py +1 -11
- {osekit-1.0.1 → osekit-1.0.3}/tests/test_public_api.py +156 -172
- {osekit-1.0.1 → osekit-1.0.3}/tests/test_spectro.py +69 -32
- {osekit-1.0.1 → osekit-1.0.3}/tests/test_utils.py +58 -79
- osekit-1.0.3/uv.lock +3174 -0
- osekit-1.0.1/docs/logo/osmose_texte_sombre.png +0 -0
- osekit-1.0.1/docs/logo/osmose_texte_sombre_small.png +0 -0
- osekit-1.0.1/docs/source/example_spectrogram.ipynb +0 -228
- osekit-1.0.1/src/osekit/utils/formatting.py +0 -179
- osekit-1.0.1/tests/conftest.py +0 -227
- osekit-1.0.1/uv.lock +0 -3032
- {osekit-1.0.1 → osekit-1.0.3}/.gitignore +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/.pre-commit-config.yaml +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/CHANGELOG.md +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/CITATION.cff +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/CONTRIBUTING.md +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/LICENSE +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/Makefile +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/logo/osekit.png +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/logo/osekit_mid.png +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/logo/osekit_small.png +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/logo/osmose.png +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/make.bat +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/_static/audio_data/ex1.svg +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/_static/audio_data/ex2.svg +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/_static/data_structure/file_item_data_0.svg +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/_static/data_structure/file_item_data_1.svg +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/_static/data_structure/file_item_data_2.svg +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/_static/favicon.ico +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/_static/ltas/ltas.gif +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/_static/sample_audio/id/1829.wav +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/_static/sample_audio/id/1830.wav +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/_static/sample_audio/id/1832.wav +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/_static/sample_audio/id/1833.wav +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/_static/sample_audio/id/1834.wav +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/_static/sample_audio/id/1835.wav +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/_static/sample_audio/id/1836.wav +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/_static/sample_audio/id/1837.wav +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/_static/sample_audio/id/1838.wav +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/_static/sample_audio/timestamped/sample_220925_223450.wav +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/_static/sample_audio/timestamped/sample_220925_223500.wav +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/_static/sample_audio/timestamped/sample_220925_223510.wav +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/_static/sample_audio/timestamped/sample_220925_223520.wav +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/_static/sample_audio/timestamped/sample_220925_223530.wav +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/_static/sample_audio/timestamped/sample_220925_223600.wav +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/_static/sample_audio/timestamped/sample_220925_223610.wav +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/_static/sample_audio/timestamped/sample_220925_223620.wav +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/_static/sample_audio/timestamped/sample_220925_223630.wav +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/_static/sample_audio/timestamped/sample_220925_223640.wav +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/_static/spectrograms/frequency_scale.png +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/api.rst +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/audiodata.rst +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/audiodataset.rst +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/audiofile.rst +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/audiofilemanager.rst +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/audioitem.rst +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/basedata.rst +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/basedataset.rst +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/basefile.rst +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/baseitem.rst +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/conf.py +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/contributing.rst +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/coreapi.rst +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/coreapi_home.rst +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/coreapi_introduction.rst +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/event.rst +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/example_ltas.rst +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/example_ltas_core.ipynb +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/example_ltas_public.ipynb +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/example_multiple_spectrograms.rst +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/example_multiple_spectrograms_core.ipynb +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/example_multiple_spectrograms_id.rst +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/example_multiple_spectrograms_id_core.ipynb +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/example_multiple_spectrograms_id_public.ipynb +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/example_multiple_spectrograms_public.ipynb +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/example_reshaping_multiple_files.rst +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/example_reshaping_multiple_files_core.ipynb +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/example_reshaping_multiple_files_public.ipynb +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/examples.rst +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/export_transform.rst +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/frequencyscale.rst +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/index.rst +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/installation.rst +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/instrument.rst +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/job.rst +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/jobs.rst +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/ltasdata.rst +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/multiprocessing.rst +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/normalization.rst +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/project.rst +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/publicapi.rst +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/publicapi_usage.rst +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/spectrodata.rst +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/spectrodataset.rst +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/spectrofile.rst +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/spectroitem.rst +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/transform.rst +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/usage.rst +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/docs/source/utils.rst +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/src/osekit/__init__.py +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/src/osekit/audio_backend/audio_backend.py +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/src/osekit/audio_backend/mseed_backend.py +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/src/osekit/audio_backend/soundfile_backend.py +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/src/osekit/config.py +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/src/osekit/core/__init__.py +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/src/osekit/core/audio_item.py +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/src/osekit/core/base_data.py +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/src/osekit/core/base_item.py +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/src/osekit/core/frequency_scale.py +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/src/osekit/core/instrument.py +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/src/osekit/core/json_serializer.py +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/src/osekit/core/ltas_data.py +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/src/osekit/core/ltas_dataset.py +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/src/osekit/core/spectro_item.py +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/src/osekit/core_api/__init__.py +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/src/osekit/logging_config.yaml +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/src/osekit/logging_context.py +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/src/osekit/public/__init__.py +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/src/osekit/public/export_transform.py +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/src/osekit/public_api/__init__.py +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/src/osekit/utils/__init__.py +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/src/osekit/utils/deserialization.py +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/src/osekit/utils/job.py +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/src/osekit/utils/multiprocess.py +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/src/osekit/utils/timestamp.py +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/tests/__init__.py +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/tests/helpers/__init__.py +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/tests/helpers/dummy.py +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/tests/sample_dataset/sample1_180701_204453.wav +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/tests/sample_dataset/sample1_190222_010000.wav +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/tests/sample_dataset/sample1_220998_185532.wav +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/tests/test_audio_file_manager.py +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/tests/test_frequency_scales.py +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/tests/test_instrument.py +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/tests/test_job.py +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/tests/test_mseed.py +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/tests/test_multiprocessing.py +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/tests/test_permissions.py +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/tests/test_serialization.py +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/tests/test_timestamp_utils.py +0 -0
- {osekit-1.0.1 → osekit-1.0.3}/tests/test_welch.py +0 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# To get started with Dependabot version updates, you'll need to specify which
|
|
2
|
+
# package ecosystems to update and where the package manifests are located.
|
|
3
|
+
# Please see the documentation for all configuration options:
|
|
4
|
+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
|
|
5
|
+
|
|
6
|
+
version: 2
|
|
7
|
+
|
|
8
|
+
updates:
|
|
9
|
+
- package-ecosystem: "uv"
|
|
10
|
+
directory: "/"
|
|
11
|
+
schedule:
|
|
12
|
+
interval: "weekly"
|
|
13
|
+
day: "monday"
|
|
14
|
+
time: "08:00"
|
|
15
|
+
timezone: "Europe/Paris"
|
|
16
|
+
groups:
|
|
17
|
+
dev-deps:
|
|
18
|
+
dependency-type: "development"
|
|
19
|
+
prod-deps:
|
|
20
|
+
dependency-type: "production"
|
|
21
|
+
indirect-deps:
|
|
22
|
+
patterns:
|
|
23
|
+
- "*"
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
- package-ecosystem: "github-actions"
|
|
27
|
+
directory: "/"
|
|
28
|
+
schedule:
|
|
29
|
+
interval: "weekly"
|
|
30
|
+
day: "monday"
|
|
31
|
+
time: "08:00"
|
|
32
|
+
timezone: "Europe/Paris"
|
|
33
|
+
groups:
|
|
34
|
+
gh-actions:
|
|
35
|
+
patterns:
|
|
36
|
+
- "*"
|
|
@@ -15,7 +15,7 @@ jobs:
|
|
|
15
15
|
runs-on: ubuntu-latest
|
|
16
16
|
|
|
17
17
|
steps:
|
|
18
|
-
- uses: actions/checkout@
|
|
18
|
+
- uses: actions/checkout@v7
|
|
19
19
|
|
|
20
20
|
- name: Install uv
|
|
21
21
|
uses: astral-sh/setup-uv@v7
|
|
@@ -24,7 +24,7 @@ jobs:
|
|
|
24
24
|
enable-cache: true
|
|
25
25
|
|
|
26
26
|
- name: "Set up Python"
|
|
27
|
-
uses: actions/setup-python@
|
|
27
|
+
uses: actions/setup-python@v7
|
|
28
28
|
with:
|
|
29
29
|
python-version-file: "pyproject.toml"
|
|
30
30
|
|
|
@@ -35,8 +35,8 @@ jobs:
|
|
|
35
35
|
run: uv run sphinx-build docs/source _site
|
|
36
36
|
|
|
37
37
|
- name: Upload Pages artifact
|
|
38
|
-
uses: actions/upload-pages-artifact@
|
|
38
|
+
uses: actions/upload-pages-artifact@v5
|
|
39
39
|
|
|
40
40
|
- name: Deploy to GitHub Pages
|
|
41
41
|
id: deployment
|
|
42
|
-
uses: actions/deploy-pages@
|
|
42
|
+
uses: actions/deploy-pages@v5
|
|
@@ -7,7 +7,7 @@ jobs:
|
|
|
7
7
|
runs-on: ubuntu-latest
|
|
8
8
|
|
|
9
9
|
steps:
|
|
10
|
-
- uses: actions/checkout@
|
|
10
|
+
- uses: actions/checkout@v7
|
|
11
11
|
|
|
12
12
|
- name: Install uv
|
|
13
13
|
uses: astral-sh/setup-uv@v7
|
|
@@ -16,7 +16,7 @@ jobs:
|
|
|
16
16
|
enable-cache: true
|
|
17
17
|
|
|
18
18
|
- name: "Set up Python"
|
|
19
|
-
uses: actions/setup-python@
|
|
19
|
+
uses: actions/setup-python@v7
|
|
20
20
|
with:
|
|
21
21
|
python-version-file: "pyproject.toml"
|
|
22
22
|
|
|
@@ -9,7 +9,7 @@ jobs:
|
|
|
9
9
|
build:
|
|
10
10
|
runs-on: ubuntu-latest
|
|
11
11
|
steps:
|
|
12
|
-
- uses: actions/checkout@
|
|
12
|
+
- uses: actions/checkout@v7
|
|
13
13
|
|
|
14
14
|
- name: Install uv
|
|
15
15
|
uses: astral-sh/setup-uv@v7
|
|
@@ -18,7 +18,7 @@ jobs:
|
|
|
18
18
|
enable-cache: true
|
|
19
19
|
|
|
20
20
|
- name: Set up Python
|
|
21
|
-
uses: actions/setup-python@
|
|
21
|
+
uses: actions/setup-python@v7
|
|
22
22
|
with:
|
|
23
23
|
python-version-file: "pyproject.toml"
|
|
24
24
|
|
|
@@ -29,7 +29,7 @@ jobs:
|
|
|
29
29
|
run: uv build
|
|
30
30
|
|
|
31
31
|
- name: Upload distributions
|
|
32
|
-
uses: actions/upload-artifact@
|
|
32
|
+
uses: actions/upload-artifact@v7
|
|
33
33
|
with:
|
|
34
34
|
name: dist
|
|
35
35
|
path: dist/*
|
|
@@ -49,7 +49,7 @@ jobs:
|
|
|
49
49
|
|
|
50
50
|
steps:
|
|
51
51
|
- name: Retrieve release distributions
|
|
52
|
-
uses: actions/download-artifact@
|
|
52
|
+
uses: actions/download-artifact@v8
|
|
53
53
|
with:
|
|
54
54
|
name: dist
|
|
55
55
|
path: dist/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: osekit
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.3
|
|
4
4
|
Summary: OSEkit
|
|
5
5
|
Author-email: OSmOSE team <osmose@ensta-bretagne.fr>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -46,7 +46,7 @@ Description-Content-Type: text/markdown
|
|
|
46
46
|
|
|
47
47
|
[Presentation](#presentation) •
|
|
48
48
|
[Getting into it](#getting-into-it) •
|
|
49
|
-
[
|
|
49
|
+
[Documentation](https://project-osmose.github.io/OSEkit/)
|
|
50
50
|
# ㅤ
|
|
51
51
|
|
|
52
52
|
</div>
|
|
Binary file
|
|
Binary file
|
|
@@ -203,6 +203,33 @@ Modifying the sample rate will not access the data, but the data will be resampl
|
|
|
203
203
|
ad.sample_rate = 48_000 # Resample the signal at 48 kHz. Nothing happens yet
|
|
204
204
|
resampled_signal = ad.get_value() # The original audio data will be resampled while being fetched here.
|
|
205
205
|
|
|
206
|
+
Plotting
|
|
207
|
+
""""""""
|
|
208
|
+
|
|
209
|
+
``AudioData`` waveforms can be plotted thanks to the :meth:`osekit.core.audio_data.AudioData.plot` method.
|
|
210
|
+
|
|
211
|
+
The waveform is plotted thanks to the `matplotlib.axes.Axes.plot() method <https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.plot.html>`_.
|
|
212
|
+
Every keyword argument passed to the :meth:`osekit.core.audio_data.AudioData.plot` method will be passed through to
|
|
213
|
+
the `matplotlib.axes.Axes.plot() method <https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.plot.html>`_:
|
|
214
|
+
|
|
215
|
+
.. code-block:: python
|
|
216
|
+
|
|
217
|
+
from osekit.core.audio_data import AudioData
|
|
218
|
+
import matplotlib.pyplot as plt
|
|
219
|
+
|
|
220
|
+
ad = AudioData(...)
|
|
221
|
+
ad_signal = ad.get_value()
|
|
222
|
+
|
|
223
|
+
fig, ax = plt.subplots()
|
|
224
|
+
|
|
225
|
+
ad.plot(
|
|
226
|
+
values=ad_signal, # If not provided, the signal will be fetched
|
|
227
|
+
ax=ax, # If not provided, default figure and axes will be created
|
|
228
|
+
linestyle="dashdot", # Additional kwargs passed to pyplot Plot()
|
|
229
|
+
linewidth=2, # Additional kwargs passed to pyplot Plot()
|
|
230
|
+
)
|
|
231
|
+
|
|
232
|
+
plt.show()
|
|
206
233
|
|
|
207
234
|
Audio Dataset
|
|
208
235
|
^^^^^^^^^^^^^
|
|
@@ -140,6 +140,33 @@
|
|
|
140
140
|
")"
|
|
141
141
|
]
|
|
142
142
|
},
|
|
143
|
+
{
|
|
144
|
+
"metadata": {},
|
|
145
|
+
"cell_type": "markdown",
|
|
146
|
+
"source": "It can be plotted:",
|
|
147
|
+
"id": "26fd8c7ac700850b"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"metadata": {},
|
|
151
|
+
"cell_type": "code",
|
|
152
|
+
"outputs": [],
|
|
153
|
+
"execution_count": null,
|
|
154
|
+
"source": [
|
|
155
|
+
"import matplotlib.pyplot as plt\n",
|
|
156
|
+
"import matplotlib.dates as mdates\n",
|
|
157
|
+
"\n",
|
|
158
|
+
"_, ax = plt.subplots()\n",
|
|
159
|
+
"\n",
|
|
160
|
+
"audio_data.plot(ax=ax)\n",
|
|
161
|
+
"\n",
|
|
162
|
+
"ax.set_ylabel(\"Amplitude\")\n",
|
|
163
|
+
"ax.set_xlabel(\"Time (%M:%S\")\n",
|
|
164
|
+
"ax.xaxis.set_major_formatter(mdates.DateFormatter(\"%M:%S\"))\n",
|
|
165
|
+
"\n",
|
|
166
|
+
"plt.show()"
|
|
167
|
+
],
|
|
168
|
+
"id": "bc62c794690f4555"
|
|
169
|
+
},
|
|
143
170
|
{
|
|
144
171
|
"cell_type": "markdown",
|
|
145
172
|
"id": "60f887eb643ce9c9",
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cells": [
|
|
3
|
+
{
|
|
4
|
+
"cell_type": "markdown",
|
|
5
|
+
"id": "5d67c1697ae837a4",
|
|
6
|
+
"metadata": {},
|
|
7
|
+
"source": [
|
|
8
|
+
"# Computing a spectrogram [^download]\n",
|
|
9
|
+
"\n",
|
|
10
|
+
"[^download]: This notebook can be downloaded as **{nb-download}`example_spectrogram.ipynb`**.\n",
|
|
11
|
+
"\n",
|
|
12
|
+
"This simple example will only be covered with the **Core API**."
|
|
13
|
+
]
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"cell_type": "markdown",
|
|
17
|
+
"id": "3ddf15a47797be2e",
|
|
18
|
+
"metadata": {},
|
|
19
|
+
"source": [
|
|
20
|
+
"First, create an **OSEkit** `AudioData` from the audio file(s) on disk.\n",
|
|
21
|
+
"There are multiple ways to do so: here we'll go throught the full process of parsing files into **OSEkit** `AudioFiles`:"
|
|
22
|
+
]
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"cell_type": "code",
|
|
26
|
+
"execution_count": null,
|
|
27
|
+
"id": "initial_id",
|
|
28
|
+
"metadata": {
|
|
29
|
+
"collapsed": true
|
|
30
|
+
},
|
|
31
|
+
"outputs": [],
|
|
32
|
+
"source": [
|
|
33
|
+
"from pathlib import Path\n",
|
|
34
|
+
"from osekit.core.audio_file import AudioFile\n",
|
|
35
|
+
"\n",
|
|
36
|
+
"audio_folder = Path(r\"_static/sample_audio/timestamped\")\n",
|
|
37
|
+
"audio_files = [\n",
|
|
38
|
+
" AudioFile(\n",
|
|
39
|
+
" path=p,\n",
|
|
40
|
+
" strptime_format=\"%y%m%d_%H%M%S\",\n",
|
|
41
|
+
" )\n",
|
|
42
|
+
" for p in audio_folder.glob(\"*.wav\")\n",
|
|
43
|
+
"]"
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"cell_type": "markdown",
|
|
48
|
+
"id": "a3e00607af01f18f",
|
|
49
|
+
"metadata": {},
|
|
50
|
+
"source": [
|
|
51
|
+
"Create the `AudioData` you want to plot a spectrogram of from the `AudioFile`s.\n",
|
|
52
|
+
"The `AudioData` can be freely distributed over multiple files, and you can even resample it.\n",
|
|
53
|
+
"\n",
|
|
54
|
+
"An `Instrument` can be provided to the `AudioData` for the WAV data to be converted in pressure units. This will lead the resulting spectra to be expressed in dB SPL (rather than in dB FS):"
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"cell_type": "code",
|
|
59
|
+
"execution_count": null,
|
|
60
|
+
"id": "8df490fff812332",
|
|
61
|
+
"metadata": {},
|
|
62
|
+
"outputs": [],
|
|
63
|
+
"source": [
|
|
64
|
+
"from osekit.core.audio_data import AudioData\n",
|
|
65
|
+
"from osekit.core.instrument import Instrument\n",
|
|
66
|
+
"from osekit.utils.audio import Normalization\n",
|
|
67
|
+
"from pandas import Timestamp\n",
|
|
68
|
+
"\n",
|
|
69
|
+
"audio_data = AudioData.from_files(\n",
|
|
70
|
+
" audio_files,\n",
|
|
71
|
+
" begin=Timestamp(\"2022-09-25 22:34:55\"),\n",
|
|
72
|
+
" end=Timestamp(\"2022-09-25 22:35:05\"),\n",
|
|
73
|
+
" sample_rate=40000,\n",
|
|
74
|
+
" normalization=Normalization.DC_REJECT, # Rejects the DC component\n",
|
|
75
|
+
" instrument=Instrument(end_to_end_db=150.0),\n",
|
|
76
|
+
")"
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"cell_type": "markdown",
|
|
81
|
+
"id": "e0da828bafcfce55",
|
|
82
|
+
"metadata": {},
|
|
83
|
+
"source": "Create a `scipy.signal.ShortTimeFFT` with the FFT parameters:"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"cell_type": "code",
|
|
87
|
+
"execution_count": null,
|
|
88
|
+
"id": "63edf1d81811bf4b",
|
|
89
|
+
"metadata": {},
|
|
90
|
+
"outputs": [],
|
|
91
|
+
"source": [
|
|
92
|
+
"from scipy.signal import ShortTimeFFT\n",
|
|
93
|
+
"from scipy.signal.windows import hamming\n",
|
|
94
|
+
"\n",
|
|
95
|
+
"sft = ShortTimeFFT(win=hamming(1024), hop=512, fs=audio_data.sample_rate)"
|
|
96
|
+
]
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"cell_type": "markdown",
|
|
100
|
+
"id": "8ae4db7363a92148",
|
|
101
|
+
"metadata": {},
|
|
102
|
+
"source": "Instantiate an **OSEkit** `SpectroData`, which is the object that will be used to plot spectrograms, export spectrum matrices etc."
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"cell_type": "code",
|
|
106
|
+
"execution_count": null,
|
|
107
|
+
"id": "8c672c04078d395e",
|
|
108
|
+
"metadata": {},
|
|
109
|
+
"outputs": [],
|
|
110
|
+
"source": [
|
|
111
|
+
"from osekit.core.spectro_data import SpectroData\n",
|
|
112
|
+
"\n",
|
|
113
|
+
"spectro_data = SpectroData.from_audio_data(\n",
|
|
114
|
+
" data=audio_data,\n",
|
|
115
|
+
" fft=sft,\n",
|
|
116
|
+
" v_lim=(0.0, 150.0), # Boundaries of the spectrogram\n",
|
|
117
|
+
" colormap=\"viridis\", # This is the default value\n",
|
|
118
|
+
")"
|
|
119
|
+
]
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"cell_type": "markdown",
|
|
123
|
+
"id": "d5d28a92c4002bfb",
|
|
124
|
+
"metadata": {},
|
|
125
|
+
"source": "Plot the spectrogram using `matplotlib.pyplot`:"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"cell_type": "code",
|
|
129
|
+
"execution_count": null,
|
|
130
|
+
"id": "9b3faf84f6e45cf2",
|
|
131
|
+
"metadata": {},
|
|
132
|
+
"outputs": [],
|
|
133
|
+
"source": [
|
|
134
|
+
"import matplotlib.pyplot as plt\n",
|
|
135
|
+
"\n",
|
|
136
|
+
"# We store the spectrum matrix here to reuse it later in the notebook, this is not mandatory\n",
|
|
137
|
+
"sx = spectro_data.get_value()\n",
|
|
138
|
+
"\n",
|
|
139
|
+
"spectro_data.plot(sx=sx)\n",
|
|
140
|
+
"plt.show()"
|
|
141
|
+
]
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"cell_type": "markdown",
|
|
145
|
+
"id": "7980f388863736b9",
|
|
146
|
+
"metadata": {},
|
|
147
|
+
"source": "The spectrogram might be plotted next to the audio waveform:"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"cell_type": "code",
|
|
151
|
+
"execution_count": null,
|
|
152
|
+
"id": "cb00ba6ff1948fc2",
|
|
153
|
+
"metadata": {},
|
|
154
|
+
"outputs": [],
|
|
155
|
+
"source": [
|
|
156
|
+
"fig, axs = plt.subplots(2, 1)\n",
|
|
157
|
+
"\n",
|
|
158
|
+
"# Plotting the waveform in the top row:\n",
|
|
159
|
+
"spectro_data.audio_data.plot(ax=axs[0])\n",
|
|
160
|
+
"\n",
|
|
161
|
+
"# Plotting the spectrogram in the bottom row:\n",
|
|
162
|
+
"spectro_data.plot(ax=axs[1], sx=sx)\n",
|
|
163
|
+
"\n",
|
|
164
|
+
"# Setting the figure properties\n",
|
|
165
|
+
"import matplotlib.dates as mdates\n",
|
|
166
|
+
"\n",
|
|
167
|
+
"axs[0].set_xlim(spectro_data.begin, spectro_data.end)\n",
|
|
168
|
+
"axs[0].set_xticks([])\n",
|
|
169
|
+
"axs[0].set_ylabel(\"Amplitude\")\n",
|
|
170
|
+
"\n",
|
|
171
|
+
"axs[1].set_ylabel(\"Frequency (Hz)\")\n",
|
|
172
|
+
"axs[1].set_xlabel(\"Time (%M:%S)\")\n",
|
|
173
|
+
"axs[1].xaxis.set_major_formatter(mdates.DateFormatter(\"%M:%S\"))\n",
|
|
174
|
+
"\n",
|
|
175
|
+
"fig.subplots_adjust(hspace=0.05)\n",
|
|
176
|
+
"\n",
|
|
177
|
+
"\n",
|
|
178
|
+
"plt.show()"
|
|
179
|
+
]
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"cell_type": "markdown",
|
|
183
|
+
"id": "93eae4edd8bb8bb5",
|
|
184
|
+
"metadata": {},
|
|
185
|
+
"source": "You can export both the PNG spectrogram and the NPZ spectrum matrix to file:"
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"cell_type": "code",
|
|
189
|
+
"execution_count": null,
|
|
190
|
+
"id": "ddc9e9c82bca1c41",
|
|
191
|
+
"metadata": {
|
|
192
|
+
"tags": [
|
|
193
|
+
"skip-execution"
|
|
194
|
+
]
|
|
195
|
+
},
|
|
196
|
+
"outputs": [],
|
|
197
|
+
"source": [
|
|
198
|
+
"# Write a NPZ file with the spectrum matrix:\n",
|
|
199
|
+
"spectro_data.write(folder=audio_folder / \"export\", sx=sx)\n",
|
|
200
|
+
"\n",
|
|
201
|
+
"# Write a PNG image of the spectrogram\n",
|
|
202
|
+
"spectro_data.save_spectrogram(folder=audio_folder / \"export\", sx=sx)"
|
|
203
|
+
]
|
|
204
|
+
}
|
|
205
|
+
],
|
|
206
|
+
"metadata": {
|
|
207
|
+
"kernelspec": {
|
|
208
|
+
"display_name": "Python 3",
|
|
209
|
+
"language": "python",
|
|
210
|
+
"name": "python3"
|
|
211
|
+
},
|
|
212
|
+
"language_info": {
|
|
213
|
+
"codemirror_mode": {
|
|
214
|
+
"name": "ipython",
|
|
215
|
+
"version": 2
|
|
216
|
+
},
|
|
217
|
+
"file_extension": ".py",
|
|
218
|
+
"mimetype": "text/x-python",
|
|
219
|
+
"name": "python",
|
|
220
|
+
"nbconvert_exporter": "python",
|
|
221
|
+
"pygments_lexer": "ipython2",
|
|
222
|
+
"version": "2.7.6"
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
"nbformat": 4,
|
|
226
|
+
"nbformat_minor": 5
|
|
227
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "osekit"
|
|
3
|
-
version = "1.0.
|
|
3
|
+
version = "1.0.3"
|
|
4
4
|
description = "OSEkit"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "MIT"
|
|
@@ -70,6 +70,9 @@ lint.select = ["ALL"]
|
|
|
70
70
|
"docs/source/*.ipynb" = [
|
|
71
71
|
"E402", # Module level import not at top of cell in doc notebooks
|
|
72
72
|
]
|
|
73
|
+
"*" = [
|
|
74
|
+
"ANN401" # typing.Any type hint for *args and **kwargs
|
|
75
|
+
]
|
|
73
76
|
|
|
74
77
|
|
|
75
78
|
[tool.pytest.ini_options]
|
|
@@ -11,8 +11,10 @@ from math import ceil
|
|
|
11
11
|
from typing import TYPE_CHECKING, Self
|
|
12
12
|
|
|
13
13
|
import numpy as np
|
|
14
|
+
import pandas as pd
|
|
14
15
|
import soundfile as sf
|
|
15
16
|
import soxr
|
|
17
|
+
from matplotlib import pyplot as plt
|
|
16
18
|
from pandas import Timedelta, Timestamp
|
|
17
19
|
|
|
18
20
|
from osekit.config import resample_quality_settings
|
|
@@ -20,7 +22,8 @@ from osekit.core.audio_file import AudioFile
|
|
|
20
22
|
from osekit.core.audio_item import AudioItem
|
|
21
23
|
from osekit.core.base_data import BaseData
|
|
22
24
|
from osekit.core.instrument import Instrument
|
|
23
|
-
from osekit.utils.audio import Normalization, normalize
|
|
25
|
+
from osekit.utils.audio import Butterworth, Normalization, normalize
|
|
26
|
+
from osekit.utils.plot import get_default_axes
|
|
24
27
|
|
|
25
28
|
if TYPE_CHECKING:
|
|
26
29
|
from pathlib import Path
|
|
@@ -45,6 +48,7 @@ class AudioData(BaseData[AudioItem, AudioFile]):
|
|
|
45
48
|
instrument: Instrument | None = None,
|
|
46
49
|
normalization: Normalization = Normalization.RAW,
|
|
47
50
|
normalization_values: dict | None = None,
|
|
51
|
+
butter: Butterworth | None = None,
|
|
48
52
|
) -> None:
|
|
49
53
|
"""Initialize an ``AudioData`` from a list of ``AudioItems``.
|
|
50
54
|
|
|
@@ -67,6 +71,8 @@ class AudioData(BaseData[AudioItem, AudioFile]):
|
|
|
67
71
|
the wav audio data.
|
|
68
72
|
normalization: Normalization
|
|
69
73
|
The type of normalization to apply to the audio data.
|
|
74
|
+
butter: Butterworth | None
|
|
75
|
+
Butterworth filter to apply to the audio data.
|
|
70
76
|
|
|
71
77
|
"""
|
|
72
78
|
super().__init__(items=items, begin=begin, end=end, name=name)
|
|
@@ -74,6 +80,7 @@ class AudioData(BaseData[AudioItem, AudioFile]):
|
|
|
74
80
|
self.instrument = instrument
|
|
75
81
|
self.normalization = normalization
|
|
76
82
|
self.normalization_values = normalization_values
|
|
83
|
+
self.butter = butter
|
|
77
84
|
|
|
78
85
|
@property
|
|
79
86
|
def nb_channels(self) -> int:
|
|
@@ -123,6 +130,15 @@ class AudioData(BaseData[AudioItem, AudioFile]):
|
|
|
123
130
|
}
|
|
124
131
|
)
|
|
125
132
|
|
|
133
|
+
@property
|
|
134
|
+
def butter(self) -> Butterworth:
|
|
135
|
+
"""The Butterworth filter to apply to the audio data."""
|
|
136
|
+
return self._butter
|
|
137
|
+
|
|
138
|
+
@butter.setter
|
|
139
|
+
def butter(self, value: Butterworth) -> None:
|
|
140
|
+
self._butter = value
|
|
141
|
+
|
|
126
142
|
@classmethod
|
|
127
143
|
def _make_item(
|
|
128
144
|
cls,
|
|
@@ -178,7 +194,7 @@ class AudioData(BaseData[AudioItem, AudioFile]):
|
|
|
178
194
|
"std": standard deviation used for z-score normalization
|
|
179
195
|
|
|
180
196
|
"""
|
|
181
|
-
values = np.array(self.
|
|
197
|
+
values = np.array(self.get_filtered_value())
|
|
182
198
|
self.normalization_values = {
|
|
183
199
|
"mean": values.mean(),
|
|
184
200
|
"peak": values.max(),
|
|
@@ -222,6 +238,22 @@ class AudioData(BaseData[AudioItem, AudioFile]):
|
|
|
222
238
|
"""
|
|
223
239
|
return np.vstack(list(self.stream()))
|
|
224
240
|
|
|
241
|
+
def get_filtered_value(self) -> np.ndarray:
|
|
242
|
+
"""Return the value of the audio data after filtering.
|
|
243
|
+
|
|
244
|
+
Returns
|
|
245
|
+
-------
|
|
246
|
+
np.ndarray:
|
|
247
|
+
The value of the audio data filtered by the ``self.butter`` Butterworth filter.
|
|
248
|
+
|
|
249
|
+
"""
|
|
250
|
+
output = self.get_raw_value()
|
|
251
|
+
return (
|
|
252
|
+
output
|
|
253
|
+
if self.butter is None
|
|
254
|
+
else self.butter.filter(sig=output, fs=self.sample_rate)
|
|
255
|
+
)
|
|
256
|
+
|
|
225
257
|
@staticmethod
|
|
226
258
|
def _flush(
|
|
227
259
|
resampler: soxr.ResampleStream,
|
|
@@ -320,7 +352,7 @@ class AudioData(BaseData[AudioItem, AudioFile]):
|
|
|
320
352
|
|
|
321
353
|
"""
|
|
322
354
|
return normalize(
|
|
323
|
-
values=self.
|
|
355
|
+
values=self.get_filtered_value(),
|
|
324
356
|
normalization=self.normalization,
|
|
325
357
|
**self.normalization_values,
|
|
326
358
|
)
|
|
@@ -343,6 +375,34 @@ class AudioData(BaseData[AudioItem, AudioFile]):
|
|
|
343
375
|
)
|
|
344
376
|
return raw_data * calibration_factor
|
|
345
377
|
|
|
378
|
+
def plot(
|
|
379
|
+
self,
|
|
380
|
+
ax: plt.Axes | None = None,
|
|
381
|
+
values: np.ndarray | None = None,
|
|
382
|
+
**kwargs, # noqa: ANN003
|
|
383
|
+
) -> None:
|
|
384
|
+
"""Plot the waveform on a specific ``Axes``.
|
|
385
|
+
|
|
386
|
+
Parameters
|
|
387
|
+
----------
|
|
388
|
+
ax: plt.axes | None
|
|
389
|
+
``Axes`` on which the waveform should be plotted.
|
|
390
|
+
Defaulted to ``osekit.utils.plot.get_default_axes()``.
|
|
391
|
+
values: np.ndarray | None
|
|
392
|
+
Values of the audio data. Will be fetched if ``None``.
|
|
393
|
+
kwargs
|
|
394
|
+
Keyword arguments that are passed
|
|
395
|
+
to the ``matplotlib.axes._axes.Axes.plot()`` method.
|
|
396
|
+
|
|
397
|
+
"""
|
|
398
|
+
ax = ax if ax is not None else get_default_axes()
|
|
399
|
+
values = self.get_value() if values is None else values
|
|
400
|
+
|
|
401
|
+
time = pd.date_range(start=self.begin, end=self.end, periods=values.shape[0])
|
|
402
|
+
|
|
403
|
+
ax.xaxis_date()
|
|
404
|
+
ax.plot(time, values, **kwargs)
|
|
405
|
+
|
|
346
406
|
def write(
|
|
347
407
|
self,
|
|
348
408
|
folder: Path,
|
|
@@ -547,9 +607,13 @@ class AudioData(BaseData[AudioItem, AudioFile]):
|
|
|
547
607
|
None if self.instrument is None else self.instrument.to_dict()
|
|
548
608
|
),
|
|
549
609
|
}
|
|
610
|
+
butter_dict = {
|
|
611
|
+
"butter": (None if self.butter is None else self.butter.to_dict()),
|
|
612
|
+
}
|
|
550
613
|
return (
|
|
551
614
|
base_dict
|
|
552
615
|
| instrument_dict
|
|
616
|
+
| butter_dict
|
|
553
617
|
| {
|
|
554
618
|
"sample_rate": self.sample_rate,
|
|
555
619
|
"normalization": self.normalization.value,
|
|
@@ -595,6 +659,11 @@ class AudioData(BaseData[AudioItem, AudioFile]):
|
|
|
595
659
|
if dictionary["instrument"] is None
|
|
596
660
|
else Instrument.from_dict(dictionary["instrument"])
|
|
597
661
|
)
|
|
662
|
+
butter = (
|
|
663
|
+
None
|
|
664
|
+
if "butter" not in dictionary or dictionary["butter"] is None
|
|
665
|
+
else Butterworth.from_dict(dictionary["butter"])
|
|
666
|
+
)
|
|
598
667
|
return cls.from_files(
|
|
599
668
|
files=files,
|
|
600
669
|
begin=begin,
|
|
@@ -603,6 +672,7 @@ class AudioData(BaseData[AudioItem, AudioFile]):
|
|
|
603
672
|
sample_rate=dictionary["sample_rate"],
|
|
604
673
|
normalization=Normalization(dictionary["normalization"]),
|
|
605
674
|
normalization_values=dictionary["normalization_values"],
|
|
675
|
+
butter=butter,
|
|
606
676
|
)
|
|
607
677
|
|
|
608
678
|
@classmethod
|
|
@@ -641,6 +711,9 @@ class AudioData(BaseData[AudioItem, AudioFile]):
|
|
|
641
711
|
normalization: Normalization
|
|
642
712
|
The type of normalization to apply to the audio data.
|
|
643
713
|
|
|
714
|
+
butter: Butterworth
|
|
715
|
+
Butterworth filter to apply to the audio data.
|
|
716
|
+
|
|
644
717
|
Returns
|
|
645
718
|
-------
|
|
646
719
|
Self:
|