Skip to content

[FEATURE] add pytta.iec61672 with the sound level meter measures - #72

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

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

Conversation

@aguirreSL

@aguirreSL aguirreSL commented Oct 31, 2026 •

Copy link
Copy Markdown

Adds the module pytta.iec61672 with the measures of a sound level meter, IEC 61672-1:2013:

  1. weighting_filter(kind, fs): second-order sections of the frequency weightings A and C from the pole frequencies of Annex E (computed from E.2.4 and E.3.4, which give 20.60, 107.7, 737.9 and 12 194 Hz), through the bilinear transform and normalized to 0 dB at 1 kHz. 'Z' applies no filter.
  2. time_weighted_level(signalObj, weighting='A', time='F'): exponential time weighting with the time constants of 5.8.1 (F 0.125 s, S 1 s), at every sample.
  3. leq, sel, lmax and lpeak (C-weighted by default), one value per channel.
  4. percentile_levels(signalObj, percents=(10, 50, 90)): the time-weighted level exceeded during N % of the signal.

Levels are in dB re the dBRef of each channel, which is 20 µPa for a channel in pascal.

The tests in tests/test_iec61672.py use the values of the standard:

  1. The A and C responses at the base-ten frequencies of Table 3, from 10 Hz to 16 kHz at 48 kHz, stay within the class 1 acceptance limits. The bilinear transform lowers the response near Nyquist (about -1.2 dB at 10 kHz and -6.4 dB at 16 kHz for A at 48 kHz), which those limits allow.
  2. The response to single 4 kHz tonebursts from 1 s to 2 ms follows Table 4 for time weighting F within the class 1 limits, and the sound exposure level of each burst is 10 lg(Tb / 1 s).
  3. A steady 1 kHz tone of 1 Pa rms gives Leq and Lmax of 94.0 dB, an SEL over 10 s of 104.0 dB and an LCpeak of 97.0 dB.
  4. 30 s at 60 dB followed by 30 s at 80 dB give L10 = 80 dB and L90 = 60 dB.

Checked with Python 3.12, numpy 1.26 and scipy 1.17. The existing tests behave as on development: the 7 failures there (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

Frequency weightings A, C and Z from the poles of Annex E of
IEC 61672-1:2013, time weightings F and S, and Leq, SEL, Lmax, Lpeak and
percentile levels L_N, by channel, in dB re the dBRef of each channel.

Tests check the A and C responses against Table 3 within the class 1
limits, the 4 kHz toneburst responses of Table 4 and the sound exposure
of each burst, the levels of a steady 94 dB tone, and percentile levels.

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