portapack-mayhem/firmware/tools/fir_lpf.py

23 lines
407 B
Python
Raw Normal View History

2022-11-01 19:36:04 -04:00
#!/usr/bin/env python3
import math
m = 64 - 1
ft = 300.0 / 24000.0
taps = []
window = []
2022-10-29 18:00:26 -04:00
print(("Normalized ft = " + str(ft)))
for n in range(0, 64):
taps.append(math.sin(2 * math.pi * ft * (n - (m / 2.0))) / (math.pi * (n - (m / 2.0))))
for n in range(0, 64):
window.append(0.5 - 0.5 * math.cos(2 * math.pi * n / m))
for n in range(0, 64):
taps[n] = int(taps[n] * window[n] * 32768)
print(taps)