xbmc / visualization.spectrum

Spectrum visualizer for Kodi
GNU General Public License v2.0
8 stars 24 forks source link

Visualization.spectrum doesn't make use of pFreqData #48

Open mattblovell opened 3 years ago

mattblovell commented 3 years ago

It doesn't seem like this visualization.spectrum addon makes use of frequency information for its display.

The CVisualizationSpectrum::AudioData() function makes no use of pFreqData or iFreqDataLength. Instead, a somewhat odd sampling of the amplitude information carried by pAudioData is used instead:

https://github.com/xbmc/visualization.spectrum/blob/f3dceca07b243294377d660c5a9e7dcc238122b0/src/opengl_spectrum.cpp#L455-L482

I found mention of this in a kodi.tv forum back in a 2014 thread:

https://forum.kodi.tv/showthread.php?tid=204991&pid=1846424#pid1846424

the spectrum viz doesn't use fft data... there are no vizes in mainline using the fft data. it's still borked, but that is NOT a way to test it.

Wow. No wonder it looks nothing like a spectrum analyser display... I really think it should be using the fft data (well assuming the fft data is fixed).

So it just uses a random subset of audio samples. That would explain why it looks like random noise.

and

well, it's amplitude bins for each data set. so not entirely random but surely not a proper spectrum.

mattblovell commented 3 years ago

The AudioData() member in this class can be contrasted with that in visualization.starburst:

https://github.com/xbmc/visualization.starburst/blob/c4d57064d023d4038b48027a1983d3c9bac2c228/src/StarBurst.cpp#L185

The StarBurst visualization also asserts wantFreq in its override of GetInfo(), in order to get pFreqData populated.

https://github.com/xbmc/visualization.starburst/blob/e2f781fbb00ab2cd422cc856d485d2e0480cc357/src/StarBurst.h#L63

AlwinEsch commented 2 years ago

With https://github.com/xbmc/visualization.spectrum/pull/49 becomes the work about changed and to use FFT, after them is in becomes the issue here closed.