0
$\begingroup$

I'm creating an HTML that applies a low-pass Windowed Sinc filter with a window size of 8192 to white, pink, or Brownian noise. There are nine radio buttons, eight of which set a cutoff frequency and one which disables the filter.

I've got the noise generator working, with all three "colours" generating noise with no problem.

I've been looking for a way to implement a Windowed Sinc filter using the Blackman window in JavaScript. I've found one site that seemed to be pretty promising, but on that site, the event listeners are implemented and the processing itself is done (in a script called "dfilter-0.js") which is extremely large and messy. There are so many unnecessary functions and chains of functions that I can never figure out where anything is or what anything does.

My question is, could I get some help cleaning up the "dfilter-0.js" (none of the online tools I've found worked)? Or alternatively, how does one implement a low pass Windowed Sinc filter with the parameters (cutoff frequency, Blackman window size) and connect it to an AudioContext?

I've found an Audacity plugin that performs the filtering that I want, but it uses the Nyquist language. How would I implement that in JavaScript and HTML?

$\endgroup$
0
$\begingroup$

A FIR filter is just a "block" of coefficients, a vector, being convolved with your signal.

Hence, https://developer.mozilla.org/en-US/docs/Web/API/ConvolverNode is kind of audio filtering object you need to create and apply.

$\endgroup$
  • $\begingroup$ So, I have a function that calculates the impulse response for a Blackman window as an array of numbers. Can I just input that as the buffer for a ConvolverNode? $\endgroup$ – El Ectric Mar 14 at 3:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.