Add your description here
Project description
DynamicSound is a modular Python library designed for generating virtual acoustic scenes with customizable microphone configurations, sound sources, and environmental conditions. It is intended for research, algorithm development, and testing in areas such as beamforming, source localization, audio augmentation, and acoustic machine learning.
๐ Features
-
Flexible microphone models
- Single-channel microphones
- Microphone arrays with arbitrary geometry
- User-defined sampling rates
-
Configurable sound sources
- White noise generator
- Sinusoidal signal generator
- Audio file source
-
Environmental modeling
- Source and microphone trajectories, 3D positions and rotations
- Air absorption based on ISO 9613-1
- Temperature, pressure, and humidity parameters
-
Signal path simulation
- Distance-based attenuation
- Multiple sound sources simulation
- Scenarios with dynamic movement
๐ข Versioning
This library follows Semantic Versioning using the format M.m.p
Where:
- M โ Major version: incompatible API changes
- m โ Minor version: added functionality in a backward-compatible manner
- p โ Patch version: backward-compatible bug fixes
๐ฆ Installation
From PyPI
pip install dynamic-sound[==<version>]
example: pip install dynamic-sound=1.0.0
๐ฎ Usage Example
import dynamic_sound as ds
source_path = ds.Path([
# time / position(x,y,z) / quaternion(w,x,y,z)
[0.0, 343, 3, 1, 1, 0, 0, 0],
[10.0, -343, 3, 1, 1, 0, 0, 0]
])
microphone_path = ds.Path([
[0.0, 0, 0, 1, 1, 0, 0, 0],
[10.0, 0, 0, 1, 1, 0, 0, 0]
])
# simulation environment
sim = ds.Simulation(
temperature=20, # temperature [ยฐC]
pressure=1, # pressure [atm]
relative_humidity=50 # relative humidity [%]
)
# microphone
mic_sample_rate = 48_000 # Hertz [Hz]
microphone = ds.microphones.Microphone("_tmp/sine_dynamic.wav", sample_rate=mic_sample_rate)
sim.add_microphone(path=microphone_path, microphone=microphone)
# source
source = ds.sources.SineWave(frequency=2_000, amplitude=1.0)
sim.add_source(
path=source_path,
source=source
)
sim.run()
More examples available inside examples folder.
๐ค How to contribute
Contributions are welcome! Please open an issue or submit a merge request following Gitโs standard workflow.
Clone project
git clone <repository_name>
๐ Project structure
๐dynamic-sound
โโ๐docs\
โโ๐examples\
โ โโ๐resources/
โ | โโ๐paths/
| | | โโ๐*.csv
โ | โโ๐sounds/
| | โโ๐*.wav
| โโ๐*.ipynb
โโ๐src\
โ โโ๐dynamic_sound/
โ โโ๐acoustics/
โ | โโ๐standards/
โ | โโ๐__init__.py
โ | โโ๐ISO_9613_1_1993.py
โ โโ๐environment/
| | โโ๐__init__.py
| | โโ๐_*.py
โ โโ๐microphones/
| | โโ๐__init__.py
| | โโ๐_*.py
โ โโ๐sources/
| | โโ๐__init__.py
| | โโ๐_*.py
โ โโ๐__init__.py
โ โโ๐_simulation.py
โ โโ๐py.typed
โโ๐tests\
| โโ๐test_*.py
โโ๐.gitignore
โโ๐.gitlab-ci.yml
โโ๐LICENSE.txt
โโ๐pyproject.toml
โโ๐README.md
๐ ๏ธ Development Installation
Install uv
- windows
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
- Linux and MacOS
curl -LsSf https://astral.sh/uv/install.sh | sh
more details in the official uv documentation
Generate the Environment
uv sync
Open the examples with Jupyter Lab
- windows
.venv\Scripts\activate.bat
jupyter lab
- Linux and MacOS
source .venv/bin/activate
jupyter lab
Open one of the *.ipynb inside the examples folder and run it.
๐งช Running Tests
uv run pytest --cov=src --cov-report=term-missing --cov-fail-under=80 --capture=no
๐ Increment the version
uv version --bump patch
the options are major, minor, patch
๐ข Pubblish on PyPI
uv publish --token UV_PUBLISH_TOKEN
๐ License
This project is licensed under the Apache License 2.0. See the full license text in LICENSE.txt.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dynamic_sound-1.0.0.tar.gz.
File metadata
- Download URL: dynamic_sound-1.0.0.tar.gz
- Upload date:
- Size: 15.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e51b630c21c3317819d14744170d28dc366fb55829fd024ea40f8766326f5bf9
|
|
| MD5 |
19b7a8412711c53e0a2116eb823dd3ac
|
|
| BLAKE2b-256 |
d6c8dd2b49c14ea5ae3a834437eafe2799a06d650fb08d3720e4c5daf69ddbe8
|
File details
Details for the file dynamic_sound-1.0.0-py3-none-any.whl.
File metadata
- Download URL: dynamic_sound-1.0.0-py3-none-any.whl
- Upload date:
- Size: 20.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b250e8214f67f03b418f6265a8150df47ade25b4eb29aa1454c35eb332244703
|
|
| MD5 |
7c3d42f4ccfb6e0e960137ca2af35279
|
|
| BLAKE2b-256 |
5668374f7e15b65cb250aa611a83cddea55c713011125391094469008ba8cac4
|