Advertisement
Guest User

Untitled

a guest
Nov 30th, 2018
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.47 KB | None | 0 0
  1.     def _coeffsBA(f, samplerate):
  2.         """ return 12db/oct low pass biquad coeffs for given frequency """
  3.         w0 = 2 * pi * f / samplerate
  4.         alpha = sin(w0) / 2 / 0.7071067811865476 # Butterworth characteristic, Q = 0.707...
  5.         cs = cos(w0)
  6.         norm = 1 / (1 + alpha)
  7.         b0 = (1 - cs) / 2 * norm
  8.         b1 = (1 - cs) * norm
  9.         b2 = b0
  10.         a1 = -2 * cs * norm
  11.         a2 = (1 - alpha) * norm
  12.         return (b0, b1, b2), (1, a1, a2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement