shithub: sox

Download patch

ref: 0dd7d2c206eecd6f423d557a16af3e5d07a7b1d3
parent: 2fde5c7c3678b14200e91b7ea1fd04b6a75a08f7
author: robs <robs>
date: Tue Jan 16 17:22:39 EST 2007

Variable Q for low/high pass filters; made common 1,2 pole interface.

--- a/ChangeLog
+++ b/ChangeLog
@@ -20,14 +20,14 @@
   o Add FLAC support (robs@users.sf.net)
   o Allow encoding quality to be specified (works for Ogg too, but not
     MP3).
-  o bass and treble altering effects. (robs@users.sf.net)
-  o Visualisation of various filters' frequency response via Octave.
-    (robs@users.sf.net)
   o Allow the rate and number of channels of .au files to be overridden
     by command-line arguments. (robs@users.sf.net)
   o More and better self-tests. (robs@users.sf.net)
   o Support Maxis's XA format. (Dwayne C. Litzenberger)
   o Add equalizer effect (Pascal Giard)
+  o bass and treble altering effects.  (robs)
+  o Documented the butterworth filter effects; added variable Q.  (robs)
+  o Visualisation of various filters' frequency response via Octave.  (robs)
   o Fix rounding error when reading command-line time
     parameters. (robs)
   o Allow command-line time parameters of < 1 sec to omit the
@@ -62,7 +62,6 @@
     resample, and rate has been removed.
   o Improved synth usage (by introducing --) and improved the synth
     entry in the man-page.  (robs)
-  o Documented the butterworth filter effects.  (robs)
   o Added command line options for specifying the output file
     comment.  (robs)
   o Improved the accuracy of integer and floating point PCM
--- a/sox.1
+++ b/sox.1
@@ -1344,25 +1344,39 @@
 .TE
 .SP
 .TP
-\fBhighp\fR\^|\^\fBlowp \fIfrequency\fR
-Apply a single-pole recursive high-pass or low-pass filter with
-3dB point \fIfrequency\fR.
-The filters roll off at 6dB per octave (20dB per decade).
+\fBhighp\fR \fIfrequency\fR
+Apply a high-pass filter.
+This effect is just an alias for the
+.B highpass
+effect used with its
+.B -1
+option; it is retained for backwards compatibilty only.
+.TP
+\fBhighpass\fR\^|\^\fBlowpass\fR [\fB-1\fR|\fB-2\fR] \fIfrequency\fR [\fIQ\fR]
+Apply a high-pass or low-pass filter with 3dB point \fIfrequency\fR.
+The filter can be either single-pole (with
+.BR -1 ),
+or double-pole (with
+.B -2
+or if unspecified).
+.I Q
+applies only to double-pole filters; its default value is 0\*d707 and gives
+a Butterworth response.  The single-pole and double-pole filters roll off at
+6 and 12 dB per octave (20 and 40 dB per decade) respectively.  See
+http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt for a detailed
+discussion of the double-pole filters.
 .SP
 These effects support the \fB\-\-octave\fR global option (see above).
 .SP
 See also \fBfilter\fR for filters with a sharper cutoff.
 .TP
-\fBhighpass\fR\^|\^\fBlowpass \fIfrequency\fR
-Apply a two-pole Butterworth high-pass or low-pass filter with
-3dB point \fIfrequency\fR.
-The filters roll off at 12dB per octave (40dB per decade).
-.SP
-These effects support the \fB\-\-octave\fR global option (see above).
-.TP
 \fBlowp \fIfrequency\fR
 Apply a low-pass filter.
-See the description of the \fBhighp\fR effect for details.
+This effect is just an alias for the
+.B lowpass
+effect used with its
+.B -1
+option; it is retained for backwards compatibilty only.
 .TP
 \fBlowpass \fIfrequency\fR
 Apply a low-pass filter.
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -20,14 +20,14 @@
 	  raw.c sf.c sfircam.h skelform.c smp.c sndrtool.c sphere.c tx16w.c voc.c \
 	  vorbis.c vox.c wav.c wav.h wve.c xa.c
 
