catnip icon indicating copy to clipboard operation
catnip copied to clipboard

[feature request] option to visualize on logarithmic scale

Open josephdong1000 opened this issue 2 years ago • 2 comments

It'd also be cool to have a toggle/setting that flips between logarithmic and linear axis scales, since right now I think the low frequencies are being squished together.

For reference, here's what an audio spectrum with a logarithmic scale looks like: image , versus a linear scale like image

, which is what the visualizer looks like right now.

josephdong1000 avatar Apr 08 '22 22:04 josephdong1000

I actually want to look into this. I had originally tried to do something logarithmic, but I am not too well versed in the magic of audio analysis. I had done a logarithmic scale before, but the output was very sparse. I believe I need to fill out the missing bars with some smoothing algorithm that will follow the existing bars.

If you check out the code, it was supposed to be an attempt at some sort of non-linear distribution, but it ends up just being linear with a lot of wasted work.

This is definitely something I will be working on.

noriah avatar Apr 09 '22 06:04 noriah

I think it should just be a matter of transforming the linear datapoints with a log function, but you would also have to decrease the spacing of samples for lower frequencies. I haven't taken a look at the code tho, and I don't really know how to program in go lol

Something I found that could help with the sampling frequency issue: https://stackoverflow.com/questions/32320028/convert-linear-audio-frequency-distribution-to-logarithmic-perceptual-distributi

josephdong1000 avatar Apr 10 '22 04:04 josephdong1000