Hi there,
In the tutorial: Visualise the frequencies of a signal in real time, why minus the item: Decibels::gainToDecibels ((float) fftSize)) in the drawNextFrameOfSpectrum function ?
Why transform the fftSize=2048 into DBFS?
Best Regards!
void drawNextFrameOfSpectrum()
{
// first apply a windowing function to our data
window.multiplyWithWindowingTable (fftData, fftSize);
// then render our FFT data..
forwardFFT.performFrequencyOnlyForwardTransform (fftData);
auto mindB = -100.0f;
auto maxdB = 0.0f;
for (int i = 0; i < scopeSize; ++i)
{
auto skewedProportionX = 1.0f - std::exp (std::log (1.0f - i / (float) scopeSize) * 0.2f);
auto fftDataIndex = jlimit (0, fftSize / 2, (int) (skewedProportionX * fftSize / 2));
auto level = jmap (jlimit (mindB, maxdB, Decibels::gainToDecibels (fftData[fftDataIndex])
- Decibels::gainToDecibels ((float) fftSize)),
mindB, maxdB, 0.0f, 1.0f);
scopeData[i] = level;
}
}