pyrirgen developer on retainer: beta is pressure reflection coefficient not energy absorption — beta=0.4 gives absorption 84% not 40% — RT60 0.056s not 0.20s — speech enhancement model fails on real offices — 4 months — pyrirgen developer on monthly retainer
pyrirgen 1.0.1 • Python 3.9; generate_rir(beta=0.4); beta is pressure reflection coefficient (β), NOT energy absorption coefficient (α); absorption = 1 − β² = 1 − 0.16 = 0.84 (84% not 40%); Eyring RT60 ≈ 0.056s not 0.20s; 50,000-utterance training corpus generated with nearly-anechoic RIRs; speech enhancement model PESQ 2.4 on real office (RT60≈0.4s) vs 3.8 on anechoic test; fix: beta = np.sqrt(1 − alpha) • Southfield Pyrirgen Ltd. (conversational AI; 16 kHz; 5 room types; 4 months; 2.5h)
Southfield Pyrirgen Ltd. built a data augmentation pipeline for a speech enhancement model targeting open-plan office environments. The pipeline generated synthetic room impulse responses (RIRs) using the image method via pyrirgen.generate_rir() across five room types: small office (5×4×3m), medium office (8×6×3m), conference room (10×8×3m), corridor (15×2×3m), and open-plan space (20×15×4m). Each room type was assigned a target absorption coefficient α representing the fraction of acoustic energy absorbed per wall reflection: 0.30 (lightly treated, RT60 ≈ 0.35s target), 0.40 (moderate, RT60 ≈ 0.20s), 0.50 (well treated, RT60 ≈ 0.15s), 0.60, and 0.70. The developer passed these values directly as beta: generate_rir(c=340, fs=16000, r=receiver, s=source, L=dims, beta=0.40, n=4096). The pipeline generated 50,000 RIRs (10,000 per room type) and convolved them with clean speech recordings to create a reverberant training corpus. After 3 months of model training with four different neural network architectures (LSTM, U-Net, Conformer, TF-GridNet), evaluation on a real office test set (RT60 measured at 0.38 – 0.47s) consistently showed PESQ around 2.4 – 2.6 — significantly below the target of 3.5. On the synthetic test set using the same beta values, PESQ was 3.7 – 3.9. The gap between synthetic and real-world performance was attributed to domain shift: “model hasn’t seen enough variety.” The team tried larger architectures, more training data, different loss functions (PESQ-loss, SI-SNR, spectral convergence). None improved the real-world PESQ above 2.7.
The mechanism: pyrirgen.generate_rir() beta parameter is the acoustic pressure reflection coefficient β — the fraction of sound pressure amplitude that is reflected from each wall surface at each bounce. The relationship between pressure reflection coefficient β and energy absorption coefficient α is β = √(1 − α): energy incident = 1 (normalised); energy reflected = β²; energy absorbed = 1 − β² = α. Setting beta=0.4 does not produce 40% energy absorption: it produces α = 1 − 0.4² = 1 − 0.16 = 0.84 (84% energy absorption per reflection). Using Eyring’s RT60 formula for the 5×4×3m room (V = 60 m³, total surface area S = 2×(20+15+12) = 94 m²): target absorption α = 0.40, correct β = √0.60 ≈ 0.775: RT60 = 0.161×60 / (−94×ln(1−0.40)) = 9.66 / (−94×(−0.511)) = 9.66 / 48.0 ≈ 0.201s. Buggy α‑actual = 0.84: RT60 = 0.161×60 / (−94×ln(1−0.84)) = 9.66 / (−94×(−1.833)) = 9.66 / 172.3 ≈ 0.056s. All five room types in the training dataset had RT60 ≈ 0.04 – 0.06s regardless of their different “alpha” values (0.3 – 0.7), because all five betas (0.3, 0.4, 0.5, 0.6, 0.7) corresponded to actual α‑values of 0.91, 0.84, 0.75, 0.64, 0.51 — all heavily absorbing. The “5 room type” dataset was effectively a single room type (nearly-anechoic) with minor geometry variation. The speech enhancement model never saw reverberation tails longer than 60ms during training, so it had no capacity to suppress the 400ms reverberant tails in the real office test environment.
# Southfield Pyrirgen Ltd. — pyrirgen 1.0.1 beta fix
# pyrirgen 1.0.1; Python 3.9; NumPy 1.23; SciPy 1.9
# 16kHz; 5-room speech enhancement augmentation dataset
#
# Problem: beta = pressure reflection coefficient (β), NOT absorption (α)
# β = sqrt(1 - α): for α=0.4, β=sqrt(0.6)≈0.775, NOT 0.4
# beta=0.4 → actual α=1-0.4²=0.84 → RT60≈0.056s (nearly anechoic)
# all training RIRs had RT60 0.04–0.06s regardless of room type
# model trained on anechoic-like data; failed on real offices (RT60≈0.4s)
# Fix: beta = np.sqrt(1 - alpha)
import numpy as np
import pyrirgen
def alpha_to_beta(alpha: float) -> float:
"""
Convert energy absorption coefficient (α) to pressure reflection coefficient (β).
pyrirgen beta parameter is β = sqrt(1 - α), not α directly.
α=0.0: fully reflective (β=1.0); α=1.0: fully absorbing (β=0.0).
Common values: office α=0.3–0.5 → β≈0.707–0.837; anechoic α≈0.99 → β≈0.1.
"""
if not 0.0 <= alpha <= 1.0:
raise ValueError(f"Absorption coefficient alpha must be in [0, 1]: got {alpha}")
return float(np.sqrt(1.0 - alpha))
def eyring_rt60(V: float, S: float, alpha: float) -> float:
"""
Eyring's RT60 formula for a room with uniform absorption coefficient alpha.
V = room volume (m³), S = total surface area (m²), alpha = absorption coefficient.
More accurate than Sabine's formula for high-absorption rooms (alpha > 0.3).
"""
if alpha >= 1.0:
return 0.0
return 0.161 * V / (-S * np.log(1.0 - alpha))
def beta_from_target_rt60(V: float, S: float, rt60_target: float) -> float:
"""
Compute pyrirgen beta for a desired RT60 (seconds) in a shoebox room.
Inverts Eyring's formula: α = 1 - exp(-0.161×V / (S×RT60))
then converts to β = sqrt(1-α).
"""
alpha_target = 1.0 - np.exp(-0.161 * V / (S * rt60_target))
alpha_target = float(np.clip(alpha_target, 0.01, 0.99))
return alpha_to_beta(alpha_target)
def generate_rir_buggy(room_dims, source_pos, receiver_pos,
target_alpha=0.4, fs=16000, n=4096):
"""BUGGY: passes alpha directly as beta."""
return pyrirgen.generate_rir(
c=340, fs=fs,
r=np.array(receiver_pos),
s=np.array(source_pos),
L=np.array(room_dims),
beta=target_alpha, # WRONG: beta expects reflection coeff, not absorption
n=n,
mtype='omnidirectional'
)
def generate_rir_fixed(room_dims, source_pos, receiver_pos,
target_alpha=0.4, fs=16000, n=4096):
"""FIXED: convert alpha to beta before passing to generate_rir()."""
beta = alpha_to_beta(target_alpha) # 0.4 → sqrt(0.6) ≈ 0.775
return pyrirgen.generate_rir(
c=340, fs=fs,
r=np.array(receiver_pos),
s=np.array(source_pos),
L=np.array(room_dims),
beta=beta,
n=n,
mtype='omnidirectional'
)
def compute_schroeder_t60(rir: np.ndarray, fs: int) -> float:
"""
Estimate T60 from a room impulse response using Schroeder backintegration.
Returns T60 in seconds. Use to validate that generated RIR matches target RT60.
"""
h2 = rir ** 2
# Schroeder integral: backwards cumulative sum of energy
decay_energy = np.cumsum(h2[::-1])[::-1]
decay_db = 10.0 * np.log10(decay_energy / (decay_energy[0] + 1e-20) + 1e-20)
# Find where decay crosses -60 dB
t60_indices = np.where(decay_db <= -60.0)[0]
if len(t60_indices) == 0:
# RIR too short to reach -60 dB — increase n (rir_length)
return float(len(rir)) / fs
return float(t60_indices[0]) / fs
def validate_rir_rt60(room_dims, source_pos, receiver_pos,
target_alpha: float, fs: int = 16000,
n: int = 8192, rt60_tolerance: float = 0.25) -> None:
"""
Generate a test RIR and assert that its measured T60 matches target RT60.
Run this BEFORE generating the full training corpus.
rt60_tolerance: fractional tolerance (0.25 = ±25%).
"""
L = np.array(room_dims)
V = float(L[0] * L[1] * L[2])
S = float(2.0 * (L[0]*L[1] + L[0]*L[2] + L[1]*L[2]))
target_rt60 = eyring_rt60(V, S, target_alpha)
rir = generate_rir_fixed(room_dims, source_pos, receiver_pos,
target_alpha=target_alpha, fs=fs, n=n)
measured_t60 = compute_schroeder_t60(rir, fs)
relative_error = abs(measured_t60 - target_rt60) / max(target_rt60, 0.01)
if relative_error > rt60_tolerance:
raise ValueError(
f"RIR RT60 validation failed for room {room_dims}, alpha={target_alpha}: "
f"measured T60={measured_t60:.3f}s, target RT60={target_rt60:.3f}s "
f"(error={relative_error:.1%}, tolerance={rt60_tolerance:.0%}). "
f"Check: beta should be sqrt(1-alpha)={alpha_to_beta(target_alpha):.4f}, "
f"NOT alpha={target_alpha}. "
f"V={V:.1f}m³, S={S:.1f}m²."
)
print(
f"RT60 validation PASSED: room {room_dims}, alpha={target_alpha}, "
f"beta={alpha_to_beta(target_alpha):.3f}, "
f"target RT60={target_rt60:.3f}s, measured T60={measured_t60:.3f}s "
f"(error={relative_error:.1%})."
)
Why β=0.4 and β=0.775 produce radically different RT60 values and why the difference is undetectable from the RIR waveform shape
The image method produces a valid RIR for any value of beta in (0, 1). There is no numerical instability, no warning, no anomalous shape. A RIR generated with β=0.4 looks exactly like a physically plausible RIR: a sharp direct-path peak, a cluster of early reflections in the first 10 – 20ms, and an exponential decay tail. The difference is in how quickly that tail decays: with β=0.4 (84% energy absorbed per reflection), the energy after the third reflection is 0.4²³ = 0.4&sup6; ≈ 0.004 (0.4% of incident energy) — effectively zero. With β=0.775 (40% energy absorbed per reflection), the energy after the same three reflections is 0.775&sup6; ≈ 0.228 (23% remains), producing the realistic late reverberant field. The RT60 is four times longer. The developer’s mental model was confirmed by the visual appearance of the RIR plots: “there is a sharp impulse and an exponential decay, so the RIR looks correct.” The model’s consistently high PESQ on the synthetic test set (3.7 – 3.9) reinforced this: the enhancement network was successfully suppressing the very weak reverberation in the anechoic-like training data. The domain gap only became visible when tested on real environments where RT60 was 7× longer than training data. The definitive diagnostic: generate a test RIR and compute its T60 using Schroeder backintegration before generating the full training corpus. For a 5×4×3m room with target alpha=0.4, the expected T60 is about 0.20s; if the measured T60 is below 0.08s, the beta/alpha confusion is present. This single validation step, taking under 2 minutes, would have surfaced the error at the start of the pipeline rather than 4 months later.
Southfield Pyrirgen Ltd.’s retainer engagement was 2.5h: 0.4h triage (request generate_rir() call site and beta value used; beta=0.4 identified immediately as the absorption coefficient, not reflection coefficient; compute actual RT60: 0.056s vs target 0.20s); 1.0h root cause (trace through all 5 room types: beta 0.3 – 0.7 all treated as absorption; actual α-values 0.91, 0.84, 0.75, 0.64, 0.51; Eyring RT60 for all five rooms: 0.030 – 0.080s; plot energy decay curves: all show −60 dB within 80ms; recompute correct betas: √0.70, √0.60, √0.50, √0.40, √0.30; correct RT60 targets: 0.189, 0.201, 0.228, 0.258, 0.289s; confirm Schroeder T60 measurement on 10 test RIRs with correct betas: all within 15% of target); 0.6h fix (replace beta=alpha with beta=np.sqrt(1−alpha) in RIR generator; add alpha_to_beta() utility; add Schroeder T60 gate: generate 1 RIR per room type before full run; assert T60 within 25% of target; regenerate 50,000 RIRs — 23 minutes on CPU); 0.5h validation (run PESQ on the same real-office test set using the new RIRs for the speech enhancement model retraining data: PESQ 3.6 on the validation set after 2 epochs of continued training — confirms the data augmentation domain is now correct; model retrain initiated; 2.5h total). Hours logged to HourTab with per-session breakdown.
Related retainer posts
- pyroomacoustics developer on retainer — pyroomacoustics 0.7.3; Python 3.10;
RoomSimulatormax_orderdefault=17; first-order reflections only needed; 288 spurious image sources slow simulation 17×; RIR generation 4.2s per utterance; fix:max_order=1; 1.5h - acoular developer on retainer — acoular 24.07; Python 3.10; 64-element planar array;
MicGeomXML positions written in cm without ÷100 unit conversion; acoular parses as metres; 60m not 0.60m aperture; delay errors 100×; beamformer dynamic range 2.1 dB; £19,500 wind tunnel wasted; fix:mg.mpos = mg.mpos / 100; 3.0h - python-acoustics developer on retainer — python-acoustics 0.2.6; Python 3.10;
Atmosphere(temperature=293.15); developer pre-converts 20°C → Kelvin; library adds 273.15 again; T=566.3 K; ISO 9613-1 absorption 61× overestimated; noise impact wrong; fix:Atmosphere(temperature=20.0); 2.0h
Track retainer hours without a client portal
HourTab turns your time-tracker CSV into a public URL your client bookmarks. No login. No portal. CSV in, URL out.
See pricing →