Skip to main content

An image source-based method used to simulate room transfer functions for arbitrary room shapes.

Project description

Diffraction Enhanced Image Source Method - Arbitrary Room Geometry (DEISM-ARG)

DOI Documentation Status PyPI version

The code in this folder is able to solve the following problem:

A source and a receiver transducer with arbitrary directivity are mounted on one/two speakers; The local scattering and diffraction effects around the transducers result in complex directivity patterns. The directivity patterns can be obtained by analytical expressions, numerical simulations or measurements.

In DEISM-ARG, we can model the room transfer function between transducers mounted on one/two speakers using the image source method while incorporating the local diffraction effects around the transducers. The local diffraction effects are captured using spherical-harmonic directivity coefficients obtained on a sphere around the transducers. In addition to DEISM in shoebox rooms, DEISM-ARG can model more complex room shapes. However, for version 2.0, we now only supports convex shapes. In short, DEISM-ARG has the following features:

  1. Arbitrary directivities of the source and receiver
  2. Angle-dependent reflection coefficients, frequency- and wall-dependent impedance definition.
  3. Convex room shapes

image-20240812131054348

📚 Documentation

📖 Read the full documentation on Read the Docs

Preparation and installing

Build locally

  • In you encounter errors like "unrecognized arguments: deism_envs_exact.yml", please type the following commands manuelly in the command line.
  • Clone or download the repository to your local directory
  • Use the command conda env create -f deism_env.yml to create a Conda environment for the DEISM algorithms. If this does not work, try conda env create -f deism_env_exact.yml as the file deism_envs_exact.yml records the versions of all packages.
  • Activate the created environment by "conda activate DEISM"
  • Running pip install -e . will build the deism package including the c++ extensions locally. You can also modify the sources codes and check out the effects. In case you receiver errors like "ModuleNotFoundError: No module named 'pybind11" even after activated the conda environment, you can use python -m pip install -e . to try install again.
  • Run scripts in the examples folder.

Using pip to install remotely

  • Run pip install deism to install deism.

Additional heads up

  • You would need to an external LaTeX installation to render text properly when running the examples, since we enable plt.rcParams["text.usetex"] = True when plotting the simulated room transfer functions. Please refer to this page for more information Matplotlib usetex Documentation.

Running codes

Single set of parameters

The default parameters are defined in file configSingleParam.yml or configSingleParam_ARG.yml, depending on whether you want to run for shoebox rooms or more complicated room shapes. Take DEISM-ARG (configSingleParam_ARG.yml) as an example, there are two ways of running the codes:

  1. You can directly run deism_arg_singleparam_example.py in an IDE, which utilizes the parameters defined in configSingleParam_arg.yml.
  2. You can run deism_arg_singleparam_example.py from the command line after activating the conda environment. In addition, you can access help information quickly by python deism_arg_singleparam_example.py --help. You can then change the parameters based on the instructions from the help message, e.g., python deism_arg_singleparam_example.py -c 350 -zs 20 will change the parameter sound speed and the wall impedance. The new input value of the parameters then overrides the ones in file configSingleParam_arg.yml. After choosing the needed values, you can run the codes using, e.g., python deism_arg_singleparam_example.py -c 350 -zs 20 --run.
  3. You need to specify additionally the following parameters in the function init_parameters of deism_arg_singleparam_example.py:
    1. The vertices of the room
    2. If rotate the room w.r.t the origin. This can be useful if you want to have some comparisons with the rooms created using pyroomacoustics.
    3. The rotation angles of the room if it needs to be rotated.
  4. You can suppress all output information in the command line by adding flag "--quiet" or by setting the first parameters in the configuration.yml file SilentMode to 1.

Examples

DEISM-ARG

  • An example of running DEISM-ARG is examples/deism_arg_single_example.py
    • You can run this from IDEs or via the command line, as introduced in the previous section
  • An example of comparing different versions of DEISM-ARG is given in examples/deism_args_compare.py. A frequency- and wall-dependent impedance definition can also be applied for a convex room. The room transfer functions are compared among:
    • Original version (most computation-costly)
    • LC version (fastest)
    • Mix version (Trade-offs between Original and LC versions): Early reflections up to some changeable order (default is 2) are calculated using the original version and the higher orders are calculated using the LC version.
  • An example of comparing DEISM-ARG and pyroomacoustics is examples/deism_arg_pra_compare.py, Comparisons are done regarding if the following results are identical or mismatched only by a small deviation:
    • number of images
    • the positions of the images

DEISM for shoebox

