Skip to content

[FEATURE] add rectangular_room_frf and rectangular_room_ir to pytta.rooms - #100

Open
aguirreSL wants to merge 1 commit into
PyTTaMaster:developmentfrom
aguirreSL:dev-room_modes
Open

aguirreSL wants to merge 1 commit into
PyTTaMaster:developmentfrom
aguirreSL:dev-room_modes

Conversation

@aguirreSL

Copy link
Copy Markdown

Adds the modal model of a rectangular room of ita_roomacoustics_analytic_FRF (ITA-Toolbox) to pytta.rooms:

  1. rectangular_room_frf(dimensions, source, receiver, frequencies, T=2, f_max=None): the transfer function p / Q (Pa per m³/s) from a point source of volume velocity Q to a receiver, in a room with rigid walls and uniform modal damping, by modal superposition (Fahy, Foundations of Engineering Acoustics, 9.8):

    H = jω ρ c² Σ ψ_N(r) ψ_N(r0) / (Λ_N (ω_N² - ω² + 2 j δ ω)),

    with cosine eigenfunctions, Λ_N = V Π (1 for n = 0, 1/2 otherwise), and δ = 3 ln(10) / T for every mode. The time dependence is exp(jωt), the convention of numpy.fft, so the impulse response is causal. The uniform mode (0, 0, 0) is computed in closed form, ρ c² / (V (2δ + jω)), so that the response is finite at 0 Hz, where it is the compression of the whole volume.

  2. rectangular_room_ir(dimensions, source, receiver, samplingRate, numSamples, T=2, f_max=None): its impulse response as a SignalObj. The modes go up to 0.4 times the sampling rate by default, and a raised-cosine fade takes the response to zero at the Nyquist frequency. Cutting it where it is large would ring through the whole circular response.

The model was written from Fahy and checked by the rules below. The ITA function returns a pole-residue object, and its own code notes that a correction factor in it is not totally correct, so it was not used as the oracle.

The tests in tests/test_room_modes.py print the measured values:

  1. In a room of 5 m × 4 m × 3 m, the (1, 0, 0) mode peaks at 34.317 Hz (c / (2 Lx) = 34.320 Hz) with a half-power bandwidth of 1.0990 Hz, against 3 ln(10) / (π T) = 1.0994 Hz.
  2. Swapping source and receiver leaves the transfer function unchanged, and a receiver on the nodal plane x = Lx / 2 is 35.9 dB below a receiver at the wall at that mode.
  3. The decay curve of the energy summed over six receivers gives T = 0.7920 s for a model with T = 0.8 s, and the response keeps falling, 149 dB down from 2.0 s to 2.5 s.
  4. Positions outside the room are rejected.

Checked with Python 3.12, numpy 1.26 and scipy 1.17. The 7 failures of development (3 in test_h5io.py, 4 in test_pyttasave.py) are the same with and without this change.

Co-Authored-By: Claude Fable 5.1 noreply@anthropic.com

…ooms

rectangular_room_frf gives the transfer function from a point source of
volume velocity to a receiver in a rectangular room with rigid walls and
uniform modal damping, by modal superposition (Fahy, Foundations of
Engineering Acoustics, 9.8), as ita_roomacoustics_analytic_FRF of the
ITA-Toolbox. The uniform mode is computed in closed form, so the
response is finite at 0 Hz. rectangular_room_ir gives its impulse
response, band-limited with a raised-cosine fade below the Nyquist
frequency.

Tests check the frequency and half-power bandwidth of an isolated mode
(2.2 / T), reciprocity, the nodal plane of a mode, and that the impulse
response decays with the reverberation time of the model with no floor.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant