Repository navigation
Conversation
Adds to pytta.functions the filters of the ITA-Toolbox ita_butterFR, ita_liriFR, ita_filter_LiRi, ita_filter_notch and ita_filter_peak: butterworth (low-pass, high-pass or band-pass, Butterworth or Linkwitz-Riley, optionally zero phase), notch (the biquad of the Audio EQ Cookbook) and peak_eq (the bilinear bell filter of ita_filter_peak). All act on the spectrum of the signal, as in the ITA-Toolbox. The response is evaluated at the FFT bins (ita_butterFR samples it with freqz(Hd, nBins), from 0 to pi without pi). Tests check that the Butterworth filters are 3 dB down at the cut-off and fall as 1 / (1 + (f / fc)^(2n)), that a Linkwitz-Riley pair is 6 dB down at the crossover and sums to a flat magnitude, the zero and the gain of the notch and peak filters, and the rejection of invalid input. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds to
pytta.functionsthe filters of the ITA-Toolboxita_butterFR,ita_liriFR,ita_filter_LiRi,ita_filter_notchandita_filter_peak:butterworth(signal, cutoff, btype='low', order=8, linkwitz_riley=False, zero_phase=False): a low-pass, high-pass or band-pass Butterworth filter, or a Linkwitz-Riley filter (a Butterworth filter of half the order, squared), optionally keeping only the magnitude.notch(signal, fc, Q=2): the second-order notch of the Audio EQ Cookbook of R. Bristow-Johnson, asita_filter_notch.peak_eq(signal, fc, gain, Q=2): the second-order bell filter ofita_filter_peak(bilinear design with K = tan(π fc / fs) and V = 10^(gain / 20)).As in the ITA-Toolbox, the filters act on the spectrum of the signal, so they are circular. The response is evaluated at the FFT bins of the signal.
ita_butterFRsamples it with MATLABfreqz(Hd, nBins), which spaces nBins points from 0 to π without π, so its bins sit slightly off the FFT bins. For that reason the tests check the rules of each filter and do not compare with ITA.ita_make_filterandita_filter_pdiare left out. They wrap the general fractional octave filter of the ITA-Toolbox, whichpytta.OctFiltercovers.The tests in
tests/test_filters.pyprint the measured values:Checked with Python 3.12, numpy 1.26 and scipy 1.17. The 7 failures of
development(3 intest_h5io.py, 4 intest_pyttasave.py) are the same with and without this change.Co-Authored-By: Claude Fable 5.1 noreply@anthropic.com