22o: RT_ENV=live (live-table envelope) — noise TF better, corpus neutral; new-arch best 5.386 vs canon 2.286; joint fit next
This commit is contained in:
+16
-4
@@ -357,12 +357,24 @@ void FramedDetector::processFrame(const std::complex<double>* spectrum, float* m
|
||||
double att = std::exp(-1.0 * (nfft_ / 4) / (tatt * sample_rate_));
|
||||
double rel = std::exp(-1.0 * (nfft_ / 4) / (trel * sample_rate_));
|
||||
|
||||
// RT_ENV=live (NOTES 22n): detector envelope from live tables kRTAtt/kRTRel —
|
||||
// attack as feed-forward, release as retention (~tau 2s at hop rate). This is
|
||||
// the slow adaptation the real plugin exhibits on sustained content.
|
||||
static const int env_live = getenv("RT_ENV") ? atoi(getenv("RT_ENV")) : 0;
|
||||
|
||||
for (size_t k = 0; k <= half; k++) {
|
||||
double a_cur = 2.0 * std::abs(spectrum[k]) / wsum_;
|
||||
double am = am_[k];
|
||||
if (a_cur > am) am = att * am + (1.0 - att) * a_cur;
|
||||
else am = rel * am + (1.0 - rel) * a_cur;
|
||||
am_[k] = static_cast<float>(am);
|
||||
if (env_live) {
|
||||
double d = a_cur - static_cast<double>(am_[k]);
|
||||
if (d > 0) am_[k] = static_cast<float>(am_[k] + d * static_cast<double>(kRTAtt[k]));
|
||||
else am_[k] = static_cast<float>(static_cast<double>(kRTRel[k]) * am_[k]
|
||||
+ (1.0 - static_cast<double>(kRTRel[k])) * a_cur);
|
||||
} else {
|
||||
double am = am_[k];
|
||||
if (a_cur > am) am = att * am + (1.0 - att) * a_cur;
|
||||
else am = rel * am + (1.0 - rel) * a_cur;
|
||||
am_[k] = static_cast<float>(am);
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t k = 0; k <= half; k++) mask[k] = 1.0f;
|
||||
|
||||
Reference in New Issue
Block a user