Skip to main content

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

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sound_weighting_filters-0.9.3.tar.gz (85.4 kB view details)

Uploaded Source

Built Distribution

sound_weighting_filters-0.9.3-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file sound_weighting_filters-0.9.3.tar.gz.

File metadata

File hashes

Hashes for sound_weighting_filters-0.9.3.tar.gz
Algorithm Hash digest
SHA256 4bff1aacab3bff552b416df306a2446d5164771d41731c11d47f89eb8a13b916
MD5 8bb97724a79a225aad649a147d05a9d4
BLAKE2b-256 79742eb5c764dbd3dbeaa8fec1d0f026299c9bb8fdc16a7d8104a54ad6c217a9

See more details on using hashes here.

File details

Details for the file sound_weighting_filters-0.9.3-py3-none-any.whl.

File metadata

File hashes

Hashes for sound_weighting_filters-0.9.3-py3-none-any.whl
Algorithm Hash digest
SHA256 47c45463cc948a45f269ea3354441c036b061fd6decc6f80f8ee9a8563c79278
MD5 1c4186cdea318fce413997d9ef5d3182
BLAKE2b-256 90e4de0a0f4ee9c6bfc621874e734ea1b714fa00d3e91aa14aad68f0887f0fbc

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page