music.band_pass¶
- music.band_pass(centre=0.1, bandwidth=0.05)[source]¶
A two-pole band pass, from the article’s
eq:passa-banda.With
RandKfromeq:varAux:a = [1 - K, 2(K - R)cos(2 pi f_c), R**2 - K]andb = [1, 2R cos(2 pi f_c), -R**2].- Parameters:
- centrescalar
The centre of the band, as a fraction of the sample rate.
- bandwidthscalar
The full width of the band between its 3 dB points, so they fall at
centre +/- bandwidth / 2. The article’s prose sayscentre +/- bandwidth; its coefficients give half that, measured across every bandwidth tried. See DISCREPANCIES.md.
- Returns:
- Raises:
ValueErrorIf centre or bandwidth is outside
(0, 0.5).
- Parameters:
- Return type:
tuple[NDArray[float64], NDArray[float64]]
See also
band_rejectthe same geometry, keeping what this one discards.
Notes
The article warns that these two filters amplify rather than attenuate when the centre is low and the band wide, and that at high centres they spread towards the bass rather than holding their shape. Neither is a defect in the coefficients; both are what a two-pole design does.
Examples
>>> a, b = band_pass(centre=0.1, bandwidth=0.02) >>> len(a), len(b) (3, 3)