Skip to main content

Room Impulse Response Generator.

Project description

Room Impulse Response Generator

Documentation Status Build Status DOI

Python- and C-based room impulse response generator, for use in convolutional reverb.

Official Python port of https://github.com/ehabets/RIR-Generator.

Installation

pip install rir-generator

Usage

import numpy as np
import scipy.signal as ss
import soundfile as sf
import rir_generator as rir

signal, fs = sf.read("bark.wav", always_2d=True)

h = rir.generate(
    c=340,                  # Sound velocity (m/s)
    fs=fs,                  # Sample frequency (samples/s)
    r=[                     # Receiver position(s) [x y z] (m)
        [2, 1.5, 1],
        [2, 1.5, 2],
        [2, 1.5, 3]
    ],
    s=[2, 3.5, 2],          # Source position [x y z] (m)
    L=[5, 4, 6],            # Room dimensions [x y z] (m)
    reverberation_time=0.4, # Reverberation time (s)
    nsample=4096,           # Number of output samples
)

print(h.shape)              # (4096, 3)
print(signal.shape)         # (11462, 2)

# Convolve 2-channel signal with 3 impulse responses
signal = ss.convolve(h[:, None, :], signal[:, :, None])

print(signal.shape)         # (15557, 2, 3)

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

rir-generator-0.2.0.tar.gz (8.2 kB view details)

Uploaded Source

File details

Details for the file rir-generator-0.2.0.tar.gz.

File metadata

  • Download URL: rir-generator-0.2.0.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for rir-generator-0.2.0.tar.gz
Algorithm Hash digest
SHA256 2ca49ddc628dcd36e81924902fdc3b8e31531062f5f2a49eb386eca681fe3176
MD5 fc530aa2a549b4f706f73633d2b50eac
BLAKE2b-256 a715831b4918c7216b3d21301a71877809eabfa64c25f2d84b6be888f96e6172

See more details on using hashes here.

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