I'm working on project, where I need to visualize spectral analysis to set some precise parameters. Now I'm with conversion of bins to screen space, because in linear space, magnitudes in lower frequencies are squashed together. Here's my code in c++:
float windowSize = 640;
float windowHeight = 480;
for (size_t i = 0; i < bins; i++)
{
float m = audioIn.getSpectrum.at(i)*windowHeight;
float pos = i;
drawLine(vec2(pos, 0), vec2(pos, m));
}
I was trying to compute pos
by using different approaches, but failed miserably. I'm missing crucial knowledge about logarithms I guess.
DISCLAIMER: this is for personal art project, not homework assignment.