Acoustic impulse response measurement using logarithmic sweep signals.
Plays a logarithmic sweep through a JACK output, captures the response on a JACK input, and deconvolves it into an impulse response. Works with native JACK and with PipeWire's JACK compatibility layer.
There is no pip package yet — just clone this repository and use the modules directly:
git clone https://github.com/mpollow/measurement.git
cd measurement
pip install -r requirements.txtYou also need a running JACK server (or PipeWire with JACK support) and the
zita_jacktools package available to Python.
from measurement import Measurement
# Native JACK: an int is shorthand for the system: ports
m = Measurement(output=[0], input=[0]) # system:playback_0 → system:capture_0
m.run()
m.pf # plot frequency response (property, no parentheses)
m.pt # plot impulse response over time
m.plot_freq("My Title")
m.save("room") # float32 WAV + JSON sidecar with full config
m2 = Measurement.from_file("room")Ports are given from the measurement system's perspective: output is the
played sweep (speaker/amp), input is the captured response (mic/line in). An
int is shorthand for system:playback_N / system:capture_N; a string is a
full JACK port path (e.g. 'USB_Audio:capture_0').
The int shorthand assumes native JACK, where the soundcard is exposed as
system. Under PipeWire's JACK layer there is no system device — each card
gets its own name, so pass the full port path as a string instead:
# PipeWire exposes ALSA cards with names like
# 'alsa_output.pci-0000_00_1f.3.analog-stereo' and channel-labelled ports
m = Measurement(
output='alsa_output.pci-0000_00_1f.3.analog-stereo:playback_FL',
input='alsa_input.usb-Focusrite_Scarlett_2i2:capture_AUX0',
)You don't have to memorize those names: browse the live ports with the
TAB-completable m.output_to and m.input_from namespaces
(m.output_to.<TAB>, m.input_from.<TAB>), which work the same for JACK and
PipeWire.
See the module docstrings for the full API (latency calibration, presweeps, input calibration, multi-channel and multi-device setups, CAF/W64/NPY formats).
measurement.py— theMeasurementclass (main interface).jackbackend.py— JACK audio I/O viazita_jacktools.logsweep.py— log sweep + inverse filter generation (GPL v3, Fons Adriaensen).
The entire project is licensed under the GNU General Public License v3.0 — see
the LICENSE file. logsweep.py is GPL v3 from its original author,
Fons Adriaensen.