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:
|
int xscale[] = {0, 1, 2, 3, 5, 7, 10, 14, 20, 28, 40, 54, 74, 101, 137, 187, 255}; |
|
|
|
for(y = 15; y > 0; y--) |
|
{ |
|
for(i = 0; i < 16; i++) |
|
{ |
|
m_heights[y][i] = m_heights[y - 1][i]; |
|
} |
|
} |
|
|
|
for(i = 0; i < NUM_BANDS; i++) |
|
{ |
|
for(c = xscale[i], y = 0; c < xscale[i + 1]; c++) |
|
{ |
|
if (c<iAudioDataLength) |
|
{ |
|
if((int)(pAudioData[c] * (INT16_MAX)) > y) |
|
y = (int)(pAudioData[c] * (INT16_MAX)); |
|
} |
|
else |
|
continue; |
|
} |
|
y >>= 7; |
|
if(y > 0) |
|
val = (logf(y) * m_scale); |
|
else |
|
val = 0; |
|
m_heights[0][i] = val; |
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.
It doesn't seem like this visualization.spectrum addon makes use of frequency information for its display.
The
CVisualizationSpectrum::AudioData()function makes no use ofpFreqDataoriFreqDataLength. Instead, a somewhat odd sampling of the amplitude information carried bypAudioDatais used instead:visualization.spectrum/src/opengl_spectrum.cpp
Lines 455 to 482 in f3dceca
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
and