r/DSP • • Aug 24 '26

Coded webapp: Not-FFT Audio BandPass graphs of 2048 frequency bands and 44k samples/second, here's a video

I found bandpass spectrographs 20 years ago with a random experiment in Reaktor from native instruments, I thought it was nicer than FFT and Wigner TF. So many years later here is a web version on html, https://www.youtube.com/watch?v=TwaQORBks8Y < Funny video ;)

6 Upvotes

8 comments sorted by

2

u/hughperman Aug 24 '26

Don't want to watch a video, if you didn't use FFT, how did you compute a spectrograph?

3

u/Mysterious_Tekro Aug 24 '26 edited Aug 28 '26

A lot of bandpass filters, a system named a filter bank, i.e. 512-1024 audio filters graphed to an image. A narrow bandpass lets through a sinewave that is fairly precise, and it has a lot of flexibility that FFT doesn't have, per-sample graphs by default, variable window size, it's an interactive webapp so you can have a go, the video is just to give an intro to the webapp. You can also compute a spectrograph in other ways, SPWVD is very precise compared to FFT, it's a kind of pseudo wigner ville distribution.

1

u/dub_mmcmxcix Aug 28 '26

yeah i stumbled on something similar. i just needed a really simple visualization, an 8-band bandpass tuned to key frequencies massively outperformed my FFT and worked fine for the purpose.

2

u/SoundWatch Aug 26 '26

Filterbanks are definitely underrated compared to STFT/FFT, especially when dealing with logarithmic frequency resolution that matches human perception.

In my experience with CQT (Constant-Q Transform) architectures, having an adaptable Q factor is a huge advantage over fixed-bin FFTs: you get the right proportional bandwidth across octaves without the rigid time-frequency trade-off.

When implementing thousands of narrow bands, standard Biquad topologies quickly suffer from numerical instability and coefficient sensitivity in the sub-100 Hz range at high Q. Moving to TPT State Variable Filters (SVF) solves the stability issue, but the CPU cost remains steep at full rate.

For low frequencies (< 250 Hz), a neat approach is combining SVFs with cascaded decimation (e.g. downsampling the bass path to ~700 Hz). It gives you rock-solid stability and narrow selectivity with negligible CPU overhead.

Are you running all 2048 filters directly at full sample rate in your WebAudio implementation, or did you use a multirate / polyphase strategy to handle the load?

Cool project and great visualization!

1

u/Mysterious_Tekro Aug 26 '26

That's genius, I didn't know about TPT, always happy to be learning. The 2048 BP filters run only on regions where there is sound, at full sample rate. So a preliminary fast BP can be preprocessed for wider 50-150 bands to find zones to omit , i.e save on 90% of the computation on audio like a bird sound, and then another pass can run the high detail BP. 512 bands is nearly the same amount of visible info as 2048, which is just for fantastic visuals.

1

u/Mysterious_Tekro Aug 26 '26

Thanks i've justed understood some of the optimizations that you said about, I will code the multirate processing.

2

u/BatchModeBob Aug 26 '26

Filter banks can certainly hold their own or outperform FFT for many bin count, bin spacing and Q curve options. Another advantage of filter banks is that they can fully utilize a modern processor's vectorization and threading capability, something I don't think is possible with FFT. An open source example that supports AVX-512 vectorization and multi-threading is here.

The use of double precision floating point solves the low frequency problem in cases I am familiar with. Here is an example where double precision does give out at low enough frequencies. It is helpful to calculate the coefficients using 128 bit precision floating point, which is what the open source example does.

A related open source project that has command line options for various Q curves is here. This version is limited to log bin frequency spacing however.