Measure Room Acoustics: RT60 and Clarity
To measure RT60 from an impulse response, pass its samples to analyzeImpulseResponse (analyze_impulse_response in Python). One call reports the reverberation time rt60 and early decay time edt in seconds, and the clarity values c50 and c80 in dB, when each measurement can be made. Results include overall values and per-octave-band measurements where available. A clap, a balloon pop, or a deconvolved sine sweep can serve as the impulse response.
import math
import libsonare as sonare
ir = sonare.Audio.from_file("room-clap.wav")
result = sonare.analyze_impulse_response(ir.data, ir.sample_rate)
rt60 = f"{result.rt60:.2f} s" if result.rt60 is not None and math.isfinite(result.rt60) else "not measured"
c50 = f"{result.c50:.1f} dB" if result.c50 is not None and math.isfinite(result.c50) else "not measured"
c80 = f"{result.c80:.1f} dB" if result.c80 is not None and math.isfinite(result.c80) else "not measured"
print(f"RT60 {rt60}, C50 {c50}, C80 {c80}")The rest of the page covers blind estimation and the equivalent-room estimate, with the JavaScript, Node and CLI forms of each call. Creating a room or applying one to a recording is Room Simulation.
If reverberation time, impulse response, or dB are unfamiliar, read Audio Basics and Reverberation Time first — this page assumes that vocabulary and focuses on which API answers which room question.
Use this page when you want to:
- measure a clap or impulse-response recording;
- estimate a rough room profile from ordinary audio;
- create a room impulse response or apply a room to a recording, which Room Simulation covers.
This is different from music analysis. detectBpm(...) and analyze(...) describe a song. The room-acoustic APIs describe the recording space, or synthesize and apply one.
What is an impulse response?
An impulse response (IR) records how a room rings and decays after a short excitation such as a clap or balloon pop. A sine-sweep recording must be deconvolved with the known sweep to obtain an IR before analysis. Because an IR captures the room reaction rather than the song or the excitation, it is a cleaner input for RT60, clarity, and other room-acoustic metrics.
First-time terms
- Equivalent room means a simple room model that matches the measured sound well enough for analysis or UI feedback. It is not a scan of the exact real room.
- RIR means room impulse response: audio samples that represent how a room would respond to a short sound.
- Shoebox room means a rectangular room model with length, width, and height.
- DRR means direct-to-reverberant ratio: how much direct sound there is compared with reflected room sound.
- Room morphing means adding a target room character as an effect. It is not dereverberation, which tries to remove reverb.
For fuller explanations of every metric below, see the Room Acoustics glossary.
Try it in the browser
The Spatial Room Scanner demo runs this whole pipeline locally: drop a recording (or pick a sample room) and it reconstructs the estimated geometry, RT60, clarity, and source distance as an interactive 3D scene. The reconstructed room can be saved as a convolution impulse response, and its numbers as a JSON estimate.
What You Will Learn
By the end of this page you should be able to:
- choose impulse-response analysis or blind acoustic estimation based on the input recording;
- estimate an equivalent room from a recording, including volume, dimensions, absorption, DRR, and confidence;
- tell where room synthesis and room morphing start, and that morphing is not dereverberation;
- explain RT60, EDT, C50, C80, D50, octave bands, confidence, and
isBlindat a practical level; - avoid using blind acoustic estimates as certification-grade measurements;
- call the same acoustic workflow from JavaScript, Python, or the CLI.
Choose the right function
| Input | Use | What to expect |
|---|---|---|
| A measured impulse response, starter pistol, balloon pop, sweep-derived IR, or clean clap capture | analyzeImpulseResponse(...) / analyze_impulse_response(...) | Best accuracy. The algorithm assumes the decay belongs to the room. |
| A normal music/speech recording with no isolated impulse | detectAcoustic(...) / detect_acoustic(...) | Blind estimate. Useful for ranking or UI hints, not certification. |
| A recording or impulse response where you need a practical equivalent-room model | estimateRoom(...) / estimate_room(...) | Volume, representative dimensions, DRR, per-band absorption/RT60, and confidence. |
| Shoebox room dimensions and source/listener placement | synthesizeRir(...) / synthesize_rir(...) | A reproducible mono RIR for the specified room and positions; see Room Simulation. |
| A dry or existing recording you want to push toward a target room | roomMorph(...) / room_morph(...) | Creative offline room effect. It does not remove existing reverb; see Room Simulation. |
analyzeImpulseResponse(...) and detectAcoustic(...) return AcousticResult: full-band metrics plus octave-band arrays. estimateRoom(...) returns RoomEstimateResult, synthesizeRir(...) returns RirResult, and roomMorph(...) returns RoomMorphResult — the morphed samples on audio, plus the diagnostics its target-room synthesis reported.
Why per-band (octave bands)?
A room does not absorb all frequencies equally — bass often rings longer than treble. Splitting the analysis into octave bands (each band roughly doubling in frequency: 125, 250, 500, 1k, 2k, 4k Hz) reports RT60 and clarity separately per band instead of as one average. Third-octave subbands are a finer split used internally during blind estimation.
Direct measurement vs blind estimation
analyzeImpulseResponse(...) looks directly at the decay after a short excitation. It is the right choice for a clap, pop, sweep-derived IR, or any recording where the initial sound and the following room decay are easy to separate.
detectAcoustic(...) estimates room behavior from ordinary music or speech. Because there is no isolated impulse, it searches the recording for regions where the source appears to stop and the remaining energy falls like room reverberation.
That difference changes how you should treat the result.
| Question | analyzeImpulseResponse(...) | detectAcoustic(...) |
|---|---|---|
| Input assumption | The room response is easy to isolate | Music or speech is mixed with the room |
| Best use | Measurement, comparison, validation | UI hints, tagging, warnings |
| Confidence | Easier to trust when the IR is clean | Essential to inspect because the input controls reliability |
| Low confidence usually means | The IR is noisy, too short, clipped, or poorly isolated, or its EDT and RT60 genuinely differ (a microphone close to the source, two coupled rooms), which the score cannot tell apart from a bad fit | No clear free-decay region was found, or non-room material looked like decay |
A free-decay region is a span where the source is no longer producing new sound and the room tail is naturally fading. Blind estimation cannot produce a trustworthy value when that region is not visible.
Usage
sampleRate is required on these calls: pass the recording's rate.
import {
init,
analyzeImpulseResponse,
detectAcoustic,
estimateRoom,
} from '@libraz/libsonare';
await init();
const measured = analyzeImpulseResponse(irSamples, sampleRate, {
nOctaveBands: 6, // octave bands
minDecayDb: 30, // fit span in dB
});
console.log(measured.rt60, measured.edt, measured.c50, measured.c80);
const blind = detectAcoustic(roomRecording, sampleRate, {
nOctaveBands: 6, // octave bands
nThirdOctaveSubbands: 24, // third-octave subbands used by blind estimation
minDecayDb: 30, // minimum usable decay in dB
noiseFloorMarginDb: 10, // noise-floor margin in dB
});
console.log(blind.confidence, blind.isBlind);
const estimate = estimateRoom(roomRecording, sampleRate, {
referenceAbsorption: 0.15,
nOctaveBands: 6,
});
console.log(estimate.volume, estimate.lengthM, estimate.widthM, estimate.heightM);
console.log(estimate.drrDb, estimate.confidence, estimate.bandAbsorption, estimate.rt60Bands);import {
analyzeImpulseResponse,
detectAcoustic,
estimateRoom,
} from '@libraz/libsonare-native';
const measured = analyzeImpulseResponse(irSamples, sampleRate, {
nOctaveBands: 6, // octave bands
minDecayDb: 30, // fit span in dB
});
console.log(measured.rt60, measured.edt, measured.c50, measured.c80);
const blind = detectAcoustic(roomRecording, sampleRate, {
nOctaveBands: 6, // octave bands
nThirdOctaveSubbands: 24, // third-octave subbands used by blind estimation
minDecayDb: 30, // minimum usable decay in dB
noiseFloorMarginDb: 10, // noise-floor margin in dB
});
console.log(blind.confidence, blind.isBlind);
const estimate = estimateRoom(roomRecording, sampleRate, {
referenceAbsorption: 0.15,
nOctaveBands: 6,
});
console.log(estimate.volume, estimate.lengthM, estimate.widthM, estimate.heightM);
console.log(estimate.drrDb, estimate.confidence, estimate.bandAbsorption, estimate.rt60Bands);import libsonare as sonare
audio = sonare.Audio.from_file("room-clap.wav")
measured = sonare.analyze_impulse_response(audio.data, audio.sample_rate, n_octave_bands=6, min_decay_db=30.0)
print(measured.rt60, measured.edt, measured.c50, measured.c80)
blind = sonare.detect_acoustic(
audio.data,
audio.sample_rate,
n_octave_bands=6,
n_third_octave_subbands=24,
min_decay_db=30.0,
noise_floor_margin_db=10.0,
)
print(blind.confidence, blind.is_blind)
estimate = sonare.estimate_room(audio.data, audio.sample_rate, n_octave_bands=6)
print(estimate.volume, estimate.length_m, estimate.width_m, estimate.height_m)
print(estimate.drr_db, estimate.confidence, estimate.band_absorption, estimate.rt60_bands)# blind estimate from a normal recording (uses default bands/thresholds)
sonare acoustic room-recording.wav
# impulse-response mode (clap / pop / sweep-derived IR)
sonare acoustic room-clap.wav --ir
# add --json for a machine-readable summary
sonare acoustic room-clap.wav --ir --json
# estimate an equivalent room from a recording
sonare estimate-room room-recording.wav --jsonPython Audio exposes the measurement calls as instance methods: audio.analyze_impulse_response(...) and audio.detect_acoustic(...). estimateRoom is a module-level call in Python and a standalone function in the WASM package.
Estimating an equivalent room
estimateRoom(...) estimates an equivalent room from a recording. Treat it as a practical model, not exact geometry. Always check confidence, because ordinary recordings may not contain enough clear room decay. Measurements that could not be made are absent in JavaScript and None in Python; in particular, volume and the three dimensions are absent when no broadband decay is measurable. Python uses the snake_case spellings.
| Option | Default | Meaning |
|---|---|---|
mode | 'auto' | 'auto' sends impulse-like input to impulse-response analysis and everything else to the blind path; 'blind' and 'impulseResponse' force a path. Names only: a number is a TypeError. |
aspectHintLw / aspectHintLh | 1 / 1 | Length : width and length : height ratios, so widthM = lengthM / aspectHintLw and heightM = lengthM / aspectHintLh. |
referenceAbsorption | 0.15 | Mean wall absorption that fixes the room scale (see below). Must lie in [0.01, 0.99]; a value outside it, 0 included, is a RangeError. |
preferEyring | true | Invert the decay with Eyring (true) or Sabine (false). |
nOctaveBands, minDecayDb, noiseFloorMarginDb | 6, 30, 10 | The same as for detectAcoustic(...). Omit one for its default; an explicit 0 is a RangeError. |
What estimateRoom(...) actually solves
It solves a scale only under the supplied shape and absorption priors; it does not recover the shape itself.
- Without
aspectHintLw/aspectHintLhthe three dimensions come back identical (a cube), so do not presentlengthM,widthMandheightMas recovered proportions unless you passed hints. - A single decay constrains the ratio
V / A, whereAis equivalent absorption area, rather than determining volume and absorption separately. With a fixed shape, surface area grows with the square of linear scale while volume grows with its cube, so a larger room needs a higher mean absorption to keep the same RT60.referenceAbsorptionsupplies the missing prior that pins the volume down. Under Sabine, the reported volume scales approximately with the cube of that prior; the default Eyring model uses the corresponding-ln(1 − α)term, so treat the cube rule as a Sabine approximation. Keep it fixed when comparing recordings.
The prior is checked rather than clamped: a value outside [0.01, 0.99] is refused instead of quietly moving to the nearest bound. Inside the range the cube rule still makes it a large lever; at 0.01 the reported volume is three orders of magnitude below the default.
Omit referenceAbsorption for the default
An explicit 0 is refused with a RangeError; omit the option for the default 0.15. The reported volume scales with the cube of the prior, so on a 2 s synthetic decay with a 0.5 s RT60 the default reports about 30 m³ while 0.01 reports under 0.01 m³. Write 0.01 only when you want the floor.
Reading the result
| Field | Meaning |
|---|---|
rt60 | Estimated time for reverberation to decay by 60 dB. Larger values mean a more reverberant room; absent when no decay could be fitted. |
edt | Early decay time, fitted over the first 10 dB. Often tracks perceived reverberance more closely than full RT60; absent in blind mode or when not fitted. |
c50 | Clarity for speech. Higher values usually mean consonants and dialog are easier to understand; absent in blind mode or when not measurable. |
c80 | Clarity for music. Higher values indicate more direct/early energy relative to late reverberation; absent in blind mode or when not measurable. |
d50 | Definition, the fraction (0–1) of early energy in the first 50 ms; absent in blind mode or when not measurable. |
rt60Bands, edtBands, c50Bands, c80Bands | Per-band versions of the same measurements. A missing field means the measurement was not produced; a retained array uses NaN for a band that could not be fitted. Python uses snake_case names with camelCase aliases. |
confidence | Heuristic confidence from 0 to 1. Low values mean the recording did not contain a clean enough decay. |
isBlind / is_blind | Whether the result came from blind estimation rather than an impulse-response assumption. |
Blind analysis returns decay only
detectAcoustic(...) always runs the blind path, which estimates late decay only. JavaScript omits edt, c50, c80, d50, edtBands, c50Bands and c80Bands; Python returns None for the corresponding scalar fields and band arrays. In either mode, unmeasurable scalar readings are absent in JavaScript and None in Python. A retained per-band array keeps its length and uses NaN for bands that could not be fitted. Call analyzeImpulseResponse(...) on a clap, pop, or deconvolved sweep-derived IR whenever you need clarity numbers or a real EDT, and check that a scalar is present before formatting it in a UI.
What do RT60, EDT, C50/C80, and D50 measure?
These are standard room-acoustic numbers derived from how sound decays in a space after it stops.
- RT60 — seconds for the reverberation to fall by 60 dB; the headline "how reverberant" figure. A small room might be ~0.3 s, a cathedral several seconds.
- EDT (early decay time) — the decay rate measured from the first part of the tail, scaled to a 60 dB drop. It usually tracks the perceived liveliness of a room better than full RT60.
- C50 / C80 (clarity) — the ratio, in dB, of early energy (the first 50 ms or 80 ms) to the later reverberation. Higher means clearer and more direct. C50 is the reference for speech, C80 for music.
- D50 (definition) — the fraction (0–1) of total energy that arrives in the first 50 ms. Higher means a more direct, less washy sound.
Practical guidance
For reliable numbers, record a clean impulse response:
- keep the room quiet;
- avoid clipping;
- leave enough silence after the impulse;
- trim unrelated noise before analysis.
A blind estimate is useful for comparing recordings or warning that a take sounds too reverberant. Do not treat it as an architectural measurement.
Room simulation
Synthesizing a room impulse response from geometry, morphing a recording toward a target room, wall materials, the late-reverb controls and air absorption are on Room Simulation.
If you need live visual frames or BPM/key/chord estimates that update as audio arrives, use Realtime and Streaming. If you need song-level metadata, use JavaScript API or Python API.
Related
- Reverberation Time (RT60 and EDT) · Clarity and Definition (C50, C80, D50) — what the headline decay and clarity numbers mean
- Source Distance and DRR · Room Geometry and Volume — distance, the equivalent shoebox, and Sabine's volume/absorption trade
- Per-Band Decay and Absorption · Inverse Room Estimation — octave-band decay, and impulse-response vs blind estimation with the confidence score
- Spatial Room Scanner — run this whole pipeline locally as an interactive 3D scene
- Room Simulation — synthesize a room impulse response from geometry, or morph a recording toward a room
- API reference: JavaScript · Node.js · Python