Skip to main content

A room impulse response simulator using for geometric sound propagation

Project description

Copyright (C) 2010-2020 Carl Schissler, University of North Carolina at Chapel Hill. All rights reserved.

pygsound

GSound is a physically-based sound propagation package used for acoustic simulations in various environments, developed by Dr Carl Schissler. pygsound is the Python package that wraps GSound's codebase for efficiently computing room impulse responses (RIRs) with specular and diffuse reflections. GSound is powerful enough to be used for sound simulation in 3D scenes with complicated geometry and acoustic materials. This repo's python API has not exposed all of GSound's components. But we do provide the complete C++ source code and welcome pull requests if you made useful modifications (mainly the python API).

Dependencies

On Linux, install dependencies using:

sudo apt-get update
sudo apt-get -y install libfftw3-dev

On MacOS, install dependencies using:

brew update
brew install fftw

Installation

Install from PyPI

pip install pygsound

If you have difficulty installing from PyPI on incompatible platforms, or if you want the most up-to-date changes, continue reading to install from source.

Install from source

This repo has been configured to build with CMake (version>=12), and mainly tested on Linux and MacOS.

First clone this repo with:

git clone --recurse-submodules https://github.com/GAMMA-UMD/pygsound.git

We assume you have python3 installed. Then you can build and test with

cd pygsound
python3 setup.py develop
python3 setup.py test

or directly install it as a python package with

cd pygsound
pip3 install .

Usage

See examples folder (extra modules may be required). You need to cd examples and run python3 mesh_sim.py (we recommend starting with this one). This script demonstrates two equivalent ways to define the environment for sound propagation, and save the impulse response as an audio file. You can use a .obj file with an optional .mtl file with the same name to define the room geometry and materials. In this case, the .mtl file has two extra rows compared with conventional .mtl file used for visual rendering:

sound_a 0.5 0.6 0.6 0.7 0.75 0.8 0.9 0.9  # sound absorption coefficients, for 8 octave bands [62.5, 125, 250, 500, 1000, 2000, 4000, 8000]Hz
sound_s 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 # sound scattering coefficients, if you don't know the details of diffuse/specular reflections, keep it low

or directly create a shoebox shaped room using our API:

room = ps.createbox(dim_x, dim_y, dim_z, absorption_coefficient, scattering_coefficient)

The benefit of using the .obj style is that you can easily define different reflection/absorption coefficients for each triangle element for each frequency sub-band.

Contact

This package is maintained by Zhenyu Tang. For code issues, please open new issues or join discussions in our github repo. For research related questions, please directly contact corresponding authors.

Citations

This sound propagation engine has been used for many research work of Dr Carl Schissler and other researchers in the UMD GAMMA group for audio rendering and impulse response generation purposes. For example:

@inproceedings{schissler2011gsound,
  title={Gsound: Interactive sound propagation for games},
  author={Schissler, Carl and Manocha, Dinesh},
  booktitle={Audio Engineering Society Conference: 41st International Conference: Audio for Games},
  year={2011},
  organization={Audio Engineering Society}
}

@article{schissler2017interactive,
  title={Interactive sound propagation and rendering for large multi-source scenes},
  author={Schissler, Carl and Manocha, Dinesh},
  journal={ACM Transactions on Graphics (TOG)},
  volume={36},
  number={1},
  pages={2},
  year={2017},
  publisher={ACM}
}

@inproceedings{9052932,
  author={Z. {Tang} and L. {Chen} and B. {Wu} and D. {Yu} and D. {Manocha}},  
  booktitle={ICASSP 2020 - 2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP)},  
  title={Improving Reverberant Speech Training Using Diffuse Acoustic Simulation},   
  year={2020},  
  volume={},  
  number={},  
  pages={6969-6973},
}

For a complete list of relevant work you may want to cite depending on how you use this repo, see our speech related research and sound related research.

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

pygsound-0.3.tar.gz (5.7 kB view hashes)

Uploaded Source

Built Distributions

pygsound-0.3-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.6 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

pygsound-0.3-pp38-pypy38_pp73-macosx_10_9_x86_64.whl (3.4 MB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

pygsound-0.3-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.6 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

pygsound-0.3-pp37-pypy37_pp73-macosx_10_9_x86_64.whl (2.8 MB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

pygsound-0.3-cp310-cp310-musllinux_1_1_x86_64.whl (2.8 MB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ x86-64

pygsound-0.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.0 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

pygsound-0.3-cp310-cp310-macosx_10_9_x86_64.whl (2.8 MB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

pygsound-0.3-cp39-cp39-musllinux_1_1_x86_64.whl (2.8 MB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ x86-64

pygsound-0.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.0 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

pygsound-0.3-cp39-cp39-macosx_10_9_x86_64.whl (2.8 MB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

pygsound-0.3-cp38-cp38-musllinux_1_1_x86_64.whl (2.8 MB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ x86-64

pygsound-0.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.0 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

pygsound-0.3-cp38-cp38-macosx_10_9_x86_64.whl (2.8 MB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

pygsound-0.3-cp37-cp37m-musllinux_1_1_x86_64.whl (2.8 MB view hashes)

Uploaded CPython 3.7m musllinux: musl 1.1+ x86-64

pygsound-0.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.0 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

pygsound-0.3-cp37-cp37m-macosx_10_9_x86_64.whl (2.8 MB view hashes)

Uploaded CPython 3.7m macOS 10.9+ x86-64

pygsound-0.3-cp36-cp36m-musllinux_1_1_x86_64.whl (2.8 MB view hashes)

Uploaded CPython 3.6m musllinux: musl 1.1+ x86-64

pygsound-0.3-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.0 MB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.17+ x86-64

pygsound-0.3-cp36-cp36m-macosx_10_9_x86_64.whl (2.8 MB view hashes)

Uploaded CPython 3.6m macOS 10.9+ x86-64

Supported by

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