lupy.filters¶
- class lupy.filters.Coeff(b: ndarray[tuple[int], dtype[float64]], a: ndarray[tuple[int], dtype[float64]], sample_rate: int = 48000, _sos: ndarray[tuple[int, Literal[6]], dtype[float64]] | None = None)[source]¶
Bases:
objectDigital filter coefficients
- classmethod from_sos(sos: ndarray[tuple[int, Literal[6]], dtype[float64]], sample_rate: int = 48000) Self[source]¶
Create a
Coeffinstance from second-order sectionsThis is the inverse of
sosproperty.
- property sos: ndarray[tuple[int, Literal[6]], dtype[float64]]¶
Array of second-order sections calculated from the filter’s transfer function form
- lupy.filters.HS_COEFF = Coeff(b=array([ 1.53512486, -2.69169619, 1.19839281]), a=array([ 1. , -1.69065929, 0.73248077]), sample_rate=48000, _sos=None)¶
Stage 1 (high-shelf) of the pre-filter defined in BS 1770 table 1
- lupy.filters.HP_COEFF = Coeff(b=array([ 1., -2., 1.]), a=array([ 1. , -1.99004745, 0.99007225]), sample_rate=48000, _sos=None)¶
Stage 2 (high-pass) of the pre-filter defined in BS 1770 table 2
- class lupy.filters.BaseFilter(coeff: T, num_channels: NumChannelsT)[source]¶
Bases:
Generic[T,NumChannelsT],ABC- coeff: T¶
The filter coefficients
- num_channels: NumChannelsT¶
Number of audio channels to filter
- class lupy.filters.TruePeakFilter(num_channels: NumChannelsT, upsample_factor: int = 4)[source]¶
Bases:
BaseFilter[ndarray[tuple[int],dtype[float64]],NumChannelsT]Oversampling filter with interpolating FIR window
An
upsample_factorof 4 is recommended for sample rates below 88.2 kHz, while a factor of 2 has proven to be sufficient for sample rates of 88.2 kHz and above.
- class lupy.filters.Filter(coeff: Coeff, num_channels: NumChannelsT)[source]¶
Bases:
BaseFilter[Coeff,NumChannelsT]Multi-channel filter that tracks the filter conditions between calls
The filter (defined by
coeff) is applied by calling aFilterinstance directly.
- class lupy.filters.FilterGroup(*coeff: Coeff, num_channels: NumChannelsT)[source]¶
Bases:
Generic[NumChannelsT]Apply multiple
filtersin series- Parameters:
*coeff (Coeff) – The
coefficientsto construct eachFilternum_channels (NumChannelsT) – Number of channels to filter. This will also be set on the constructed
filters
- num_channels: NumChannelsT¶
Number of audio channels to filter