Skip to content

Commit 657d232

Browse files
committed
refactor(logging): hide rejected silence candidates in analysis output
- Skip display of zero-scored candidates in both console and report - Remove "rejected: too loud" annotation; zero score indicates rejection - Improves clarity by showing only viable candidates Signed-off-by: Martin Wimpress <code@wimpress.io>
1 parent 947fdfd commit 657d232

2 files changed

Lines changed: 18 additions & 6 deletions

File tree

internal/logging/analysis_display.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,23 @@ func DisplayAnalysisResults(w io.Writer, inputPath string, metadata *audio.Metad
101101
writeSilenceCandidateMetrics(w, c)
102102
fmt.Fprintln(w)
103103

104-
// Print remaining candidates
105-
if len(measurements.SilenceCandidates) > 1 {
104+
// Print remaining candidates (skip zero-scored rejected candidates)
105+
visibleCount := 0
106+
for i, c := range measurements.SilenceCandidates {
107+
if i == electedIdx || c.Score == 0.0 {
108+
continue
109+
}
110+
visibleCount++
111+
}
112+
if visibleCount > 0 {
106113
fmt.Fprintf(w, " OTHER CANDIDATES\n")
107114
for i, c := range measurements.SilenceCandidates {
108115
if i == electedIdx {
109116
continue
110117
}
118+
if c.Score == 0.0 {
119+
continue
120+
}
111121
fmt.Fprintf(w, " #%d: %.1fs at %s\n",
112122
i+1, c.Region.Duration.Seconds(), formatTimestamp(c.Region.Start))
113123
writeSilenceCandidateMetrics(w, c)
@@ -117,6 +127,9 @@ func DisplayAnalysisResults(w io.Writer, inputPath string, metadata *audio.Metad
117127
} else {
118128
// No elected candidate - print all in discovery order
119129
for i, c := range measurements.SilenceCandidates {
130+
if c.Score == 0.0 {
131+
continue
132+
}
120133
fmt.Fprintf(w, " #%d: %.1fs at %s\n",
121134
i+1, c.Region.Duration.Seconds(), formatTimestamp(c.Region.Start))
122135
writeSilenceCandidateMetrics(w, c)

internal/logging/report.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1652,12 +1652,11 @@ func writeDiagnosticSilence(f *os.File, measurements *processor.AudioMeasurement
16521652
fmt.Fprintf(f, " Short-term: %.1f LUFS\n", c.ShortTermLUFS)
16531653
fmt.Fprintf(f, " True Peak: %.1f dBTP\n", c.TruePeak)
16541654
} else {
1655-
reason := ""
16561655
if c.Score == 0.0 {
1657-
reason = " — rejected: too loud"
1656+
continue
16581657
}
1659-
fmt.Fprintf(f, " Candidate %d: %.1fs at %.1fs (score: %.3f, RMS %.1f dBFS)%s\n",
1660-
i+1, c.Region.Duration.Seconds(), c.Region.Start.Seconds(), c.Score, c.RMSLevel, reason)
1658+
fmt.Fprintf(f, " Candidate %d: %.1fs at %.1fs (score: %.3f, RMS %.1f dBFS)\n",
1659+
i+1, c.Region.Duration.Seconds(), c.Region.Start.Seconds(), c.Score, c.RMSLevel)
16611660
}
16621661
}
16631662
} else if measurements.NoiseProfile != nil {

0 commit comments

Comments
 (0)