PyTorch-based room impulse response (RIR) simulation toolkit for static and dynamic scenes.
Project description
TorchRIR
PyTorch-based room impulse response (RIR) simulation toolkit focused on a clean, modern API with GPU support. This project has been substantially assisted by AI using Codex.
Installation
pip install torchrir
Examples
examples/static.py: fixed sources/mics with binaural output.
uv run python examples/static.py --plotexamples/dynamic_src.py: moving sources, fixed mics.
uv run python examples/dynamic_src.py --plotexamples/dynamic_mic.py: fixed sources, moving mics.
uv run python examples/dynamic_mic.py --plotexamples/cli.py: unified CLI for static/dynamic scenes, JSON/YAML configs.
uv run python examples/cli.py --mode static --plotexamples/cmu_arctic_dynamic_dataset.py: small dynamic dataset generator (fixed room/mics, randomized source motion).
uv run python examples/cmu_arctic_dynamic_dataset.py --num-scenes 4 --num-sources 2examples/benchmark_device.py: CPU/GPU benchmark for RIR simulation.
uv run python examples/benchmark_device.py --dynamic
Core API Overview
- Geometry:
Room,Source,MicrophoneArray - Static RIR:
simulate_rir - Dynamic RIR:
simulate_dynamic_rir - Dynamic convolution:
DynamicConvolver - Metadata export:
build_metadata,save_metadata_json
from torchrir import DynamicConvolver, MicrophoneArray, Room, Source, simulate_rir
room = Room.shoebox(size=[6.0, 4.0, 3.0], fs=16000, beta=[0.9] * 6)
sources = Source.from_positions([[1.0, 2.0, 1.5]])
mics = MicrophoneArray.from_positions([[2.0, 2.0, 1.5]])
rir = simulate_rir(room=room, sources=sources, mics=mics, max_order=6, tmax=0.3)
# For dynamic scenes, compute rirs with simulate_dynamic_rir and convolve:
# y = DynamicConvolver(mode="trajectory").convolve(signal, rirs)
For detailed documentation, see the docs under docs/ and Read the Docs.
Future Work
- Ray tracing backend: implement
RayTracingSimulatorwith frequency-dependent absorption/scattering. - CUDA-native acceleration: introduce dedicated CUDA kernels for large-scale RIR generation.
- Dataset expansion: add additional dataset integrations beyond CMU ARCTIC (see
TemplateDataset). - Add regression tests comparing generated RIRs against gpuRIR outputs.
Related Libraries
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
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 torchrir-0.1.4.tar.gz.
File metadata
- Download URL: torchrir-0.1.4.tar.gz
- Upload date:
- Size: 36.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
191d440f6d6237ec5659ef7b862d83c035c1f14bd9a6207259dbaa2b6f9b32f9
|
|
| MD5 |
52b3007b5a58a1e2dd543e2ad68531c4
|
|
| BLAKE2b-256 |
04bf3a0b3ebf0af855388807070be5da9905968bf6e72696983172001959e9d6
|
File details
Details for the file torchrir-0.1.4-py3-none-any.whl.
File metadata
- Download URL: torchrir-0.1.4-py3-none-any.whl
- Upload date:
- Size: 40.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
645762473250185bbd76c47ca54ff8293e0399b4b53dd68103904b6d9acb1cb7
|
|
| MD5 |
0d6991ddf1180945205d8d3047571e09
|
|
| BLAKE2b-256 |
b0d10d601f9efe5560ca5f7e1762e4476be7ecae597399832835879883dfa0ea
|