You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ulab.numpy: implement sinc for creating audio filters
This is useful for generating FIR filters using code snippets generated at
https://fiiir.com/ (at least those with a rectangular window type; other
window types need additional functions but we can revisit it later if needed)
I think this will come in handy for folks who are using the advanced
features of our audio synthesizer module, synthio.
e.g., the following block now gives highly similar results on ulab
or numpy:
```py
try:
import numpy as np
except:
from ulab import numpy as np
# Example code, computes the coefficients of a low-pass windowed-sinc filter.
# Configuration.
fS = 48000 # Sampling rate.
fL = 4000 # Cutoff frequency.
N = 23 # Filter length, must be odd.
# Compute sinc filter.
h = np.sinc(2 * fL / fS * (np.arange(N) - (N - 1) / 2))
# Normalize to get unity gain.
h /= np.sum(h)
# Applying the filter to a signal s can be as simple as writing
# s = np.convolve(s, h)
0 commit comments