Closed Personuo closed 2 years ago
Because the other half is mirrored. Like the values are 5, 4, 3, 2, 1, 1, 2, 3, 4, 5
Am 05.06.2022 um 19:19 schrieb Personuo @.***>:
I'm reading the code carefully and trying to understand it, but I can't seem to figure it out
_maxFftIndex = _fftSize / 2 - 1 _maximumFrequencyIndex = Math.Min(_spectrumProvider.GetFftBandIndex(_maxFrequency) + 1, _maxFftIndex); _maximumFrequencyIndex the maximum value is equal to _maxFftIndex
But In the following code, fftBuffer size is _fftSize ,so not all fftBuffer elements are processed? only work half.
protected virtual SpectrumPointData[] CalculateSpectrumPoints(double maxValue, float[] fftBuffer) { ........................ for (int i = _minimumFrequencyIndex; i <= _maximumFrequencyIndex; i++) { switch (ScalingStrategy) { case ScalingStrategy.Decibel: value0 = (((20 Math.Log10(fftBuffer[i])) - MinDbValue) / DbScale) actualMaxValue; break; case ScalingStrategy.Linear: value0 = (fftBuffer[i] ScaleFactorLinear) actualMaxValue; break; case ScalingStrategy.Sqrt: value0 = ((Math.Sqrt(fftBuffer[i])) ScaleFactorSqr) actualMaxValue; break; }......................................... — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.
thank you reply ! so the fftbuffer frequency range is 0 --- 48000 --- 0 ? Is 48000 in the middle?
Yes, but try it out. The SpectrumProvider has a GetFftBandIndex method.
Am 05.06.2022 um 19:54 schrieb Personuo @.***>:
fftbuffer The frequency range is 0480000 ? Is 48000 in the middle?
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.
Thank you, I have another question, in the sample spectrumdata has buffering , when I turn off the audio immediately, the data does not go to zero until a few frames later. How do I get unbuffered data? I would like to control the buffering time myself to adjust the visualization.
I'm reading the code carefully and trying to understand it, but I can't seem to figure it out
_maximumFrequencyIndex the maximum value is equal to _maxFftIndex
But In the following code, fftBuffer size is _fftSize ,so not all fftBuffer elements are processed? only work half.