def butter_lowpass(cutoff, fs, order=2):
"""
This function calculates the butterworth filter coefficients for a given cutoff frequency and order.
:param cutoff: Cutoff frequency as a proportion of the Nyquist frequency (Freq (Hz) / (Sample rate / 2))
:param fs: Sample rate of signal to be filtered
:param order: Filter order, defaults to second order filter, as required by timbral_metallic
:return: returns the coefficients of a Butterworth filter
"""
nyq = 0.5 * fs
normal_cutoff = cutoff / nyq
b, a = butter(order, normal_cutoff, btype='low', analog=False)
return b, a
评论列表
文章目录