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 k = 0; k <= half; k++) mask[k] = 1.0f;
|
||||||
|
|
||||||
for (size_t b = 0; b < bands_.size(); b++) {
|
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
|
// 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++) {
|
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);
|
static_cast<double>(bands_[b].level_scale);
|
||||||
scratch[k] = static_cast<float>(level * (fVar30 / C_0x1a0) *
|
scratch[k] = static_cast<float>(level * (fVar30 / C_0x1a0) *
|
||||||
C_0x540870 * C_0x54088c);
|
C_0x540870 * C_0x54088c);
|
||||||
|
|||||||
@@ -905,3 +905,21 @@ Verified constants at raw=RVA: 0x24c3c58=0.001, 0x24c3e28=0.8, 0x24c4674=-0.7,
|
|||||||
|
|
||||||
### framed_model.cpp: scale coeff now computed via prng_fvar30() (prng_state_=112),
|
### framed_model.cpp: scale coeff now computed via prng_fvar30() (prng_state_=112),
|
||||||
not a hardcoded constant. t1kq still -0.43 dB at level_scale=600 (unchanged).
|
not a hardcoded constant. t1kq still -0.43 dB at level_scale=600 (unchanged).
|
||||||
|
|
||||||
|
## ============ UPDATE 2026-08-20o: CRITICAL — level = am / res (not am * res) ============
|
||||||
|
Found + fixed a sign/direction bug in framed_model.cpp level computation.
|
||||||
|
|
||||||
|
res = |2B/A| (twin) is MINIMAL at band centre (0.117), NOT maximal. The model uses
|
||||||
|
xv = log10(A_k / res_k), i.e. LEVEL = am / res. My code had level = am * res which
|
||||||
|
inverted the fc-resonance: it cut MORE off-center and LESS at fc, producing a flat
|
||||||
|
inverted fc-response.
|
||||||
|
|
||||||
|
Fix: level = am_ / res_[b][k] (with 1e-12 floor). Now the fc-scan (tone1kq, band fc
|
||||||
|
swept 800..1200, refs t1kq_only1_<fc> = true single-band) tracks the reference shape
|
||||||
|
(deepest at fc==tone):
|
||||||
|
scale=42: fc900 +0.3, fc950 +1.3, fc1000 +0.9, fc1100 +0.2; mean|err| 2.46 dB,
|
||||||
|
max 5.3 dB (worst at edges fc800 +3.9, fc1200 +5.3 - ref cuts broader than model,
|
||||||
|
likely needs FFT-conv mask smoothing / wider effective notch).
|
||||||
|
Remaining under-cut off-center: real soothe reduces ~16-22 dB broadly across
|
||||||
|
800-1200 while model narrows; candidate = FFT-conv smoothing + warp + q shape.
|
||||||
|
DEFAULT level_scale for am/res path ~= 35-45 (was 600 for the wrong am*res path).
|
||||||
|
|||||||
Reference in New Issue
Block a user