We provide two examples for running the original DEISM for shoebox rooms

  • An example of running DEISM-shoebox is examples/deism_singleparam_example.py
    • You can either run this from IDEs or via the cmd
  • An example of comparing different DEISM versions are shown in examples/deisms_lc_mix_test.py. In this script, the following methods are compared
    • DEISM - original
    • DEISM - MIX (original + LC vectorized)
    • DEISM - LC vectorized
    • FEM as groundtruth (only for this specific parameter settings)

Tips

The example code only provides essential functionalities based on DEISM. For more complex scenarios, please contact the authors (zeyu.xu@audiolabs-erlangen.de) for support. In the following, a few important tips might be helpful for you:

  • If you want to simulate the scenario where both the source and receiver are positioned on the same speaker, you need to run DEISM for all reflection path except for the direct path.
  • It is recommended to set the distance at least 1m between the transducers and the walls.

Directivities

Modeling the directivities of the source and receiver in the room acoustics simulation is receiving increasing attention. The directivities of the source or receiver can include both the transducer directional properties and the local diffraction and scatterring effects caused by the enclosure where the transducers are mounted. Modern smart speakers are typical embodiments of such scenarios. Human heads are also a very common case.

Simple directivities

  • Monopole

Arbitrary directivities

Some key information should be provided if you want to include your own directivity data:

  1. Frequencies at which the directivities are simulated or measured. A 1D array.
  2. The spherical sampling directions around the transducer: azimuth from $0$ ( $+x$ direction) to $2 \pi$, inclination angle from $0$ ($+z$ direction) to $\pi$. A 2D array with size (number of directions, 2).
  3. The sampled pressure field at the specified directions and frequencies. A 2D array with size (number of frequencies, number of directions).
  4. The radius of the sampling sphere. A 1D array or float number.

For more information about directivity definition used in DEISM and DEISM-ARG, please refer to the following publication:

Zeyu Xu, Adrian Herzog, Alexander Lodermeyer, Emanuël A. P. Habets, Albert G. Prinn; Acoustic reciprocity in the spherical harmonic domain: A formulation for directional sources and receivers. JASA Express Lett. 1 December 2022; 2 (12): 124801. https://doi.org/10.1121/10.0016542

Contributors

  • M. Sc. Zeyu Xu
  • Songjiang Tan
  • M. Sc. Hasan Nazım Biçer
  • Dr. Albert Prinn
  • Prof. Dr. ir. Emanuël Habets

Academic publications

If you use this package in your research, please cite our paper:

Zeyu Xu, Adrian Herzog, Alexander Lodermeyer, Emanuël A. P. Habets, Albert G. Prinn; Simulating room transfer functions between transducers mounted on audio devices using a modified image source method. J. Acoust. Soc. Am. 1 January 2024; 155 (1): 343–357. https://doi.org/10.1121/10.0023935

Z. Xu, E.A.P. Habets and A.G. Prinn; Simulating sound fields in rooms with arbitrary geometries using the diffraction-enhanced image source method, Proc. of International Workshop on Acoustic Signal Enhancement (IWAENC), 2024.

Description of the codes and functions

configSingleParam_ARG.yml

In this file you define the default parameters for DEISM-ARG to run. Note that this file is different from the configSingleParam.yml on these parameters:

  • The dimensions are defined separately in the example script.
  • You also need to specify if you want to rotate the room, and the rotation angles as well.

configSingleParam.yml

In this file you define the default parameters for DEISM-shoebox to run.

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

deism-2.2.1.2.tar.gz (2.5 MB view details)

Uploaded Source

Built Distributions

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

deism-2.2.1.2-cp311-cp311-win_amd64.whl (3.5 MB view details)

Uploaded CPython 3.11Windows x86-64

deism-2.2.1.2-cp311-cp311-macosx_11_0_universal2.whl (3.6 MB view details)

Uploaded CPython 3.11macOS 11.0+ universal2 (ARM64, x86-64)

deism-2.2.1.2-cp311-cp311-macosx_10_9_universal2.whl (4.0 MB view details)

Uploaded CPython 3.11macOS 10.9+ universal2 (ARM64, x86-64)

deism-2.2.1.2-cp310-cp310-win_amd64.whl (3.5 MB view details)

Uploaded CPython 3.10Windows x86-64

deism-2.2.1.2-cp310-cp310-macosx_13_0_x86_64.whl (3.6 MB view details)

Uploaded CPython 3.10macOS 13.0+ x86-64

deism-2.2.1.2-cp310-cp310-macosx_11_0_universal2.whl (3.6 MB view details)

Uploaded CPython 3.10macOS 11.0+ universal2 (ARM64, x86-64)

deism-2.2.1.2-cp39-cp39-win_amd64.whl (3.5 MB view details)

