Skip to main content

IIR coefficients for A,B,C and ITU_R_468 weighting filters

Two modules which provide the zpk coefficients for the A,B,C and ITU_R_468 weighting filters. These can then be used by signal.lfilter to filter audio signals.

In contrast to other implementations which get the high frequency end completely wrong (because of the bilinear transform) here I have used the matched z-transform which aims to match 1:1 the analogue and digital frequency response.

The precision towards the Nyquist frequency can be increased by using a higher sampling rate but given that audio has such low energy over 10kHz there is probably not much point to it.

On the other hand lower sampling rates are possible for example 8kHz if only low frequency noise has been measured.

Installation

The preferred way to install is with pip / pip3:

pip install sound_weighting_filters

Usage

Import the module:

import ABC_weighting
import ITU_R_468_weighting

This has a single function:

get_zpk(curve='A', fs=False)
  • curve defines the weighting filter and can be ‘A’, ‘B’ or ‘C’.

  • fs sets the sampling rate of the digital system. Or False for an analogue filter.

and returns zeros, poles, gain of the filter.

For example:

z,p,k = ABC_weighting.get_zpk(fs = 48000)

The same applies to the ITU_R_468 module, for example:

z,p,k = ITU_R_468_weighting.get_zpk(fs = 48000)

Demo plots

Run:

python demo_ABC_weighting.py
python demo_ITU_R_468_weighting.py

Unit Tests

Both modules run unit tests if run as a main program. If the tests are run directly then they also plot the results:

python3 test_ABC_weighting.py
python3 test_ITU_R_468_weighting.py

Credits

Metadata

Release files for sound_weighting_filters 0.9.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sound_weighting_filters 0.9.3
File Size Uploaded
sound_weighting_filters-0.9.3.tar.gz 85.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sound_weighting_filters 0.9.3
File Interpreter ABI Platform
sound_weighting_filters-0.9.3-py3-none-any.whl Python 3 none any Details

Total release size: 91.9 kB

Release files / sound_weighting_filters-0.9.3.tar.gz

Download URL sound_weighting_filters-0.9.3.tar.gz
Size 85.4 kB
Tags Source
SHA-256 checksum
How to use checksums
4bff1aacab3bff552b416df306a2446d5164771d41731c11d47f89eb8a13b916
BLAKE2b-256 checksum
How to use checksums
79742eb5c764dbd3dbeaa8fec1d0f026299c9bb8fdc16a7d8104a54ad6c217a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/3.8

Release files / sound_weighting_filters-0.9.3-py3-none-any.whl

Download URL sound_weighting_filters-0.9.3-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
47c45463cc948a45f269ea3354441c036b061fd6decc6f80f8ee9a8563c79278
BLAKE2b-256 checksum
How to use checksums
90e4de0a0f4ee9c6bfc621874e734ea1b714fa00d3e91aa14aad68f0887f0fbc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/3.8

Release history Release notifications | RSS feed

This release

0.9.3 This release

2 release files

0.9.2

1 release file

0.9.1

1 release file

0.9.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page