P4: CRITICAL fix — level = am/res (not am*res); fc-resonance shape now correct
res=|2B/A| is minimal at band centre (not maximal). Model uses xv=log10(A_k/res_k) => level = am / res. Old am*res inverted the fc-response (cut more off-center). Fixed; fc-scan (tone1kq, band fc 800..1200 via t1kq_only1_<fc>) now tracks the reference: scale=42 mean|err| 2.46 dB, intact shape (deepest at fc==tone). Was flat+inverted before. Remaining under-cut off-center -> FFT-conv smoothing/gaps.
This commit is contained in:
@@ -134,10 +134,12 @@ void FramedDetector::processFrame(const std::complex<double>* spectrum, float* m
|
||||
for (size_t k = 0; k <= half; k++) mask[k] = 1.0f;
|
||||
|
||||
for (size_t b = 0; b < bands_.size(); b++) {
|
||||
// 1. level = twin |2B/A| x smoothed amp, scaled (0x9be0 buf*=scalar):
|
||||
// 1. level = twin response x smoothed amp, scaled (0x9be0 buf*=scalar):
|
||||
// mask *= (fVar30/0x1a0) * 0x540870 * 0x54088c
|
||||
// Level uses xv = log10(A_k / res_k): res=|2B/A| is MINIMAL at band
|
||||
// centre (a notch), so am/res is maximal there -> deepest cut at fc.
|
||||
for (size_t k = 0; k <= half; k++) {
|
||||
double level = am_[k] * static_cast<double>(res_[b][k]) *
|
||||
double level = am_[k] / std::max(static_cast<double>(res_[b][k]), 1e-12) *
|
||||
static_cast<double>(bands_[b].level_scale);
|
||||
scratch[k] = static_cast<float>(level * (fVar30 / C_0x1a0) *
|
||||
C_0x540870 * C_0x54088c);
|
||||
|
||||
Reference in New Issue
Block a user