music.high_pass

music.high_pass(cutoff=0.1)[source]

A one-pole high pass, from the article’s equation eq:passa-altas.

x = exp(-2 pi f_c), then a_0 = (x + 1) / 2, a_1 = -a_0 and b_1 = x.

Parameters:
cutoffscalar

The cutoff as a fraction of the sample rate, in (0, 0.5): where the filter is 3 dB down, while the cutoff is small. As it grows the 3 dB point drifts below it, to 0.094 for a cutoff of 0.1 and 0.1617 for 0.2, and it never reaches 0.2363, however high the cutoff. See DISCREPANCIES.md.

Returns:
a, bndarray

The feedforward and feedback coefficients, for iir().

Raises:
ValueError

If cutoff is outside (0, 0.5), which is where a fraction of the sample rate has a filter to describe.

Parameters:

cutoff (float)

Return type:

tuple[NDArray[float64], NDArray[float64]]

See also

low_pass

the complementary filter, from the same pole.

Examples

>>> a, b = high_pass(cutoff=0.05)
>>> [round(float(v), 6) for v in a]
[0.865201, -0.865201]