shithub: sox

Download patch

ref: 854be953b48841e3da5db8b17fade34294136c9d
parent: c056bbcc5c82195b6e1c422fc35f0fe059a1b25e
author: robs <robs>
date: Sun Jun 28 11:33:33 EDT 2009

Fix [2254919] Silence doesn't trim digitial silence correctly

--- a/ChangeLog
+++ b/ChangeLog
@@ -39,6 +39,8 @@
 
 Effects:
 
+  o Fix [2254919] Silence doesn't trim digitial silence correctly.  (robs)
+
 Other new features:
 
   o Added libSoX example #4: concatenating audio files.  (robs)
--- a/sox.1
+++ b/sox.1
@@ -2953,7 +2953,7 @@
 [\fIbelow-periods duration threshold\fR[\fBd\fR\^|\^\fB%\fR]]
 .SP
 Removes silence from the beginning, middle, or end of the audio.
-Silence is anything below a specified threshold.
+`Silence' is determined by a specified threshold.
 .SP
 The \fIabove-periods\fR value is used to indicate if audio should be
 trimmed at the beginning of the audio. A value of zero indicates no
@@ -3937,7 +3937,7 @@
 Allowed gap (in seconds) between quieter/shorter bursts of audio to
 include prior to the detected trigger point.
 .IP \fB\-p\ \fInum\fR\ (0)
-The amount of audio (in seconds) to preseve before the trigger point
+The amount of audio (in seconds) to preserve before the trigger point
 and any found quieter/shorter bursts.
 .RE
 .TP
--- a/src/silence.c
+++ b/src/silence.c
@@ -285,7 +285,7 @@
   else if (unit == 'd')
     scaled_value = linear_to_dB(scaled_value);
 
-  return scaled_value >= threshold;
+  return scaled_value > threshold;
 }
 
 static sox_sample_t compute_rms(sox_effect_t * effp, sox_sample_t sample)