Diffraction Enhanced Image Source Method - Arbitrary Room Geometry (DEISM-ARG)
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:
- Arbitrary directivities of the source and receiver
- Angle-dependent reflection coefficients, frequency- and wall-dependent impedance definition.
- Convex room shapes
📚 Documentation
📖 Read the full documentation on Read the Docs
Installation
DEISM supports Python 3.10, 3.11, and 3.12 on Windows, Linux, and Apple
Silicon macOS. Intel macOS is not supported, because the numba dependency no
longer builds there.
The current documentation is organized around the class-based workflow
implemented by deism.core_deism.DEISM.
Useful entry points:
Check Python version
On macOS or Linux:
python3 --version
On Windows PowerShell:
python --version
If you do not have a supported Python version, install one from python.org.
Installation method 1: Python virtual environment
End users
On macOS or Linux:
python3 -m venv ~/.venv/deism
source ~/.venv/deism/bin/activate
python -m pip install --upgrade pip
python -m pip install deism
On Windows PowerShell:
python -m venv C:\Users\<YourUsername>\venvs\deism
C:\Users\<YourUsername>\venvs\deism\Scripts\Activate.ps1
python -m pip install --upgrade pip
python -m pip install deism
If PowerShell blocks activation, run:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Developers
On macOS or Linux:
git clone https://github.com/audiolabs/DEISM.git
cd DEISM
python3 -m venv ~/.venv/deism_dev
source ~/.venv/deism_dev/bin/activate
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
python -m pip install -e .
On Windows PowerShell:
git clone https://github.com/audiolabs/DEISM.git
cd DEISM
python -m venv C:\Users\<YourUsername>\venvs\deism_dev
C:\Users\<YourUsername>\venvs\deism_dev\Scripts\Activate.ps1
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
python -m pip install -e .
Installation method 2: Conda environment
End users
conda create -n deism python=3.12
conda activate deism
python -m pip install --upgrade pip
python -m pip install deism
Developers
git clone https://github.com/audiolabs/DEISM.git
cd DEISM
conda env create -f deism_env.yml
conda activate DEISM
python -m pip install -e .
Build tools for source installs
Published wheels include DEISM's two C++ extensions. Building from a source checkout or source distribution requires a working C++ compiler.
macOS:
xcode-select --install
Ubuntu or Debian:
sudo apt-get update
sudo apt-get install build-essential g++ python3-dev
RHEL, CentOS, or Fedora:
sudo yum install gcc-c++ python3-devel
Windows:
- Install Visual Studio Build Tools with the C++ workload.
Verify the installation
Basic import check:
python -c "import deism; print('DEISM import OK')"
Native-extension check:
python -c "from deism import libroom_deism; from deism.count_reflections_wrapper import CPP_COUNTING_AVAILABLE; assert libroom_deism and CPP_COUNTING_AVAILABLE"
Quick help check:
python examples/deism_singleparam_example.py --help
Quick smoke run:
python examples/deism_singleparam_example.py
Additional notes
- Some plotting utilities use
matplotlibwithtext.usetex = True, so a LaTeX installation may be needed for figure rendering. See the Matplotlib usetex documentation. - Most example outputs are written below
outputs/.
Running DEISM
The current public workflow is class-based:
from deism.core_deism import DEISM
deism = DEISM("RIR", "shoebox")
deism.update_room()
deism.update_wall_materials()
deism.update_freqs()
deism.update_directivities()
deism.update_source_receiver()
deism.run_DEISM()
Default configuration files
DEISM selects its default YAML configuration from the pair (mode, roomtype):
| Mode | Room type | Default config file |
|---|---|---|
RTF |
shoebox |
examples/configSingleParam_RTF.yml |
RIR |
shoebox |
examples/configSingleParam_RIR.yml |
RTF |
convex |
examples/configSingleParam_ARG_RTF.yml |
RIR |
convex |
examples/configSingleParam_ARG_RIR.yml |
These files are also bundled with installed wheels and source distributions. Repository-local files retain precedence, while an installed package falls back to its bundled defaults when invoked from another working directory.
Workflow order
Shoebox workflow:
update_room()update_wall_materials()update_freqs()update_directivities()andupdate_source_receiver()in either orderrun_DEISM()
Convex workflow:
update_room()update_wall_materials()update_freqs()update_source_receiver()update_directivities()run_DEISM()
The convex order is stricter because ARG directivity setup depends on
reflection-path state computed during update_source_receiver().
Recommended starting examples
Beginner examples:
examples/deism_singleparam_example.pyfor the current shoebox pathexamples/deism_arg_singleparam_example.pyfor the current convex path
Advanced or research-oriented examples:
examples/deisms_lc_mix_test.pyexamples/shoebox_images_cal_compare.pyexamples/deism_args_compare.pyexamples/deism_arg_pra_compare.pyexamples/deism_arg_IWAENC_fig5_fig6.pyexamples/deism_JASA_fig8.pyexamples/deism_JASA_fig9.py
For more detail, use the docs pages linked above instead of relying only on the older example scripts.
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:
- Frequencies at which the directivities are simulated or measured. A 1D array.
- 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).
- The sampled pressure field at the specified directions and frequencies. A 2D array with size (number of frequencies, number of directions).
- 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
- Anjana Rajasekhar
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.
Configuration files
The current default configuration files are:
examples/configSingleParam_RTF.ymlfor shoeboxRTFexamples/configSingleParam_RIR.ymlfor shoeboxRIRexamples/configSingleParam_ARG_RTF.ymlfor convexRTFexamples/configSingleParam_ARG_RIR.ymlfor convexRIR
See docs/configuration.rst for the configuration groups and runtime parameter mappings.
Compact image storage
Image generation and reflection attenuation are decoupled by default in both
room types ("compact" mode): the image-source engine emits frequency-
independent path geometry, and the frequency-dependent attenuation is rebuilt
from it by a parallel numba kernel. This makes image generation independent of
the number of frequencies and avoids holding the full
(n_images, n_frequencies) attenuation array.
Each room type has its own flag, because the two paths were implemented separately and rebuild attenuation at different points:
| Room type | Flag | Default | Attenuation rebuilt |
|---|---|---|---|
| Convex (DEISM-ARG) | convexCompactImages |
1 (compact) |
Once, in get_ref_paths_ARG |
| Shoebox | shoeboxCompactImages |
1 (compact) |
Per batch, inside the solver |
Set either flag to 0 for the legacy materialized path. Neither flag is read
from the YAML configuration files or the command line — both are set
programmatically, e.g. deism.params["convexCompactImages"] = 0.
Shoebox rooms
Compact shoebox storage is produced only by the numba image generator
(shoeboxImageCalcVersion="v2-numba", the default). Selecting a serial
generator degrades to materialized storage rather than failing. Two further
consequences:
images["atten_all"](and theatten_all_early/atten_all_latepair) is absent in compact mode. Code that reads those arrays directly must setshoeboxCompactImages=0.- The legacy Ray backend cannot consume compact storage and raises
NotImplementedError. Use the numba backend (run_DEISM), which is the faster and supported path.
RTFs agree with materialized storage to ~1e-8 relative error for ORG, LC,
and MIX, with real and complex impedance alike.
Convex rooms (DEISM-ARG)
For convex rooms the compact geometry is the wall sequence and incidence cosine per image.
Configuration (in the parameter dictionary / config):
convexCompactImages(default1):0selects the legacy path.convexCompactEngine(default"cpp"): which engine produces the compact geometry when compact mode is on —"cpp"(the libroom C++ extension) or"python"(Room_deism_python, the reference producer). The C++ engine is the default because it is faster at every band count measured and matches the Python producer exactly on wall sequences, to 1e-4 on incidence cosines and to 1e-5 end to end; select"python"when the extension cannot be built. Rebuild the extension after updating the sources:python setup.py build_ext --inplace.
Neither flag is read from the YAML configuration files or the command line —
both are set programmatically on the parameter dictionary, e.g.
deism.params["convexCompactImages"] = 0 to select the legacy path.
convexCompactEngine is ignored in legacy mode (convexCompactImages=0),
which keeps the original C++ behavior with per-frequency attenuation computed
in libroom.
Notes:
- Compact mode supports exactly one receiver per run (the standard DEISM-ARG setup). Multiple receivers raise an error.
- This DEISM-ARG compact path is 3D-only and applies to convex rooms. Shoebox
rooms have their own compact storage, described above, selected with
shoeboxCompactImages. - Complex impedance is handled exactly in compact mode (the attenuation is
rebuilt by
_build_arg_attenuation_batch); the legacy C++ path truncates complex impedance to its real part — a known parity gap of order 1e-2. - Compatible with the
ORG,LC, andMIXDEISM variants and withifRemoveDirectPath; output shapes are unchanged relative to legacy mode. - Cross-engine agreement is implementation parity, not acoustic validation: the known DEISM-ARG limitations for arbitrary geometries (reflection- boundary discontinuities, missing spherical-wave reflection effects, edge/ corner diffraction) apply to all backends equally.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
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 deism-2.2.1.15.tar.gz.
File metadata
- Download URL: deism-2.2.1.15.tar.gz
- Upload date:
- Size: 992.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d02f7bb50898b995f6f271649f9d538ce036f6b1577841b5d33dd064abb741d
|
|
| MD5 |
f97b704a08e583548b954f00f3a0a1b5
|
|
| BLAKE2b-256 |
0e2f5061cad89b8e927f990912574c22e28d551d4ed6cf2fe9e8090e6f703e75
|
File details
Details for the file deism-2.2.1.15-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: deism-2.2.1.15-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 520.3 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5fc13a37ad63cf944655a6475c54d8f49526fdb43d09d02021efcebce049cf63
|
|
| MD5 |
300bd0e8c43a6d76a02b42e6a0a81486
|
|
| BLAKE2b-256 |
3ac56b9e61e553946e0ce17c930378ce40d7d6d767d843fb053b6597dbc5ba8b
|
File details
Details for the file deism-2.2.1.15-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: deism-2.2.1.15-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 16.7 MB
- Tags: CPython 3.12, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf9bd051afa6bfcfbe04d5edceafe0415653c4b1154a674372c1e466e7b137cc
|
|
| MD5 |
645d58a1770c4e2a7d825a5e2bbd2c54
|
|
| BLAKE2b-256 |
fa8d013cef46eb754e401fcd429c2a9ce8102084c90fcf607c404b23f5548941
|
File details
Details for the file deism-2.2.1.15-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: deism-2.2.1.15-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 618.4 kB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
214c8055fb8d8004d94e03539e32a5a03088de3d213f5580a5442de3c13f8169
|
|
| MD5 |
273610bae0e283b27e0ce40be8fcad96
|
|
| BLAKE2b-256 |
10a56560c094790f388af30d471dc2d77905581c408f13e53c366e653a1a98f2
|
File details
Details for the file deism-2.2.1.15-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: deism-2.2.1.15-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 516.0 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
388d17c7b0cc749681ede7f5d4632a5a65bc60dcc03eed9d8f28a0378ed4cbde
|
|
| MD5 |
c543c49463e04dd476ff4b1a506d2800
|
|
| BLAKE2b-256 |
93542038c7bd2b5ea11c87456f68838ede1c12793556365b928d6299904e2a02
|
File details
Details for the file deism-2.2.1.15-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: deism-2.2.1.15-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 16.6 MB
- Tags: CPython 3.11, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
46ce9bffcddbd521ab4a88943faac530d313c9fc261cfda97d94bd46ff4facd5
|
|
| MD5 |
0bd6f55fe55df2e3d80ca81b8855e716
|
|
| BLAKE2b-256 |
a596cea7334ed7ea0dd01df8b3fe2164f384aa031b5012e4aaeddd5007b255bc
|
File details
Details for the file deism-2.2.1.15-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: deism-2.2.1.15-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 613.7 kB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4095b89f10a6088a9ee95b32d9026bc7123409ddfd32f8a82157afffb86a3f5d
|
|
| MD5 |
31930f9b0116d035b7e99792ab2eb0c6
|
|
| BLAKE2b-256 |
e44e9842252bdf907f0993be1d86e49806ceb6ff9ff3d8f29afb2a03f47602ed
|
File details
Details for the file deism-2.2.1.15-cp310-cp310-win_amd64.whl.
File metadata
- Download URL: deism-2.2.1.15-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 514.3 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e7e88ecf98fb43a30cca0c9817bd55886dea90bf77e96169a938600e4bc613b
|
|
| MD5 |
8adc5caffc7bcbd0f4bf4f6aa6fd16e1
|
|
| BLAKE2b-256 |
8c6a74e3db1f7e3df5b33d31484f52771fd0a7f4653b5d259cb33931551804c9
|
File details
Details for the file deism-2.2.1.15-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: deism-2.2.1.15-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 16.5 MB
- Tags: CPython 3.10, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56047dc8cc1ef0a374b99e3e39b8b80489399fcfa99b4433a69fd91dfd7c17a8
|
|
| MD5 |
5b6dcd7502e160d90b6241185f23796a
|
|
| BLAKE2b-256 |
735d6e4cab888ba124b5c780aa0b2cb3db33a8f9d19f66d0481c84b78070b0ea
|
File details
Details for the file deism-2.2.1.15-cp310-cp310-macosx_11_0_arm64.whl.
File metadata
- Download URL: deism-2.2.1.15-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 610.9 kB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02f879c8ecdd59237bb5878ad1015393887ccb3d6a21dcc25b11e35981557ab3
|
|
| MD5 |
dc18f768588516a301d059e33c5c6aed
|
|
| BLAKE2b-256 |
94dc923db8a7707fcc1713cf5e3743ddf9d97dd85b52cd7e7d5e081d7ba220df
|