-effects = avg.c band.c bandpass.c biquad.c biquad.h breject.c btrworth.c \
-	  btrworth.h chorus.c compand.c dcshift.c deemphas.c earwax.c \
-	  echo.c echos.c equalizer.c fade.c FFT.c FFT.h filter.c flanger.c \
-	  highp.c highpass.c lowp.c lowpass.c luaeff.c luaform.c \
-	  lintlib.c mask.c mcompand.c noiseprof.c noisered.c noisered.h \
-	  pad.c pan.c phaser.c pitch.c polyphas.c rabbit.c rate.c repeat.c \
-	  resample.c reverb.c reverse.c silence.c skeleff.c speed.c stat.c \
-	  stretch.c swap.c synth.c tone.c trim.c vibro.c vol.c
+effects = avg.c band.c bandpass.c biquad.c biquad.h biquadlh.c breject.c \
+	  btrworth.c btrworth.h chorus.c compand.c dcshift.c deemphas.c \
+	  earwax.c echo.c echos.c equalizer.c fade.c FFT.c FFT.h filter.c \
+	  flanger.c luaeff.c luaform.c lintlib.c mask.c mcompand.c \
+	  noiseprof.c noisered.c noisered.h pad.c pan.c phaser.c pitch.c \
+	  polyphas.c rabbit.c rate.c repeat.c resample.c reverb.c reverse.c \
+	  silence.c skeleff.c speed.c stat.c stretch.c swap.c synth.c tone.c \
+	  trim.c vibro.c vol.c
 
 libst_la_SOURCES = $(formats) $(effects) alsa.c oss.c sunaudio.c handlers.c misc.c \
 	  st_i.h stio.c stlua.c util.c xmalloc.c xmalloc.h getopt.c getopt1.c getopt.h