Uploaded CPython 3.9Windows x86-64

deism-2.2.1.2-cp39-cp39-macosx_13_0_x86_64.whl (3.6 MB view details)

Uploaded CPython 3.9macOS 13.0+ x86-64

File details

Details for the file deism-2.2.1.2.tar.gz.

File metadata

  • Download URL: deism-2.2.1.2.tar.gz
  • Upload date:
  • Size: 2.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for deism-2.2.1.2.tar.gz
Algorithm Hash digest
SHA256 355240205562df7c7dcd79a97fcdddda06f6053f4b8b3aed666b13df315733eb
MD5 3aa7a885f894be44fe1bf66ab882b4c4
BLAKE2b-256 f25235fc9cf2374cb64dbd7f7b29a370411855fe6775e184d72289cb3704fa66

See more details on using hashes here.

Provenance

The following attestation bundles were made for deism-2.2.1.2.tar.gz:

Publisher: python-publish.yml on audiolabs/DEISM

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file deism-2.2.1.2-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: deism-2.2.1.2-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 3.5 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for deism-2.2.1.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 2d6822527b4a7333e732a5ff223f8687ac854eae71661f349267c23b38008445
MD5 9424cf9323af2f0aed6245598954db30
BLAKE2b-256 653406d23a8005c1042d1fb83b916ccc70553a089eedd38c5f366352ff72744b

See more details on using hashes here.

File details

Details for the file deism-2.2.1.2-cp311-cp311-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for deism-2.2.1.2-cp311-cp311-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 50ee7c54c91ad0c09c168c6de4203c2b70aa733ad045ab0408b5220865531e05
MD5 b7e7de9d3306fcd07d85edba5b778ba9
BLAKE2b-256 7debb4b2af9de716646b9b0cc05f2f9aaee87324b705a982a257fce9de6de6ba

See more details on using hashes here.

File details

Details for the file deism-2.2.1.2-cp311-cp311-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for deism-2.2.1.2-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 2321413d62ca08ccca58d4874d075298d803fe126fa1481b3a8564c3b9c0ba52
MD5 d5ffd8cbfd7f2844c80f2aa70b2aef21
BLAKE2b-256 6360540a253695d3dfe80e88913770fa51a171e24810d42ff5a0bb8ada0eae33

See more details on using hashes here.

File details

Details for the file deism-2.2.1.2-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: deism-2.2.1.2-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 3.5 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for deism-2.2.1.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 9ea4ad6a35e3e3379f62856c63457b0b4f0e7159476a15eb3ee714a5f114990a
MD5 6ef277540d59831f22b88385b0265d78
BLAKE2b-256 7c3b8f87cc5af3d1b6a82a5676d3a58b86473e4f0a2996038c120fc54821ca90

See more details on using hashes here.

File details

Details for the file deism-2.2.1.2-cp310-cp310-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for deism-2.2.1.2-cp310-cp310-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 d083e31de5b689bb75d1bd8ea57458f7af47e992cb9c34d012a9502479102ecd
MD5 bba55b7df18ff55c580f9ed80575ea80
BLAKE2b-256 b0304a413c1b435ade3ff0ef0f2b9ff3450022c19c6f9a65d4e81b80d18188b0

See more details on using hashes here.

File details

Details for the file deism-2.2.1.2-cp310-cp310-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for deism-2.2.1.2-cp310-cp310-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 0bf609a5a44757c01468a8a8a8d59449a328f18eb466d59e9cc1dae4b897a48d
MD5 df29911b5fb5475603a5895bbd99c43e
BLAKE2b-256 7b76ba596fdc63f8a59a99be5983fde3ead3e032f1fab3124566e651f52edc03

See more details on using hashes here.

File details

Details for the file deism-2.2.1.2-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: deism-2.2.1.2-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 3.5 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.13

File hashes

Hashes for deism-2.2.1.2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 bdb32ce00734c1d6716a2a09255dbf9246f7bd5cfd34462d7754428ee7fe705a
MD5 114fae9424fa43e11c544ff905989ffb
BLAKE2b-256 838ba67c0f98ca3c1960d1ddee60a7481c5e52af842c0cb3018d114c8e566469

See more details on using hashes here.

File details

Details for the file deism-2.2.1.2-cp39-cp39-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for deism-2.2.1.2-cp39-cp39-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 0595166d4451708c5b4d0a3eb00f7aee6c89eb43982121c3f50771ca93acff12
MD5 93f42fc7a346100e136a37310e833936
BLAKE2b-256 9b6f5a4827ab14d7de95586312de68561b36356d2e2610b4d91b56cc10208789

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