From aae36b78912622d5622c9a96f0286d6b010f763f Mon Sep 17 00:00:00 2001 From: Martin Wimpress Date: Fri, 6 Feb 2026 15:59:27 +0000 Subject: [PATCH] feat(logging): prefer speech crest factor in analysis display - Compute crestFactor from peak - RMS and default crestSource to "full-file" - If SpeechProfile is present and CrestFactor > 0, use speech crest and set source - Update printed line to include crest factor and its source (speech | full-file) Clarifies which crest factor is shown in analysis output, aiding debugging and aligning displayed metrics with processor behaviour that prefers speech-specific measurements. Signed-off-by: Martin Wimpress --- internal/logging/analysis_display.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/logging/analysis_display.go b/internal/logging/analysis_display.go index 491bee4..aa9681a 100644 --- a/internal/logging/analysis_display.go +++ b/internal/logging/analysis_display.go @@ -41,7 +41,13 @@ func DisplayAnalysisResults(w io.Writer, inputPath string, metadata *audio.Metad fmt.Fprintf(w, " RMS Level: %.1f dBFS\n", measurements.RMSLevel) fmt.Fprintf(w, " Peak Level: %.1f dBFS\n", measurements.PeakLevel) fmt.Fprintf(w, " Dynamic Range: %.1f dB\n", measurements.DynamicRange) - fmt.Fprintf(w, " Crest Factor: %.1f dB\n", measurements.PeakLevel-measurements.RMSLevel) + crestFactor := measurements.PeakLevel - measurements.RMSLevel + crestSource := "full-file" + if measurements.SpeechProfile != nil && measurements.SpeechProfile.CrestFactor > 0 { + crestFactor = measurements.SpeechProfile.CrestFactor + crestSource = "speech" + } + fmt.Fprintf(w, " Crest Factor: %.1f dB (%s)\n", crestFactor, crestSource) fmt.Fprintln(w) // Silence detection section