Skip to main content

Room Impulse Response extraction package.

Project description

SCENE-RIR

The purpose of this package is to extract the Room Impulse Response (RIR) from the recorded response signal of an appropriate excitation signal. It employs the swept-sine measurement method [1]. Both linear sweeps—corresponding to a white spectrum noise—and exponential sweeps—corresponding to a pink spectrum noise—are implemented. The exponential swept-sine generation is based on Angelo Farina's methodology [2].

It is part of the Audio Simulation Module, developed for the Horizon Europe project SCENE (2023-2025): "Searchable multi-dimensional data lakes, supporting Cognive film production & distribution, for the promotion of the EuropeaN Cultural HeritagE."

Copyright (C) 2025 Christos Sevastiadis

📦 Installation

Install via PyPI

You can install this package from PyPI using pip:

pip install scene-rir

Install via Conda

To install this package using conda, make sure you have either Miniconda or Anaconda installed.

Then, run the following command:

conda install -c csevast scene-rir

✅ Installation verification

To check if the package was installed successfully, try:

python -c "import scene_rir.rir; help(scene_rir.rir)

If the scene-rir is installed, this command will print all of its help documentation string.

💻 Examples of usage

Create and save the default exponential swept-sine excitation signal.

from scene_rir import rir

signal = rir.SweptSineSignal()
signal.save("output/ss-signal-44100_kHz-2972_ms.wav")

Usage example of creating and using a swept-sine signal in a Python script.

from matplotlib import pyplot as plt
from scene_rir import rir

params = {
    "antslcdur": 0.1,
    "frqstp": 10000,
    "frqstt": 100,
    "pstslcdur": 0.1,
    "sgllvl": -6,
    "sglszeidx": 2,
    "smprteidx": 5,
    "ss_rtetyp": "log",
}
signal = rir.SweptSineSignal(params)
_, sglvec = signal.signal_vector()
tmevec = signal.time_vector()
sgldur = signal.sgldur

_, ax = plt.subplots()
ax.plot(tmevec, sglvec)
ax.set_xlim(0, sgldur)
ax.set_ylim(-1, 1)

plt.show()

Exctract the room impulse response from a recorded response signal to a previously produced swept-sine excitation signal.

from scene_rir import rir


params = {
    "rec_path": "input/rec-signal.wav",
    "ref_path": "output/ref-signal.wav",
    "sgllvl": 0,
}
irs_signal = rir.ImpulseResponseSignal(params)
irs_signal.save("output/irs-signal.wav")

Usage example of extracting the impulse response in a Python script.

import numpy as np
from matplotlib import pyplot as plt
from scene_rir import rir

par = {
    "rec_path": "input/rec-signal.wav",
    "ref_path": "output/ref-signal.wav",
    "path": "output/irs-signal.wav",
    "sgllvl": 0,
}
irs_signal = rir.ImpulseResponseSignal(par)
smprte, sglvec = irs_signal.signal_vector()

_, ax = plt.subplots()

sgldur = sglvec.size / smprte
tmevec = np.linspace(0, sgldur, sglvec.size)
ax.plot(tmevec, sglvec)
ax.set_xlim(0, sgldur)

plt.show()

Example of usage from command line (Windows OS):

> python -m scene_rir.rir
Usage: python -m scene_rir.rir [command] [parameter1] [parameter2]
or
python3 -m scene_rir.rir [command] [parameter1] [parameter2]
Available commands:
save   Save the default swept-sine signal.
> python -m scene_rir.rir --help
Usage: python -m scene_rir.rir [command] [parameter1] [parameter2]
or
python3 -m scene_rir.rir [command] [parameter1] [parameter2]
Available commands:
save   Save the default swept-sine signal.

> python -m scene_rir.rir save my_folder/my_signal.wav

⚖️ License: GNU GPL v3.0

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

📖 References

  • [1]: International Organization for Standardization (2006). Acoustics — Application of new measurement methods in building and room acoustics (ISO Standard No. 18233). Retrieved from https://www.iso.org/standard/40408.html.
  • [2]: Farina, A. (2000, February). Simultaneous measurement of impulse response and distortion with a swept-sine technique. In Audio Engineering Society Convention 108. Audio Engineering Society.

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

scene_rir-2025.11.tar.gz (3.5 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scene_rir-2025.11-py3-none-any.whl (23.4 kB view details)

Uploaded Python 3

File details

Details for the file scene_rir-2025.11.tar.gz.

File metadata

  • Download URL: scene_rir-2025.11.tar.gz
  • Upload date:
  • Size: 3.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.2

File hashes

Hashes for scene_rir-2025.11.tar.gz
Algorithm Hash digest
SHA256 2f343cff254b5b82dfcda672f0fcc3ea4717835c9d6dc425bb3ada6bc879df9c
MD5 c1b31f7aa1d179b176a1b96b7344315a
BLAKE2b-256 47b320820ee00061a7b560064b900e066b21b48052e7bbef687ffc6c89b36d81

See more details on using hashes here.

File details

Details for the file scene_rir-2025.11-py3-none-any.whl.

File metadata

  • Download URL: scene_rir-2025.11-py3-none-any.whl
  • Upload date:
  • Size: 23.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.2

File hashes

Hashes for scene_rir-2025.11-py3-none-any.whl
Algorithm Hash digest
SHA256 2b2368c9438fe039f5128c59ecf188f0da33028f3cf9dca2040724817bdcaf69
MD5 4b86aa207633fe425e32c4629d2a68c4
BLAKE2b-256 5c8dc46a91981a530f39b6560174e54fec441b38fb773ccc82cc74fc43986298

See more details on using hashes here.

Supported by

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