--- /dev/null
+++ b/src/biquadlh.c
@@ -1,0 +1,180 @@
+/*
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library.  If not, write to the Free Software Foundation,
+ * Fifth Floor, 51 Franklin Street, Boston, MA 02111-1301, USA.
+ */
+
+/* Sound Tools Effects: 2-pole variable Q & 1-pole low/high-pass filters.
+ *
+ * This implementation (c) 2007 robs@users.sourceforge.net
+ *
+ * 2-pole with default Q gives a Butterworth response.
+ *
+ * 2-pole filter design by Robert Bristow-Johnson <rbj@audioimagination.com>
+ * see http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt
+ *
+ * 1-pole low-pass based on lowp.c:
+ * (c) 2000 Chris Bagwell <cbagwell@sprynet.com>
+ *
+ * Algorithm:  Recursive single pole lowpass filter
+ *
+ * Reference: The Scientist and Engineer's Guide to Digital Signal Processing
+ *
+ *      output[N] = input[N] * A + output[N-1] * B
+ *
+ *      X = exp(-2.0 * pi * Fc)
+ *      A = 1 - X
+ *      B = X
+ *      Fc = cutoff freq / sample rate
+ *
+ * Mimics an RC low-pass filter:   
+ *
+ *     ---/\/\/\/\----------->
+ *                    |
+ *                   --- C
+ *                   ---
+ *                    |
+ *                    |
+ *                    V
+ *
+ * 1-pole high-pass based on highp.c:
+ * (c) 2000 Chris Bagwell <cbagwell@sprynet.com>
+ *
+ * Algorithm:  Recursive single pole high-pass filter
+ *
+ * Reference: The Scientist and Engineer's Guide to Digital Processing
+ *
+ *      output[N] = A0 * input[N] + A1 * input[N-1] + B1 * output[N-1]
+ *
+ *      X  = exp(-2.0 * pi * Fc)
+ *      A0 = (1 + X) / 2
+ *      A1 = -(1 + X) / 2
+ *      B1 = X
+ *      Fc = cutoff freq / sample rate
+ *
+ * Mimics an RC high-pass filter:
+ *
+ *        || C
+ *    ----||--------->
+ *        ||    |
+ *              <
+ *              > R
+ *              <
+ *              |
+ *              V
+ */
+
+#include "biquad.h"
+#include <string.h>
+#undef st_fail
+#define st_fail st_message_filename=effp->name,st_fail
+
+static int getopts(eff_t effp, int n, char **argv) 
+{
+  biquad_t p = (biquad_t) effp->priv;
+  char dummy;
+  char order;
+
+  if (n != 0 && sscanf(argv[0], "-%1[12] %c", &order, &dummy) == 1)
+    ++argv, --n;
+  else order = strlen(effp->name) <= 5 /* lowp|highp */ ? '1' : '2';
+  order -= '0';
+
+  p->width.q = order == 2? sqrt(0.5) : 0;
+  if (n < 1 || n > order || sscanf(argv[0], "%lf %c", &p->fc, &dummy) != 1 ||
+      p->fc <= 0 || (n == 2 && (sscanf(argv[1], "%lf %c", &p->width.q, &dummy)
+          != 1 || p->width.q <= 0))) {
+    st_fail(effp->h->usage);
+    return ST_EOF;
+  }
+  return ST_SUCCESS;
+}
+
+static int start(eff_t effp)
+{
+  biquad_t p = (biquad_t) effp->priv;
+  double w0 = 2 * M_PI * p->fc / effp->ininfo.rate;
+
+  if (w0 > M_PI) {
+    st_fail("cut-off frequency must be less than half the sample-rate (Nyquist rate)");
+    return ST_EOF;
+  }
+  if (p->width.q) {           /* 2-pole */
+    double alpha = sin(w0)/(2*p->width.q);
+
+    if (*effp->name == 'l') { /* lowpass */
+      p->b0 =  (1 - cos(w0))/2;
+      p->b1 =   1 - cos(w0);
+      p->b2 =  (1 - cos(w0))/2;
+    } else {
+      p->b0 =  (1 + cos(w0))/2;
+      p->b1 = -(1 + cos(w0));
+      p->b2 =  (1 + cos(w0))/2;
+    }
+    p->a0 =   1 + alpha;
+    p->a1 =  -2*cos(w0);
+    p->a2 =   1 - alpha;
+  } else {                    /* 1-pole */
+    p->a0 = 1;
+    p->a1 = -exp(-w0);
+    if (*effp->name == 'l') { /* lowpass */
+      p->b0 = 1 + p->a1;
+      p->b1 = 0;
+    } else {
+      p->b0 = (1 - p->a1)/2;
+      p->b1 = -p->b0;
+    }
+    p->a2 = p->b2 = 0;
+  }
+  return st_biquad_start(effp, "Q");
+}
+
+st_effect_t const * st_lowp_effect_fn(void)
+{
+  static st_effect_t driver = {
+    "lowp", "Usage: lowp cutoff", 0,
+    getopts, start, st_biquad_flow,
+    st_effect_nothing_drain, st_effect_nothing, st_effect_nothing
+  };
+  return &driver;
+}
+
+st_effect_t const * st_highp_effect_fn(void)
+{
+  static st_effect_t driver = {
+    "highp", "Usage: highp cutoff", 0,
+    getopts, start, st_biquad_flow,
+    st_effect_nothing_drain, st_effect_nothing, st_effect_nothing
+  };
+  return &driver;
+}
+
+st_effect_t const * st_lowpass_effect_fn(void)
+{
+  static st_effect_t driver = {
+    "lowpass", "Usage: lowpass [-1|-2] frequency [Q]", 0,
+    getopts, start, st_biquad_flow,
+    st_effect_nothing_drain, st_effect_nothing, st_effect_nothing
+  };
+  return &driver;
+}
+
+st_effect_t const * st_highpass_effect_fn(void)
+{
+  static st_effect_t driver = {
+    "highpass", "Usage: highpass [-1|-2] frequency [Q]", 0,
+    getopts, start, st_biquad_flow,
+    st_effect_nothing_drain, st_effect_nothing, st_effect_nothing
+  };
+  return &driver;
+}
--- a/src/flanger.c
+++ b/src/flanger.c
@@ -1,9 +1,20 @@
-/*  Sound Tools Effect: Stereo Flanger
+/*
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
  *
- *  (c) 2006 robs@users.sourceforge.net
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser
+ * General Public License for more details.
  *
- *  See LICENSE file for further copyright information.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library.  If not, write to the Free Software Foundation,
+ * Fifth Floor, 51 Franklin Street, Boston, MA 02111-1301, USA.
  */
