Advertisement
tepples

Lanczos notch

Oct 29th, 2011
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.54 KB | None | 0 0
  1. #!/usr/bin/env python
  2. """
  3.  
  4. Lanczos dual-passband filter generator
  5. by Damian Yerrick
  6.  
  7. Bisqwit wanted help making the FIR filter for NTSC luma/chroma
  8. separation.  I'm using a crossover at 5/6 and 7/6 Fsc (3.0 and
  9. 4.2 MHz).
  10.  
  11. """
  12. from __future__ import division
  13. import math
  14.  
  15. def sinc(x):
  16.     pix = math.pi*x
  17.     return math.sin(pix)/pix if pix else 1
  18.  
  19. # A lowpass at 0 is sinc(x)
  20.  
  21. ls = [(sinc(x * 5/36) - sinc(x * 7/36) + sinc(x * 10/36))
  22.       * sinc(x/21)
  23.       for x in range(-20, 21)]
  24. print "\n".join("%7.4f" % el for el in ls)
  25.  
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement