Expanded Octave and ThirdOctave filter banks to lower frequencies
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Casper Jansen 2023-01-27 14:26:44 +01:00
parent 00fbcca097
commit 4fde79b64b

View File

@ -172,7 +172,6 @@ class FilterBankDesigner:
Args:
x: Band designator
"""
SOS_ORDER = 5
fs = self.fs
@ -197,6 +196,7 @@ class FilterBankDesigner:
(SOS_ORDER-highpass.shape[0], 1))
return np.vstack((highpass, allpass)) # same shape=(SOS_ORDER, 6)
# Regular bands
return butter(SOS_ORDER, [fl_n, fu_n], output='sos', btype='band')
def firFreqResponse(self, x, freq):
@ -341,7 +341,7 @@ class OctaveBankDesigner(FilterBankDesigner):
@property
def xs(self):
"""All possible band designators for an octave band filter."""
return list(range(-6, 5))
return list(range(-7, 5))
def band_limits(self, x, filter_class=0):
"""Returns the octave band filter limits for filter designator x.
@ -404,7 +404,8 @@ class OctaveBankDesigner(FilterBankDesigner):
-3: '125',
-4: '63',
-5: '31.5',
-6: '16'
-6: '16',
-7: '8'
}
assert len(nominals) == len(self.xs)
return nominals[x]
@ -487,9 +488,9 @@ class ThirdOctaveBankDesigner(FilterBankDesigner):
fs: Sampling frequency in [Hz] - can be None
"""
super().__init__(fs)
self.xs = list(range(-16, 14))
self.xs = list(range(-19, 14))
# Text corresponding to the nominal frequency
self._nominal_txt = [
self._nominal_txt = ['12.5', '16', '20',
'25', '31.5', '40', '50', '63', '80', '100', '125', '160', '200',
'250', '315', '400', '500', '630', '800', '1k', '1.25k', '1.6k',
'2k', '2.5k', '3.15k', '4k', '5k', '6.3k', '8k', '10k', '12.5k',