Closed Pannarrow closed 9 months ago
Good point, I have not written that part of the code. Maybe @bewantbe can explain?
As far as I understand, the code is calculating the power spectrum (squared magnitudes of complex amplitudes).
Therefore the factor of 10 used in the line:
spectrumAmpOutDB[i] = 10.0 * log10(spectrumAmpOut[i]);
is appropriate. This line converts the power spectrum values to decibels. The factor of 10 is commonly used when calculating decibels for power, and it aligns with the standard practice in audio signal processing.
Don't we end up with dbfs?
Yes, I think so
thank you very match!
Apologize for the late response.
spectrumAmpOutDB[i] = 10.0 * log10(spectrumAmpOut[i]);
The code here is calculating DB of the amplitude (Amp
) of the "spectrum". The power spectrum, or more precisely Spectral density, is already the square of the wave amplitude, this calculation can be seem in function fftToAmp
.
对于迟到的回复,我们深表歉意。
spectrumAmpOutDB[i] = 10.0 * log10(spectrumAmpOut[i]);
这里的代码是计算“频谱”振幅()的DB。功率谱,或者更准确地说是光谱密度,已经是波幅的平方,这个计算似乎是函数。
Amp
Why do I get dbfs less than -96
Why do I get dbfs less than -96
The overall "DBFS" should not less that -96dB in general, although specially crafted data could break it, e.g. RMS([1, -1, 1, -1, ...]/2^16) = -96.33dB; RMS([1, 0, -1, 0, ...]/2^16) = -99.3dB).
In your case, I believe you are referring to DBFS in the spectrum. The level of the spectrum can be lower than -96dB because -96dB only limits the sum of the energy across all frequencies in the spectrum.
Say, FFT length is 1024, then for -96dB white noise, the spectrum level should be around -96dB + 10*log10(1/1024) = -126 dB.
This code is in "STFT.java", "spectrumAmpOutDB[i] = 10.0 log10(spectrumAmpOut[i]);". I found the dbfs formula "20.0 log10(sample/65535)", Why do we use 10.0