Skip to main content

Add your description here

Project description

DynamicSound

DOI Static Badge GitHub Release GitHub License GitHub forks PyPI - Version PyPI - Downloads

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

dynamic_sound-1.0.2.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dynamic_sound-1.0.2-py3-none-any.whl (20.3 kB view details)

Uploaded Python 3

File details

Details for the file dynamic_sound-1.0.2.tar.gz.

File metadata

  • Download URL: dynamic_sound-1.0.2.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.16

File hashes

Hashes for dynamic_sound-1.0.2.tar.gz
Algorithm Hash digest
SHA256 fbddadfc019ecb7cb37d1af5a713a98ec4a2d670b6ce5abadffd80c2adc62b44
MD5 922838a828cd4ae9035e65ffc531b697
BLAKE2b-256 64e9b2e735a54af5f7f987842ef8a42714eab4c15ddedb8165e6082500bef861

See more details on using hashes here.

File details

Details for the file dynamic_sound-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for dynamic_sound-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 87cae89077932acb25436b53f68e7615ef2232ce3bf7a3cf77d6bb6e51af725c
MD5 8f55be114ed49e4e90474b5b37d57a13
BLAKE2b-256 c11a78c2872926f0acb23d3a2a0fae1ae1c4a221b1f01d5a3fcd4e80531bf78e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page