/pysofamyroom

Room acoustic simulator with a SOFA file loader.

Primary LanguagePythonEuropean Union Public License 1.2EUPL-1.2

sofamyroom

This project proposes a fast, accurate, and flexible "shoebox" room acoustics simulator that supports both specular and diffuse reflections. The simulator extends the work released by Schimmel et al., called Roomsim, by adding the rendering of Binaural Room Impulse Responses (BRIR) using arbitrary Head Related Transfer Functions (HRTFs) stored with the AES Spatially Oriented Format for Acoustics (SOFA) file format. Moreover, SofaMyRoom can be launched directly from your console of choice.

The SOFA support is possible thanks to MySofa library (hereinafter referred as libmysofa) and it can export the results of the simulation to a WAVE file.

Thanks to the Virtual Acoustic Space Traveling (VAST) framework [1], we added the possibility to systematically generate labeled datasets to train and test machine learning algorithms.

📖 The full documentation is available here

📖 We are writing an article about sofamyroom and the pre-print is already available on arXiv.

Installing sofamyroom

This repository includes the binary files and, if in case of need, the CMake scripts allow a customized compilation. Only 64-bit platforms are supported. sofamyroom binaries are available for Windows 10, Ubuntu Linux 20.04 and MacOS Catalina.

Installation on Windows

No futher steps are required to run sofamyroom on Windows.

Installation on Ubuntu Linux

libmysofa requires the zlib library in order to work properly. To install it, open a terminal and enter the following command:

sudo apt-get install zlib1g

Installation on macOS

No further steps are required to run sofamyroom on macOS.

Usage

To use sofamyroom, type this command in a Command Prompt or a Terminal:

./sofamyroom setup.txt

setup.txt is the name of the text file containing all the sofamyroom setup parameters structure. A sample of it can be found in sampleroomsetup.txt.

Usage with MATLAB

A MEX-file for 64-bit MATLAB is available. To run it, type these commands in the Command Window:

setup = readsetup('sampleroomsetup.txt');
output = sofamyroom(setup);

Building SofaMyRoom

These instructions will guide you through the steps to build SofaMyRoom on your local machine. CMake is required.

Building on Windows

You can use CMake to generate a Visual Studio solution that can be used to build sofamyroom. Open a new Command Prompt window and type the following commands:

> cd build
> cmake ../src -G"Visual Studio 16 2019"

To know how to generate solutions for other versions of Visual Studio, type cmake --help.

Building on Ubuntu Linux

You can use CMake to generate a Makefile for sofamyroom. Open a new Terminal window and type the following commands:

cd build
cmake ../src -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=BUILD_TYPE
make

CMAKE_BUILD_TYPE can be Debug, Release or Unittest. If CMAKE_BUILD_TYPE is not set, the default build type is Release. Before building the project, the following libraries may be needed:

sudo apt-get install libfftw3-dev
sudo apt-get install zlib1g-dev
sudo apt-get install libcunit1-dev

Building on MacOS

You can use CMake to generate a XCode project. Open a new Terminal window and type the following commands:

cd sofamyroom/build
cmake ../src -G"XCode"

The cunit library may be required. You can install it with a package manager for MacOS, i.e. Homebrew.

Building with MATLAB

You can use MATLAB to generate a MEX-file. Type the following command in the Command Window:

cd src
make

You can build the MEX-file in Debug mode. Type the following command:

make debug

You can also build it in Unittest mode, to check the validity of sofamyroom functions. Type the following command:

make test

Known issues

  • When using the MEX library, MATLAB can crash since the memory allocation performed by libmysofa is not persistent.

License

sofamyroom is licensed under the EUPL-1.2.

Credits

References

[1] C. Gaultier, S. Kataria, and A. Deleforge. "VAST: The virtual acoustic space traveler dataset." International Conference on Latent Variable Analysis and Signal Separation. Springer, Cham, 2017.