Improved handling of EQ when fs=44.1k a bit, including suggestion to use 48k
This commit is contained in:
parent
24b9a24b04
commit
eedd6d83b4
@ -85,8 +85,8 @@ class FilterBankDesigner:
|
||||
if self.nominal_txt(x) == nom_txt:
|
||||
return x
|
||||
raise ValueError(
|
||||
f'Could not find a nominal frequency corresponding to {nom_txt}. Hint: use \'5k\' instead of \'5000\'.'
|
||||
)
|
||||
f'Could not find a nominal frequency corresponding to {nom_txt}. '
|
||||
'Hint: use \'5k\' instead of \'5000\'.')
|
||||
|
||||
def sanitize_input(self, input_):
|
||||
if isinstance(input_, int):
|
||||
@ -254,8 +254,8 @@ class FilterBankDesigner:
|
||||
for i, x in enumerate(range(xl, xu + 1)):
|
||||
fl = self.fl(x)
|
||||
fu = self.fu(x)
|
||||
# Find the indices in the frequency array which correspond to the
|
||||
# frequency band x
|
||||
# Find the indices in the frequency array which correspond to
|
||||
# the frequency band x
|
||||
if x != xu:
|
||||
indices_cur = np.where((freq >= fl) & (freq < fu))
|
||||
else:
|
||||
@ -337,13 +337,13 @@ class OctaveBankDesigner(FilterBankDesigner):
|
||||
|
||||
Args:
|
||||
x: Filter offset power from the reference frequency of 1000 Hz.
|
||||
filter_class: Either 0 or 1, defines the tolerances on the frequency
|
||||
response
|
||||
filter_class: Either 0 or 1, defines the tolerances on the
|
||||
frequency response
|
||||
|
||||
Returns:
|
||||
freq, llim, ulim: Tuple of Numpy arrays containing the frequencies of
|
||||
the corner points of the filter frequency response limits, lower limits
|
||||
in *deciBell*, upper limits in *deciBell*, respectively.
|
||||
freq, llim, ulim: Tuple of Numpy arrays containing the frequencies
|
||||
of the corner points of the filter frequency response limits, lower
|
||||
limits in *deciBell*, upper limits in *deciBell*, respectively.
|
||||
"""
|
||||
b = 1
|
||||
|
||||
@ -450,8 +450,8 @@ class OctaveBankDesigner(FilterBankDesigner):
|
||||
if int(self.fs) in [44100, 48000, 96000]:
|
||||
return 1.0
|
||||
else:
|
||||
raise ValueError('Unimplemented sampling frequency for SOS'
|
||||
'filter design')
|
||||
raise ValueError('Unimplemented sampling frequency \'{} Hz\' for '
|
||||
'SOS filter design. Try 48 kHz.'.format(self.fs))
|
||||
|
||||
def sosFac_u(self, x):
|
||||
"""Right side percentage of change in cut-on frequency for designing
|
||||
@ -463,8 +463,8 @@ class OctaveBankDesigner(FilterBankDesigner):
|
||||
if int(self.fs) in [44100, 48000, 96000]:
|
||||
return 1.0
|
||||
else:
|
||||
raise ValueError('Unimplemented sampling frequency for SOS'
|
||||
'filter design')
|
||||
raise ValueError('Unimplemented sampling frequency \'{} Hz\' for '
|
||||
'SOS filter design. Try 48 kHz.'.format(self.fs))
|
||||
|
||||
|
||||
class ThirdOctaveBankDesigner(FilterBankDesigner):
|
||||
@ -511,13 +511,13 @@ class ThirdOctaveBankDesigner(FilterBankDesigner):
|
||||
|
||||
Args:
|
||||
x: Filter offset power from the reference frequency of 1000 Hz.
|
||||
filter_class: Either 0 or 1, defines the tolerances on the frequency
|
||||
response
|
||||
filter_class: Either 0 or 1, defines the tolerances on the
|
||||
frequency response
|
||||
|
||||
Returns:
|
||||
freq, llim, ulim: Tuple of Numpy arrays containing the frequencies of
|
||||
the corner points of the filter frequency response limits, lower limits
|
||||
in *deciBell*, upper limits in *deciBell*, respectively.
|
||||
freq, llim, ulim: Tuple of Numpy arrays containing the frequencies
|
||||
of the corner points of the filter frequency response limits, lower
|
||||
limits in *deciBell*, upper limits in *deciBell*, respectively.
|
||||
"""
|
||||
|
||||
fm = self.G**(x / self.b) * self.fr
|
||||
@ -605,16 +605,16 @@ class ThirdOctaveBankDesigner(FilterBankDesigner):
|
||||
# Idea: correct for frequency warping:
|
||||
if np.isclose(self.fs, 48000):
|
||||
return 1.00
|
||||
elif np.isclose(self.fs, 41000):
|
||||
warnings.warn(
|
||||
f'Frequency {self.fs} might not result in correct filters')
|
||||
|
||||
elif np.isclose(self.fs, 44100):
|
||||
warnings.warn(f'Sampling frequency {self.fs} Hz might result in '
|
||||
'incorrect filters')
|
||||
return 1.00
|
||||
elif np.isclose(self.fs, 32768):
|
||||
return 1.00
|
||||
else:
|
||||
raise ValueError('Unimplemented sampling frequency for SOS'
|
||||
'filter design')
|
||||
raise ValueError('Unimplemented sampling frequency \'{} Hz\' for '
|
||||
'SOS filter design. Try 48 kHz.'.format(self.fs))
|
||||
|
||||
def sosFac_u(self, x):
|
||||
"""Right side percentage of change in cut-on frequency for designing
|
||||
the filter."""
|
||||
@ -623,5 +623,5 @@ class ThirdOctaveBankDesigner(FilterBankDesigner):
|
||||
elif np.isclose(self.fs, 32768):
|
||||
return 1.00
|
||||
else:
|
||||
raise ValueError('Unimplemented sampling frequency for SOS'
|
||||
'filter design')
|
||||
raise ValueError('Unimplemented sampling frequency \'{} Hz\' for '
|
||||
'SOS filter design. Try 48 kHz.'.format(self.fs))
|
||||
|
Loading…
Reference in New Issue
Block a user