Class ConfidenceScorer
The confidence score reported on every emitted
DtmfTone is the fraction of the in-band
(all-eight-DTMF) energy captured by the two peak bins:
confidence = clamp(
(peakLowEnergy + peakHighEnergy) / (ε + sumAllEight),
0.0, 1.0)
where ε = 1e-12 guards against a division by zero on pure
silence. A clean DTMF pair with no energy in the other six DTMF bins
scores ≈ 1.0; white noise spread roughly equally across all eight
bins scores ≈ 0.25; pure silence scores 0.0.
The detection threshold (DtmfConfig.detectionThreshold()) is compared against
this same ratio before a candidate is promoted to a confirmed tone, so
the interpretation of the score is stable across reporting and gating.
Although the type is public so AnalysisPipeline in the
same package and the dtmf-core tests in
com.tino1b2be.dtmf.internal can call it, the convention is that
com.tino1b2be.dtmf.internal.* is not part of the published API.
- Since:
- 2.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic doublecompute(double peakLowEnergy, double peakHighEnergy, double sumAllEightEnergies) Compute the confidence score for a candidate pair.
-
Method Details
-
compute
public static double compute(double peakLowEnergy, double peakHighEnergy, double sumAllEightEnergies) Compute the confidence score for a candidate pair.- Parameters:
peakLowEnergy- magnitude-squared of the picked low-group peak; non-negativepeakHighEnergy- magnitude-squared of the picked high-group peak; non-negativesumAllEightEnergies- sum of magnitude-squared over all eight DTMF bins; non-negative- Returns:
- a value in
[0.0, 1.0]reporting how much of the in-band energy is concentrated in the two peak bins
-