+
+/* Effect: Stereo Flanger   (c) 2006 robs@users.sourceforge.net */
 
 #define st_flanger_usage \
   "Usage: flanger [delay depth regen width speed shape phase interp]\n"
--- a/src/highp.c
+++ /dev/null
@@ -1,143 +1,0 @@
-/*
- * Sound Tools High-Pass effect file.
- *
- * (C) 2000 Chris Bagwell <cbagwell@sprynet.com>
- * See License file for further copyright information.
- *
- * Algorithm:  Recursive single pole high-pass filter
- *
- * Reference: The Scientist and Engineer's Guide to Digital Processing
- *
- *      output[N] = A0 * input[N] + A1 * input[N-1] + B1 * output[N-1]
- *
- *      X  = exp(-2.0 * pi * Fc)
- *      A0 = (1 + X) / 2
- *      A1 = -(1 + X) / 2
- *      B1 = X
- *      Fc = cutoff freq / sample rate
- *
- * Mimics an RC high-pass filter:
- *
- *        || C
- *    ----||--------->
- *        ||    |
- *              <
- *              > R
- *              <
- *              |
- *              V
- *
- */
-
-#include <math.h>
-#include "st_i.h"
-
-static st_effect_t st_highp_effect;
-
-/* Private data for Highpass effect */
-typedef struct highpstuff {
-        float   cutoff;
-        double  A0, A1, B1;
-        double  inm1, outm1;
-} *highp_t;
-
-/*
- * Process options
- */
-static int st_highp_getopts(eff_t effp, int n, char **argv) 
-{
-        highp_t highp = (highp_t) effp->priv;
-
-        if ((n < 1) || !sscanf(argv[0], "%f", &highp->cutoff))
-        {
-                st_fail(st_highp_effect.usage);
-                return (ST_EOF);
-        }
-        return (ST_SUCCESS);
-}
-
-/*
- * Prepare processing.
- */
-static int st_highp_start(eff_t effp)
-{
-        highp_t highp = (highp_t) effp->priv;
-        if (highp->cutoff > effp->ininfo.rate/2)
-        {
-                st_fail("Highpass: cutoff must be < sample rate / 2 (Nyquest rate)");
-                return (ST_EOF);
-        }
-
-        highp->B1 = exp((-2.0 * M_PI * (highp->cutoff / effp->ininfo.rate)));
-        highp->A0 = (1 + highp->B1) / 2;
-        highp->A1 = (-1 * (1 + highp->B1)) / 2;
-        highp->inm1 = 0.0;
-        highp->outm1 = 0.0;
-
-        if (effp->globalinfo->octave_plot_effect)
-        {
-          printf(
-            "title('SoX effect: %s cutoff=%g (rate=%u)')\n"
-            "xlabel('Frequency (Hz)')\n"
-            "ylabel('Amplitude Response (dB)')\n"
-            "Fs=%u;minF=10;maxF=Fs/2;\n"
-            "axis([minF maxF -95 5])\n"
-            "sweepF=logspace(log10(minF),log10(maxF),200);\n"
-            "grid on\n"
-            "[h,w]=freqz([%f %f],[1 %f],sweepF,Fs);\n"
-            "semilogx(w,20*log10(h),'b')\n"
-            "pause\n"
-            , effp->name, highp->cutoff
-            , effp->ininfo.rate, effp->ininfo.rate
-            , highp->A0, highp->A1, -highp->B1
-            );
-          return ST_EOF;
-        }
-        return (ST_SUCCESS);
-}
-
-/*
- * Processed signed long samples from ibuf to obuf.
- * Return number of samples processed.
- */
-static int st_highp_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, 
-                  st_size_t *isamp, st_size_t *osamp)
-{
-        highp_t highp = (highp_t) effp->priv;
-        int len, done;
-        double d;
-        st_sample_t l;
-
-        len = ((*isamp > *osamp) ? *osamp : *isamp);
-
-        for(done = 0; done < len; done++) {
-                l = *ibuf++;
-                d = highp->A0 * l + 
-                    highp->A1 * highp->inm1 + 
-                    highp->B1 * highp->outm1;
-                ST_SAMPLE_CLIP_COUNT(d, effp->clips);
-                highp->inm1 = l;
-                highp->outm1 = d;
-                *obuf++ = d;
-        }
-        *isamp = len;
-        *osamp = len;
-        return (ST_SUCCESS);
-}
-
-static st_effect_t st_highp_effect = {
-  "highp",
-  "Usage: highp cutoff",
-  0,
-  st_highp_getopts,
-  st_highp_start,
-  st_highp_flow,
-  st_effect_nothing_drain,
-  st_effect_nothing,
-  st_effect_nothing
-};
-
-const st_effect_t *st_highp_effect_fn(void)
-{
-    return &st_highp_effect;
-}
--- a/src/highpass.c
+++ /dev/null
@@ -1,90 +1,0 @@
-/*
-    High-pass effect file for SoX
-    Copyright (C) 1999 Jan Paul Schmidt <jps@fundament.org>
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2 of the License, or (at your option) any later version.
- 
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
- 
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-    Code based on the high-pass implementation in
-
-    Sound Processing Kit - A C++ Class Library for Audio Signal Processing
-    Copyright (C) 1995-1998 Kai Lassfolk
-
-    as described in
-
-    Computer music: synthesis, composition, and performance
-    Charles Dodge, Thomas A. Jerse
-    [2nd ed.]
-    Page 215
-
- */
-
-#include <math.h>
-
-#include "st_i.h"
-#include "btrworth.h"
-
-static st_effect_t st_highpass_effect;
-
-static int st_highpass_getopts(eff_t effp, int n, char **argv) 
-{
-  butterworth_t butterworth = (butterworth_t)effp->priv;
-
-  if (n != 1) {
-    st_fail(st_highpass_effect.usage);
-    return (ST_EOF);
-  }
-
-  st_butterworth_start (effp);
-
-  if (!(sscanf (argv [0], "%lf", &butterworth->frequency))) {
-    st_fail("highpass: illegal frequency");
-    return (ST_EOF);
-  }
-  return (ST_SUCCESS);
-}
-
-static int st_highpass_start(eff_t effp)
-{
-  butterworth_t butterworth = (butterworth_t) effp->priv;
-  double c;
-
-  c = tan (M_PI * butterworth->frequency / effp->ininfo.rate);
-
-  butterworth->a [0] = 1.0 / (1.0 + sqrt (2.0) * c + c * c);
-  butterworth->a [1] = -2.0 * butterworth->a [0];
-  butterworth->a [2] = butterworth->a [0];
-
-  butterworth->b [0] = 2 * (c * c - 1.0) * butterworth->a[0];
-  butterworth->b [1] = (1.0 - sqrt(2.0) * c + c * c) * butterworth->a [0];
-  st_butterworth_plot(effp);
-  return (ST_SUCCESS);
-}
-
-static st_effect_t st_highpass_effect = {
-  "highpass",
-  "Usage: highpass FREQUENCY",
-  0,
-  st_highpass_getopts,
-  st_highpass_start,
-  st_butterworth_flow,
-  st_effect_nothing_drain,
-  st_effect_nothing,
-  st_effect_nothing
-};
-
-const st_effect_t *st_highpass_effect_fn(void)
-{
-    return &st_highpass_effect;
-}
--- a/src/lowp.c
+++ /dev/null
@@ -1,136 +1,0 @@
-/*
- * Sound Tools Low-Pass effect file.
- *
- * (C) 2000 Chris Bagwell <cbagwell@sprynet.com>
- * See License file for further copyright information.
- *
- * Algorithm:  Recursive single pole lowpass filter
- *
- * Reference: The Scientist and Engineer's Guide to Digital Signal Processing
- *
- *      output[N] = input[N] * A + output[N-1] * B
- *
- *      X = exp(-2.0 * pi * Fc)
- *      A = 1 - X
- *      B = X
- *      Fc = cutoff freq / sample rate
- *
- * Mimics an RC low-pass filter:   
- *
- *     ---/\/\/\/\----------->
- *                    |
- *                   --- C
- *                   ---
- *                    |
- *                    |
- *                    V
- *
- */
-
-#include <math.h>
-#include "st_i.h"
-
-static st_effect_t st_lowp_effect;
-
-/* Private data for Lowpass effect */
-typedef struct lowpstuff {
-        float   cutoff;
-        double  A, B;
-        double  outm1;
-} *lowp_t;
-
-/*
- * Process options
- */
-static int st_lowp_getopts(eff_t effp, int n, char **argv) 
-{
-        lowp_t lowp = (lowp_t) effp->priv;
-
-        if ((n < 1) || !sscanf(argv[0], "%f", &lowp->cutoff))
-        {
-                st_fail(st_lowp_effect.usage);
-                return (ST_EOF);
-        }
-        return (ST_SUCCESS);
-}
-
-/*
- * Prepare processing.
- */
-static int st_lowp_start(eff_t effp)
-{
-        lowp_t lowp = (lowp_t) effp->priv;
-        if (lowp->cutoff > effp->ininfo.rate / 2)
-        {
-                st_fail("Lowpass: cutoff must be < sample rate / 2 (Nyquest rate)");
-                return (ST_EOF);
-        }
-
-        lowp->B = exp((-2.0 * M_PI * (lowp->cutoff / effp->ininfo.rate)));
-        lowp->A = 1 - lowp->B;
-        lowp->outm1 = 0.0;
-
-        if (effp->globalinfo->octave_plot_effect)
-        {
-          printf(
-            "title('SoX effect: %s cutoff=%g (rate=%u)')\n"
-            "xlabel('Frequency (Hz)')\n"
-            "ylabel('Amplitude Response (dB)')\n"
-            "Fs=%u;minF=10;maxF=Fs/2;\n"
-            "axis([minF maxF -95 5])\n"
-            "sweepF=logspace(log10(minF),log10(maxF),200);\n"
-            "grid on\n"
-            "[h,w]=freqz([%f 0],[1 %f],sweepF,Fs);\n"
-            "semilogx(w,20*log10(h),'b')\n"
-            "pause\n"
-            , effp->name, lowp->cutoff
-            , effp->ininfo.rate, effp->ininfo.rate
-            , lowp->A, -lowp->B
-            );
-          return ST_EOF;
-        }
-        return (ST_SUCCESS);
-}
-
-/*
- * Processed signed long samples from ibuf to obuf.
- * Return number of samples processed.
- */
-static int st_lowp_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, 
-                 st_size_t *isamp, st_size_t *osamp)
-{
-        lowp_t lowp = (lowp_t) effp->priv;
-        int len, done;
-        double d;
-        st_sample_t l;
-
-        len = ((*isamp > *osamp) ? *osamp : *isamp);
-
-        for(done = 0; done < len; done++) {
-                l = *ibuf++;
-                d = lowp->A * l + lowp->B * lowp->outm1;
-                ST_SAMPLE_CLIP_COUNT(d, effp->clips);
-                lowp->outm1 = d;
-                *obuf++ = d;
-        }
-        *isamp = len;
-        *osamp = len;
-        return (ST_SUCCESS);
-}
-
-static st_effect_t st_lowp_effect = {
-  "lowp",
-  "Usage: lowp cutoff",
-  0,
-  st_lowp_getopts,
-  st_lowp_start,
-  st_lowp_flow,
-  st_effect_nothing_drain,
-  st_effect_nothing,
-  st_effect_nothing
-};
-
-const st_effect_t *st_lowp_effect_fn(void)
-{
-    return &st_lowp_effect;
-}
--- a/src/lowpass.c
+++ /dev/null
@@ -1,79 +1,0 @@
-/*
-
-    Low-pass effect file for SoX
-    Copyright (C) 1999 Jan Paul Schmidt <jps@fundament.org>
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2 of the License, or (at your option) any later version.
- 
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
- 
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
- */
-
-#include <math.h>
-
-#include "st_i.h"
-#include "btrworth.h"
-
-static st_effect_t st_lowpass_effect;
-
-static int st_lowpass_getopts(eff_t effp, int n, char **argv)
-{
-  butterworth_t butterworth = (butterworth_t)effp->priv;
-
-  if (n != 1) {
-    st_fail(st_lowpass_effect.usage);
-    return (ST_EOF);
-  }
-
-  st_butterworth_start (effp);
-
-  if (!(sscanf (argv [0], "%lf", &butterworth->frequency))) {
-    st_fail("lowpass: illegal frequency");
-    return (ST_EOF);
-  }
-  return (ST_SUCCESS);
-}
-
-static int st_lowpass_start(eff_t effp)
-{
-  butterworth_t butterworth = (butterworth_t) effp->priv;
-  double c;
-
-  c = 1.0 / tan (M_PI * butterworth->frequency / effp->ininfo.rate);
-
-  butterworth->a [0] = 1.0 / (1.0 + sqrt(2.0) * c + c * c);
-  butterworth->a [1] = 2.0 * butterworth->a [0];
-  butterworth->a [2] = butterworth->a [0];
-
-  butterworth->b [0] = 2 * (1.0 - c * c) * butterworth->a[0];
-  butterworth->b [1] = (1.0 - sqrt(2.0) * c + c * c) * butterworth->a [0];
-  st_butterworth_plot(effp);
-  return (ST_SUCCESS);
-}
-
-static st_effect_t st_lowpass_effect = {
-  "lowpass",
-  "Usage: lowpass FREQUENCY",
-  0,
-  st_lowpass_getopts,
-  st_lowpass_start,
-  st_butterworth_flow,
-  st_effect_nothing_drain,
-  st_effect_nothing,
-  st_effect_nothing
-};
-
-const st_effect_t *st_lowpass_effect_fn(void)
-{
-    return &st_lowpass_effect;
-}
--- a/src/pad.c
+++ b/src/pad.c
@@ -1,18 +1,17 @@
 /*
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
  *
  * This library is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser
+ * General Public License for more details.
  *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library.  If not, write to the Free Software
- * Foundation, Fifth Floor, 51 Franklin Street, Boston, MA 02111-1301,
- * USA.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library.  If not, write to the Free Software Foundation,
+ * Fifth Floor, 51 Franklin Street, Boston, MA 02111-1301, USA.
  */
 
 /* Effect: Pad With Silence   (c) 2006 robs@users.sourceforge.net */