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
📖 Read the full documentation on Read the Docs
DEISM supports Python 3.9, 3.10, and 3.11 on Windows, macOS, and Linux.
The current documentation is organized around the class-based workflow
implemented by deism.core_deism.DEISM.
Useful entry points:
On macOS or Linux:
python3 --versionOn Windows PowerShell:
python --versionIf you do not have a supported Python version, install one from python.org.
On macOS or Linux:
python3 -m venv ~/.venv/deism
source ~/.venv/deism/bin/activate
python -m pip install --upgrade pip
python -m pip install deismOn 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 deismIf PowerShell blocks activation, run:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUserOn 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 .conda create -n deism python=3.9
conda activate deism
python -m pip install --upgrade pip
python -m pip install deismgit clone https://github.com/audiolabs/DEISM.git
cd DEISM
conda env create -f deism_env.yml
conda activate DEISM
python -m pip install -e .If deism_env.yml does not work on your machine, try:
conda env create -f deism_env_exact.yml
conda activate DEISM
python -m pip install -e .DEISM can build an optional C++ helper during installation. If a compiler is
missing, the package still runs, but the optional count_reflections helper
will not be available.
macOS:
xcode-select --installUbuntu or Debian:
sudo apt-get update
sudo apt-get install build-essential g++ python3-devRHEL, CentOS, or Fedora:
sudo yum install gcc-c++ python3-develWindows:
- Install MinGW-w64 and add it to
PATH, or - install Visual Studio Build Tools with the C++ workload.
Basic import check:
python -c "import deism; print('DEISM import OK')"Quick help check:
python examples/deism_singleparam_example.py --helpQuick smoke run:
python examples/deism_singleparam_example.py- 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/.
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()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 |
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().
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.
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.
- Monopole
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
- M. Sc. Zeyu Xu
- Songjiang Tan
- M. Sc. Hasan Nazım Biçer
- Dr. Albert Prinn
- Prof. Dr. ir. Emanuël Habets
- Anjana Rajasekhar
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.
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.
