17 Creates SOS filter for pink noise. The filter has a flat response below
18 fstart, and rolls of close to Nyquist, or flattens out above fend. The
19 ripple (i.e.) closeness the filter rolls of depends on the number of
20 sections. The default, N=3 results in
23 fs: Sampling frequency [Hz]
24 fstart: Frequency of first pole of the filter
25 fend: Frequency of last pole of the filter, if not given, set to 5/6th
26 of the Nyquist frequency.
27 N: Number of sections.
30 sos: Array of digital filter coefficients
38 fpoles = np.array([fstart*(fend/fstart)**(n/(order-1))
39 for n
in range(order)])
42 fzeros = np.sqrt(fpoles[1:]*fpoles[:-1])
44 poles = -2*np.pi*fpoles
45 zeros = -2*np.pi*fzeros
47 z,p,k = bilinear_zpk(zeros, poles,1, fs=fs)
52 Omg, h = freqz_zpk(z, p, k, worN = int(fs/2), fs=fs)
53 h_fstart = np.abs(h[int(fstart)])