phandasm / waveform

Audio spectral analysis plugin for OBS
https://obsproject.com/forum/resources/waveform.1423/
GNU General Public License v3.0
522 stars 37 forks source link

Enhancement Request: Allow for Longer Buffer Length. #73

Open MetalGearBronya opened 2 months ago

MetalGearBronya commented 2 months ago

Firstly thanks for your awesome job, the plugin really helps in my usage where I want to add a visual clue in my recordings to when I got excited and made some noise. Unfortunately, currently I can't set the buffer time to a value above 1000ms when using the levels meter, which really limits it's usage. I don't know C++ very well, so I failed to find out if supporting a longer time span is just a change of magic number or it will require other changes. Could you please change it to support time span like 1 to 10 minutes? I guess 1000ms is not an intentional limit, but you might have other concerns. I would try to help if that's the case. Looking forward to your reply~

phandasm commented 2 months ago

The 1000 ms limit was just to make the slider usable over the range one might use for a VU meter and give users some indication of what a "sane" buffer value is.

I suppose I could switch it to a numeric input and just assume that anyone putting in 600000 understands the consequences.

MetalGearBronya commented 2 months ago

I see, switching to a numerical input would definitely work, actually that's how I found that the limit was 1000, I tried to key in numbers in the box to the right of slider and found that the value could not go higher. I would suggest that for higher numbers (longer period), there could also be a input box for setting the sampling rate (or sampling interval), it can serve as a smoothing method, make the graph look less jagged, similar to what most resource monitors do. I would be grateful if you could think about and possibly implement this enhancement. Regards.

phandasm commented 2 months ago

You can use the gaussian filter to smooth the graph, it's not perfect but it should do the trick.

As for sample rate, the data is already resampled according to the size of the graph. If your buffer is 1000 ms and your graph is 100 px, then the sampling interval is effectively 10 ms. Fiddling with the sample rate might save some memory but it creates other problems and the gaussian filter performs better anyway.

phandasm commented 2 months ago

Just pushed this to master along with general improvements to waveform rendering. Preview scaling can still cause wobble but there's nothing I can do about that.

Still needs some adjustment but it'll work for now.