spectralizer icon indicating copy to clipboard operation
spectralizer copied to clipboard

43Hz - 475Hz are in a very condensed zone, sacrificing detail

Open WizardCM opened this issue 5 years ago • 18 comments

Years ago, I configured Lano Visualizer in Rainmeter on my third display as a way to have a fancy background when I wasn't actively using the display. I want to do something similar in my stream's intro.

I've done my best to configure this plugin with similar settings, but I noticed that quite a lot of detail in the low-mids is lost. Here's a video: http://file.wzd.li/2019-10-19_20-54-43.mp4

As the title states, it's most noticeable at 43Hz - 475Hz (10 seconds in) in favour of 2700Hz - 6500Hz. Detail in the plugin is set to 108.

Real world example with Approaching Nirvana's "Flashback" http://file.wzd.li/2019-10-19_21-07-49.mp4

Image

WizardCM avatar Oct 19 '19 10:10 WizardCM

I have very little to no experience with audio processing, which is why I stuck closely to what cli-visualizer uses, so I'm not sure I can do much about that. I would assume that this is responsible for it, but I don't know how I'd have to adjust it

univrsal avatar Oct 20 '19 19:10 univrsal

I tend to agree that the two lines of code you referenced are the most likely candidates for the non-linear behaviors shown by the above examples. Should be simple enough to just remove those lines and see how the bars look with them removed. If that isn't the cause, then you'd likely need to go dig into the parameters being fed into the engine doing the actual FFT calculations on the audio, since in that case, it likely means that the FFT algorithm itself is not using a linear scale for the buckets (meaning each bar/frequency range) it's creating when calculating magnitude for each of them.

jrwagz avatar Jul 16 '20 22:07 jrwagz

it likely means that the FFT algorithm itself is not using a linear scale for the buckets (meaning each bar/frequency range) it's creating when calculating magnitude for each of them.

I was considering switching from fftw3 to kiss fft, which is what rainmeter uses, because it would remove the dependency. I'll have to test the performance though, because I don't know if the other library makes use of hardware extensions.

univrsal avatar Jul 17 '20 07:07 univrsal

I recently decided to experiment with adding logarithmic frequency scale for Spectralizer, which is what usually is used for displaying a spectrum in visualizers, as it's far more relatable to human perception of sound. I only so far tested this on Linux and it's far from ideal but it probably is what OP was looking for. I recorded a sample of it over here for a quick glance (old linear behavior on top, my implementation on the bottom): https://www.youtube.com/watch?v=yZqgnThGXjw

Code is available on my Spectralizer fork if you want to take a look. I'm no digital sound processing expert/guru and I don't know how it collides with spectrum rewriting plans (I just found out about them reading through these issues) but I hope it's at least what @WizardCM had in mind regarding spectrum detail.

lookeypl avatar Nov 18 '20 22:11 lookeypl

@LKostyra did you compare it to the image Wizard posted (which doesn't seem to load for me right now)? You can try the tone generator here. But from what I saw in the video it definitely looks better. Do you mind making a pull request? I was working on switching to kiss_fft and the rainmeter implementation, but maybe this'll do too. I might still use kiss_fft as it would remove the dependency on fftw3 but for now I'd be happy with just the changes you made.

univrsal avatar Nov 19 '20 17:11 univrsal

@univrsal The images didn't load for me either when I was posting my comment, but now it seems to be working again and the results are definitely closer: Screenshot from 2020-11-20 08-12-16

There still are some minor artifacts (like the small dip to the left of the peak in the above screenshot) which are most probably a side effect of interpolating from linear to logarithmic frequency domain. I'm planning on tinkering with the code over the course of this weekend to iron these out. Also, for some reason Wire renderer doesn't show anything for me, so I want to try and take a look at that as well. Afterwards, I'd be happy to put up a PR!

lookeypl avatar Nov 20 '20 07:11 lookeypl

Yep, my apologies - the example photos/videos were on my site, and my site was down this week. It's back up as of a couple hours ago.

Thanks to both of you for experimenting with this! I'm exciting to test it when you're more comfortable with the implementation. :)

WizardCM avatar Nov 20 '20 07:11 WizardCM

@univrsal The images didn't load for me either when I was posting my comment, but now it seems to be working again and the results are definitely closer: Screenshot from 2020-11-20 08-12-16

There still are some minor artifacts (like the small dip to the left of the peak in the above screenshot) which are most probably a side effect of interpolating from linear to logarithmic frequency domain. I'm planning on tinkering with the code over the course of this weekend to iron these out. Also, for some reason Wire renderer doesn't show anything for me, so I want to try and take a look at that as well. Afterwards, I'd be happy to put up a PR!

Great, I started to add CI to this project, which isn't done yet but it shouldn't cause any merge conflicts. It might change your development setup though. Also thanks for the time you put into this, I should've done it myself but have been putting it off for quite while.

univrsal avatar Nov 20 '20 17:11 univrsal

Apologies for being so late with my PR, real life marched in and left me with little to no time to work on code after hours. I did some tinkering and decided to submit what I have as PR #39 . I have some more stuff I want to do with this implementation which I highlighted in the PR, but it's more work than just small adjustments, so I decided to just push what I have now and take my time with adding more improvements. If I'll come up with anything worth sharing I'll submit these changes in another PR.

lookeypl avatar Dec 06 '20 19:12 lookeypl

Well CI is very broken, but the Windows run finished so @WizardCM if you want to try the changes you can get the installer or the binary now.

univrsal avatar Dec 09 '20 21:12 univrsal

@univrsal Count me in for beta testing :). I tried setting up a build environment for building OBS plugins but I didn't get it to work.

showengineer avatar Dec 09 '20 21:12 showengineer

@univrsal Count me in for beta testing :). I tried setting up a build environment for building OBS plugins but I didn't get it to work.

If you're on windows the build is at the bottom on this page, I'll fix the other platforms soon

univrsal avatar Dec 09 '20 21:12 univrsal

Is it me, or does it appear to be still using the wrong scale?

showengineer avatar Dec 09 '20 21:12 showengineer

Did you turn it on? There should be an option (I haven't tested it)

univrsal avatar Dec 09 '20 22:12 univrsal

Oh I totally missed the option part, hold on.

showengineer avatar Dec 09 '20 22:12 showengineer

Yep, this looks good!

showengineer avatar Dec 09 '20 22:12 showengineer

great, I'll try to finish up CI and then maybe switch to kiss fft if it doesn't impact performance too much. And then maybe make a release.

univrsal avatar Dec 09 '20 22:12 univrsal

A basic test without my previous comparison definitely showed significant improvements. It might require a bit of tweaking, I'll test properly later today.

As a side note, the ZIP download didn't contain the fft dll, but the installer did.

WizardCM avatar Dec 09 '20 22:12 WizardCM