DavidDiazGuerra / gpuRIR

Python library for Room Impulse Response (RIR) simulation with GPU acceleration
GNU Affero General Public License v3.0
488 stars 94 forks source link
acoustics gpu-acceleration image-source-model python-library rir room-impulse-responses

gpuRIR

gpuRIR is a free and open-source Python library for Room Impulse Response (RIR) simulation using the Image Source Method (ISM) with GPU acceleration. It can compute the RIRs between several source and receivers positions in parallel using CUDA GPUs. It is approximately 100 times faster than CPU implementations [1].

Prerequisites

Note for PyTorch users: If you are going to use this module with PyTorch, the compiler you use to build gpuRIR must be ABI-compatible with the compiler PyTorch was built with, so you must use GCC version 4.9 and above.

Installation

You can use pip to install gpuRIR from our repository through pip install https://github.com/DavidDiazGuerra/gpuRIR/zipball/master. You can also clone or download our repository and run pip install gpuRIR/.

License

The library is subject to AGPL-3.0 license and comes with no warranty. If you find it useful for your research work, please, acknowledge it to [1].

Documentation

simulateRIR

Room Impulse Responses (RIRs) simulation using the Image Source Method (ISM). For further details see [1].

Parameters

Returns

3D ndarray The first axis is the source, the second the receiver and the third the time.

Warnings

Asking for too much and too long RIRs (specially for full ISM simulations) may exceed the GPU memory and crash the kernel.

simulateTrajectory

Filter an audio signal by the RIRs of a motion trajectory recorded with a microphone array.

Parameters

Returns

2D ndarray Matrix with the signals captured by each microphone in each column.

activateMixedPrecision

Activate the mixed precision mode, only for Pascal GPU architecture or superior.

Parameters

activateLUT

Activate the lookup table for the sinc computations.

Parameters

beta_SabineEstimation

Estimation of the reflection coefficients needed to have the desired reverberation time.

Parameters

Returns

ndarray with 6 elements. Reflection coefficients of the walls as $[\beta{x0}, \beta{x1}, \beta{y0}, \beta{y1}, \beta{z0}, \beta{z1}]$, where $\beta{x0}$ and $\beta{x1}$ are the reflection coefficients of the walls orthogonal to the x axis at x=0 and x=room_sz[0], respectively.

att2t_SabineEstimator

Estimation of the time for the RIR to reach a certain attenuation using the Sabine model.

Parameters

Returns

float. Time (in seconds) to reach the desired attenuation.

t2n

Estimation of the number of images needed for a correct RIR simulation.

Parameters

Returns

3 elements list of integers. The number of images sources to compute in each dimension.

References

[1] Diaz-Guerra, D., Miguel, A. & Beltran, J.R. gpuRIR: A python library for room impulse response simulation with GPU acceleration. Multimed Tools Appl (2020). [DOI] [SharedIt] [arXiv preprint]