DEV Community

Terry Beer
Terry Beer

Posted on

I built a browser-based spectrum analyzer because I wanted something simpler

A while ago, I just wanted to do something simple: drop in an audio file, see the frequency spectrum, find suspicious peaks, and move on.
But most tools I found were either ๐Ÿ–ฅ๏ธ full desktop apps, ๐Ÿงฑ more complicated than I needed, โ˜๏ธ uploading audio to a server, or just felt a little outdated.

So I started wondering: why can't this just run entirely in the browser?
That question turned into Online Spectrum Analyzer: ๐Ÿ‘‰ https://onlinespectrumanalyzer.com

๐Ÿ”’ Keep the audio local

The main idea was simple: your audio shouldn't need to leave your device just to calculate an FFT. Modern browsers already have the Web Audio API, so the whole flow can stay client-side: audio file โ†’ decode locally โ†’ analyze โ†’ visualize.
No account. No mandatory backend upload. I also added ๐ŸŽ™๏ธ microphone input, so you can inspect live audio directly.

๐Ÿ“Š The FFT was the easy part

Getting frequency data wasn't really the hardest part. Making it readable was.I spent more time than expected tweaking FFT size, smoothing, frequency scaling, peak detection, low-frequency visibility, and rendering performance.A raw FFT graph can look technical while still being surprisingly hard to interpret. I wanted someone looking for a 50/60 Hz hum to be able to spot it without first studying DSP.

๐ŸŒˆ Then I added a spectrogram

This became one of my favorite parts. A spectrum shows what frequencies exist right now. A spectrogram shows how frequencies change over time.
That makes things like electrical hum, background noise, sudden transients, high-frequency tones, and strange sections of audio much easier to spot visually.
Sometimes a problem is easier to see than to hear.

๐Ÿคฏ The browser is surprisingly capable

This project reminded me how much signal processing can now happen directly in the browser. You already get ๐ŸŽต audio decoding, ๐ŸŽ™๏ธ microphone access, ๐Ÿ“ˆ real-time analysis, ๐Ÿงฎ FFT data, ๐Ÿ–ผ๏ธ canvas visualization, and pretty decent client-side performance.
A few years ago, I probably would've built this as upload โ†’ server โ†’ process โ†’ return result. For this kind of tool, that would actually make the experience worse.

๐Ÿ› ๏ธ What it does now

Right now it supports:

๐ŸŽง audio file analysis
๐ŸŽ™๏ธ live microphone input
๐Ÿ“Š real-time frequency spectrum
๐Ÿ“ peak frequency detection
๐ŸŒˆ spectrogram visualization
๐Ÿ”’ local browser-side processing

I'm still improving it. One direction I'm interested in is making it more useful for practical audio debugging: hum, noise, clipping, resonances, strange tones, recording issues, etc. Without turning it into a giant DAW.
If you work with audio, Web Audio, music production, podcasting, or browser DSP, I'd be interested to know what you normally look for in a spectrum analyzer.

๐Ÿ‘‰ Try it here: https://onlinespectrumanalyzer.com
Feedback is welcome ๐Ÿ™‚

Top comments (2)

Collapse
 
_e7d82c08f61159ad3b2ea profile image
้›ท็ฌ›ๆญŒ •

The local-first angle is the part Iโ€™d care about too. One gotcha with AnalyserNode is that smoothingTimeConstant can make a peak look โ€œstableโ€ while hiding short transients; I usually compare a smoothed display with a zero-smoothing path for peak detection. Otherwise the spectrogram can look great but still miss the click you were hunting.

Collapse
 
terry_beer_de05cb907967ac profile image
Terry Beer •

Thatโ€™s a really good point. I was using the same smoothed AnalyserNode data for both the display and some of the live measurements. Iโ€™ve now separated them: smoothing is only used for the Spectrum display, while peak detection and the rolling spectrogram use a zero-smoothing path. The full-file diagnostics already work from the decoded samples directly. Thanks for catching that.