Libvisual / libvisual

Libvisual Audio Visualization
http://libvisual.org/
81 stars 31 forks source link

Enhancement of lv_analyzer #255

Open kaixiong opened 1 year ago

kaixiong commented 1 year ago

lv-analyzer plots the frequency spectrum in a bar graph and a bit hard to love at the moment (#207). For me, it's been relegated to a sort of visual debugger for audio inputs in Libvisual.

It's boring because the frequency spectrum doesn't see that much movement unless you're listening to sound like this where there's energy shifts up and down the spectrum.

We could superimpose a plot of the audio signal over it, add ghosting/fading, render the bars in a more stylized (less blocky) fashion, and so on. Here are some reference styles:

Another idea that's been brought up in the past is to scale the axes logarithmically so it doesn't look as lopsided. Vertical scaling is straightforward. Horizontal scaling will require the use of a longer signal so that the DFT can produce higher resolution i.e. more samples. These samples can then be put into log-sized buckets (wider band towards higher frequencies), summed and scaled accordingly.

hartwork commented 1 year ago

I would like to add some inspiration from projects on GitHub with pictures that do spectrum analysis with C/C++ code:

bradleybauer/music_visualizer

example5.png example0.PNG

aiXander/Realtime_PyAudio_FFT

20bfbb00-9506-11ea-9e50-e197d8710500

kojigardiner/audiobox

tvotr_sym1.GIF

JanKleprlik/AudioVisualiser

radio.PNG

GhostNaN/recidia-audio-visualizer

preview.apng

hannesha/GLMViz

minimal.gif

seven-phases/spectrum-analyzer

seven-phases

UtoECat/jack_utils

spectrum.png (while the line rendering could be improved)

jarcode-foss/glava

glava demo (though neither the colors nor the symmetry seem to be a good idea)

hartwork commented 1 year ago

One more, this is from https://github.com/pckbls/pulseviz , shots are self-made. The licensing would need to be clarified though.

Screenshot_20230205_210543_bars Screenshot_20230205_210520_spectrum Screenshot_20230205_210444_time Screenshot_20230205_210350_spectrogram

kaixiong commented 1 year ago

@hartwork, thanks for the ideas. I'm working on the code to rasterise lines and circles. I have done both before. Currently doing research on how to add anti-aliasing to them. Let's see what I can come up with once I have these two graphics primitives to work with.

hartwork commented 1 year ago

@kaixiong sounds good, looking forward to see your own spectrum analyzer in action!

I think long-term I'd want us to also port some of the existing ones seen above to (and into) Libvisual as well if licensing can be clarified, I'm thinking of (parts of) both https://github.com/JanKleprlik/AudioVisualiser and https://github.com/pckbls/pulseviz in particular. I hope we can have multiple spectra in libvisual-plugins, a spectrum family :smile:

If your work on anti-aliasing has any likely cross-over to GL vidoptions (get_video_attribute_options), please let me know, so we don't duplicate work about it in the future by accident.

kaixiong commented 1 year ago

@kaixiong sounds good, looking forward to see your own spectrum analyzer in action!

I think long-term I'd want us to also port some of the existing ones seen above to (and into) Libvisual as well if licensing can be clarified, I'm thinking of (parts of) both https://github.com/JanKleprlik/AudioVisualiser and https://github.com/pckbls/pulseviz in particular. I hope we can have multiple spectra in libvisual-plugins, a spectrum family smile

@hartwork Sounds good to me!

If your work on anti-aliasing has any likely cross-over to GL vidoptions (get_video_attribute_options), please let me know, so we don't duplicate work about it in the future by accident.

The rasterisation and anti-aliasing is done entirely in software so there's no overlap with OpenGL. I miss doing software rasterisation and it's a bit of a fun distraction for me.

hartwork commented 1 year ago

@kaixiong :smiley: Thanks for the clarification! :+1: