Advertisement
Guest User

Untitled

a guest
May 28th, 2017
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. def filter(y, sr):
  2. low_stop = 60 # Hz
  3. low_pass = 80
  4. high_pass = 1400
  5. high_stop = 1600
  6. filter_order = 1001
  7.  
  8. # High-pass filter
  9. nyquist_rate = sr / 2.
  10. desired = (0, 0, 1, 1, 0, 0)
  11. bands = (0, low_stop, low_pass, high_pass, high_stop, nyquist_rate)
  12. filter_coefs = signal.firls(filter_order, bands, desired, nyq=nyquist_rate)
  13.  
  14. # Apply high-pass filter
  15. filtered_audio = signal.filtfilt(filter_coefs, [1], y)
  16.  
  17. return filtered_audio
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement