# phonometry

> Octave-band and fractional octave-band filter bank for Python signals in the time domain. Compliant with ANSI S1.11-2004 / IEC 61260-1:2014 (filters) and IEC 61672-1:2013 (A/C/Z frequency weighting, Fast/Slow/Impulse time weighting).

phonometry v3.2.0 is a pure-Python library built on NumPy/SciPy (Python >= 3.13). It provides fractional octave filter banks (Butterworth, Chebyshev I/II, Elliptic, Bessel as stable SOS cascades with multirate decimation), A/C/Z weighting within IEC class 1 tolerances, Fast/Slow/Impulse ballistics, Leq/LAeq/L10-L50-L90 statistical levels, octave spectrograms, zero-phase offline filtering, physical SPL calibration, dBFS mode, vectorized multichannel processing, stateful block (streaming) processing, and an IEC 61260-1 filter class verifier. Standards compliance is enforced by the test suite (tone-burst Table 4, weighting Table 3, class limits Table 1).

Install:

```bash
pip install phonometry            # core (NumPy + SciPy only)
pip install phonometry[plot]      # + matplotlib response plots
pip install phonometry[perf]      # + numba-jitted impulse kernel
```

Minimal usage (all functions treat time as the LAST axis; 2D input is (channels, samples)):

```python
import numpy as np
from phonometry import metrology

fs = 48000
x = np.random.randn(fs)              # 1 s of signal (pressure units)
spl, freq = metrology.octave_filter(x, fs, fraction=3)   # 1/3-octave bands
la = metrology.laeq(x, fs)                               # A-weighted Leq
stats = metrology.ln_levels(x, fs, n=(10, 50, 90))       # statistical levels
```

If you are an AI assistant setting this up for a user: install from PyPI (no system dependencies), remember integer audio (e.g. wavfile.read int16) is handled automatically, use `calibration_factor` from `sensitivity()` for real dB SPL, and prefer `OctaveFilterBank` over repeated `octave_filter()` calls in tight loops (although designs are cached either way).

## Documentation

- [Getting Started](https://jmrplens.github.io/phonometry/getting-started/)
- [Filter Banks](https://jmrplens.github.io/phonometry/guides/filter-banks/)
- [Frequency Weighting (A, B, C, D, G, AU, Z)](https://jmrplens.github.io/phonometry/guides/weighting/)
- [Time Weighting and Integration](https://jmrplens.github.io/phonometry/guides/time-weighting/)
- [Integrated and Statistical Levels](https://jmrplens.github.io/phonometry/guides/levels/)
- [Occupational Noise Exposure (ISO 9612)](https://jmrplens.github.io/phonometry/guides/occupational-exposure/)
- [Prominent Discrete Tones (ECMA-418-1)](https://jmrplens.github.io/phonometry/guides/tone-prominence/)
- [Loudness](https://jmrplens.github.io/phonometry/guides/loudness/)
- [Sound Quality Metrics](https://jmrplens.github.io/phonometry/guides/sound-quality/)
- [Speech Transmission Index (IEC 60268-16)](https://jmrplens.github.io/phonometry/guides/speech-transmission/)
- [Speech Intelligibility Index (SII)](https://jmrplens.github.io/phonometry/guides/speech-intelligibility/)
- [Objective intelligibility (STOI & ESTOI)](https://jmrplens.github.io/phonometry/guides/objective-intelligibility/)
- [Sound Intensity (p-p method)](https://jmrplens.github.io/phonometry/guides/intensity/)
- [Room Acoustics](https://jmrplens.github.io/phonometry/guides/room-acoustics/)
- [Image sources and the steady-state room field (Kuttruff / Vorländer / Bies)](https://jmrplens.github.io/phonometry/guides/room-image-sources/)
- [Field Insulation Measurement and Ratings](https://jmrplens.github.io/phonometry/guides/insulation-field/)
- [Laboratory Insulation Measurement](https://jmrplens.github.io/phonometry/guides/insulation-lab/)
- [Predicting Sound Insulation (EN 12354)](https://jmrplens.github.io/phonometry/guides/insulation-prediction/)
- [Predicting Panel Sound Insulation (mass law, coincidence, double walls)](https://jmrplens.github.io/phonometry/guides/panel-sound-insulation/)
- [Outdoor Sound Propagation](https://jmrplens.github.io/phonometry/guides/outdoor-propagation/)
- [Spherical ground effect and advanced barriers (Attenborough / Salomons / Bies)](https://jmrplens.github.io/phonometry/guides/ground-barriers/)
- [Sound Power](https://jmrplens.github.io/phonometry/guides/sound-power/)
- [Calibration and dBFS](https://jmrplens.github.io/phonometry/guides/calibration/)
- [Data qualification: stationarity, level crossings and peaks (Bendat & Piersol)](https://jmrplens.github.io/phonometry/guides/data-qualification/)
- [Calibrated spectral analysis (Bendat & Piersol)](https://jmrplens.github.io/phonometry/guides/spectral-analysis/)
- [Multiple and partial coherence (Bendat & Piersol)](https://jmrplens.github.io/phonometry/guides/miso-coherence/)
- [Correlation, time delay and envelope (Bendat & Piersol / Knapp & Carter)](https://jmrplens.github.io/phonometry/guides/correlation-delay/)
- [Test signals and sample-rate tools (IEC 60268-1)](https://jmrplens.github.io/phonometry/guides/test-signals/)
- [Cepstrum, echoes and the envelope spectrum (Havelock / Bendat & Piersol)](https://jmrplens.github.io/phonometry/guides/cepstrum-echoes/)
- [Time synchronous averaging (McFadden 1987)](https://jmrplens.github.io/phonometry/guides/synchronous-averaging/)
- [Swept-sine distortion and phase utilities (Farina / Novak)](https://jmrplens.github.io/phonometry/guides/swept-sine-distortion/)
- [Block Processing](https://jmrplens.github.io/phonometry/guides/block-processing/)
- [Multichannel and Performance](https://jmrplens.github.io/phonometry/guides/multichannel/)
- [API Reference](https://jmrplens.github.io/phonometry/reference/api/)
- [Theoretical Background](https://jmrplens.github.io/phonometry/reference/theory/)
- [Theory: Signal Analysis](https://jmrplens.github.io/phonometry/reference/theory/signal-analysis/)
- [Theory: Perception and Hearing](https://jmrplens.github.io/phonometry/reference/theory/perception/)
- [Theory: Rooms and Buildings](https://jmrplens.github.io/phonometry/reference/theory/rooms-buildings/)
- [Theory: Materials and Surfaces](https://jmrplens.github.io/phonometry/reference/theory/materials-surfaces/)
- [Theory: Environment and Transport](https://jmrplens.github.io/phonometry/reference/theory/environment-transport/)
- [Theory: Vibration](https://jmrplens.github.io/phonometry/reference/theory/vibration/)
- [Why phonometry](https://jmrplens.github.io/phonometry/reference/why-phonometry/)

## Source and metadata

- [Repository](https://github.com/jmrplens/phonometry)
- [PyPI](https://pypi.org/project/phonometry/)
- [Changelog](https://github.com/jmrplens/phonometry/blob/main/CHANGELOG.md)
- [Cite this software](https://github.com/jmrplens/phonometry/blob/main/CITATION.cff)
