shithub: sox

Download patch

ref: 795a0c5a2377c4a454eef75f728f1f8b1e145288
parent: c401a824450c61471ff16610a194f34b67485933
author: robs <robs>
date: Mon Dec 29 14:59:46 EST 2008

remove old resamplers but retain their interfaces for the time being

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -87,7 +87,6 @@
 optional(HAVE_MAGIC magic.h magic magic_open "")
 #optional(HAVE_OGG_SPEEX speex/speex.h speex speex_decoder_init speex)
 optional(HAVE_PNG png.h png png_set_rows spectrogram)
-optional(HAVE_SAMPLERATE_H samplerate.h samplerate src_simple rabbit)
 optional(HAVE_SNDFILE sndfile.h sndfile sf_open sndfile)
 optional(HAVE_SNDFILE sndfile.h sndfile sf_open fap)
 optional(HAVE_SNDFILE sndfile.h sndfile sf_open mat4)
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,13 +4,41 @@
 This file contains a list of all changes starting after the release of
 sox-11gamma.
 
-sox-14.x.x	200x-xx-xx
+sox-14.x.x	2009-xx-xx
 ----------
 
-Deprecation status:
+Previously deprecated features that have been removed in this release:
 
-  Unchanged from 14.2.0
+  Deprec-  Feature    [O(ption)]
+  ated in  [F(ormat)] [E(ffect)]   Replacement
+  -------  ----------------------  ----------------------
+  14.1.0   E resample *            ~= rate
+  14.1.0   E polyphase *           ~= rate
+  14.1.0   E rabbit *              ~= rate
+  14.1.0   F flac: libFLAC 1.1.1   libFLAC > 1.1.1
 
+  * But interface retained as an alias for `rate'.
+
+Previously deprecated features (to be removed in future):
+
+  Deprec-  Feature    [O(ption)]                           Removal
+  ated in  [F(ormat)] [E(ffect)]   Replacement             due after
+  -------  ----------------------  ----------------------  -------
+  14.2.0   E key alias             pitch                   2009-05-29
+  14.2.0   E pan                   ~= mixer/remix          2009-05-29
+  14.1.0   E resample alias        rate                    14.x.x + 6 months
+  14.1.0   E polyphase alias       rate                    14.x.x + 6 months
+  14.1.0   E rabbit alias          rate                    14.x.x + 6 months
+  14.1.0   F wve (native)          wve (libsndfile)        2009-07-29
+  14.1.0   Behaviour whereby       soxi                    2009-07-29
+           sox -V file(s) -n
+           doesn't read to EOF.
+
+LibSoX interface changes:
+
+  o Use of sox_effect_options() is now mandatory when initialising an
+    effect (see example0.c for an example of this).
+
 File formats:
 
   o Slight improvement to A-law/u-law conversion accuracy: round LSB
@@ -55,12 +83,7 @@
     pseudo random number generators.  (robs)
   o Rationalise effects' options interface (getopt compatible).  (robs)
 
-LibSoX interface changes:
 
-  o Use of sox_effect_options() is now mandatory when initialising an
-    effect (see example0.c for an example of this).
-
-
 sox-14.2.0	2008-11-09
 ----------
 
@@ -71,28 +94,6 @@
   -------  ----------------------  ----------------------
   14.0.0   E pitch                 new pitch = old key
 
-Previously deprecated features (to be removed in future):
-
-  Deprec-  Feature    [O(ption)]                           Removal
-  ated in  [F(ormat)] [E(ffect)]   Replacement             due after
-  -------  ----------------------  ----------------------  -------
-  14.1.0   E resample              ~= rate                 2009-01-29
-  14.1.0   E polyphase             ~= rate                 2009-01-29
-  14.1.0   E rabbit                ~= rate                 2009-01-29
-  14.1.0   F flac: libFLAC 1.1.1   libFLAC > 1.1.1         2009-01-29
-  14.1.0   F wve (native)          wve (libsndfile)        2009-07-29
-  14.1.0   Behaviour whereby       soxi                    2009-07-29
-           sox -V file(s) -n
-           doesn't read to EOF.
-
-Newly deprecated features (to be removed in future):
-
-  Deprec-  Feature    [O(ption)]                           Removal
-  ated in  [F(ormat)] [E(ffect)]   Replacement             due after
-  -------  ----------------------  ----------------------  -------
-  14.2.0   E key                   renamed to pitch        14.2.0 + 6 months
-  14.2.0   E pan                   ~= mixer/remix          14.2.0 + 6 months
-
 File formats:
 
   o New `.cvu' unfiltered CVSD; supports any bit-rate.  (robs)
@@ -190,28 +191,6 @@
   13.0.0   E mask                  dither
   13.0.0   E vibro                 ~= tremolo
   13.0.0   F auto                  Becomes internal only
-
-Previously deprecated features (to be removed in future):
-
-  Deprec-  Feature    [O(ption)]                           Removal
-  ated in  [F(ormat)] [E(ffect)]   Replacement             due after
-  -------  ----------------------  ----------------------  -------
-  14.0.0   E stretch               ~= tempo                2008-09-11
-  14.0.0   E pitch                 ~= key                  2008-09-11
-
-Newly deprecated features (to be removed in future):
-
-  Deprec-  Feature    [O(ption)]                           Removal
-  ated in  [F(ormat)] [E(ffect)]   Replacement             due after
-  -------  ----------------------  ----------------------  -------
-  14.1.0   F wve (native)          wve (libsndfile)        14.1.0 + 1 year
-  14.1.0   F flac: libFLAC 1.1.1   libFLAC > 1.1.1         14.1.0 + 6 months
-  14.1.0   E resample              ~= rate                 14.1.0 + 1 year
-  14.1.0   E polyphase             ~= rate                 14.1.0 + 1 year
-  14.1.0   E rabbit                ~= rate                 14.1.0 + 1 year
-  14.1.0   Behaviour whereby       soxi                    14.1.0 + 1 year
-           sox -V file(s) -n
-           doesn't read to EOF.
 
 File formats:
 
--- a/INSTALL
+++ b/INSTALL
@@ -86,7 +86,6 @@
 Magic              http://www.darwinsys.com/file         GPL
 Ogg Vorbis         http://www.vorbis.com                 BSD
 PNG                http://www.libpng.org/pub/png         zlib (BSD-like)
-Secret Rabbit Code http://www.mega-nerd.com/SRC          GPL
 Sndfile            http://www.mega-nerd.com/libsndfile   LGPL
 WavPack            http://www.wavpack.com                BSD
   
--- a/configure.ac
+++ b/configure.ac
@@ -587,21 +587,6 @@
 AM_CONDITIONAL(HAVE_PNG, test x$using_png = xyes)
 AC_SUBST(PNG_LIBS)
 
-dnl Test for libsamplerate.
-AC_ARG_WITH(samplerate,
-    AC_HELP_STRING([--without-samplerate],
-        [Don't try to use libsamplerate (aka Secret Rabbit Code)]))
-using_samplerate=no
-if test "$with_samplerate" != "no"; then
-    using_samplerate=yes
-    SOX_PATH_SAMPLERATE(, using_samplerate=no)
-    if test "$with_samplerate" = "yes" -a "$using_samplerate" = "no"; then
-        AC_MSG_FAILURE([cannot find libsamplerate])
-    fi
-fi
-AC_SUBST(SAMPLERATE_CFLAGS)
-AC_SUBST(SAMPLERATE_LIBS)
-
 dnl Test for LADSPA
 AC_ARG_WITH(ladspa,
     AC_HELP_STRING([--without-ladspa], [Don't try to use LADSPA]))
@@ -670,7 +655,6 @@
 echo "WavPack format.................... $using_wavpack"
 echo "LADSPA effects.................... $using_ladspa"
 echo "PNG support....................... $using_png"
-echo "Secret Rabbit Code resampling..... $using_samplerate"
 echo "pkg-config location............... $pkgconfig_option"
 echo
 echo "Configure finished.  Do 'make && make install' to compile and install SoX."
--- a/sox.1
+++ b/sox.1
@@ -2288,13 +2288,6 @@
 effects all use the
 .B rate
 effect at their core.
-.SP
-See also
-.BR resample ,
-.B polyphase
-and
-.B rabbit
-for other sample-rate changing effects.
 .TP
 \fBremix\fR [\fB\-a\fR\^|\^\fB\-m\fR\^|\^\fB\-p\fR] <\fIout-spec\fR>
 \fIout-spec\fR	= \fIin-spec\fR{\fB,\fIin-spec\fR} | \fB0\fR
@@ -3232,140 +3225,19 @@
 .I direction
 is a value from \-1 to 1.  \-1 represents
 far left and 1 represents far right.
-.TP
+.PP
 \fBpolyphase\fR [\fB\-w nut\fR\^|\^\fBham\fR] [\fB\-width \fIn\fR] [\fB\-cut-off \fIc\fR]
-Change the sampling rate using `polyphase interpolation', a DSP algorithm.
-\fBpolyphase\fR copes with only certain rational fraction resampling ratios,
-and, compared with the \fBrate\fR effect, is generally slow, memory intensive,
-and has poorer stop-band rejection.
-.SP
-If the \fB\-w\fR parameter is \fBnut\fR, then a Blackman-Nuttall (~90 dB
-stop-band) window will be used; \fBham\fR selects a Hamming (~43
-dB stop-band) window.  The default is Blackman-Nuttall.
-.SP
-The \fB\-width\fR parameter specifies the (approximate) width of the filter. The default is 1024 samples, which produces reasonable results.
-.SP
-The \fB\-cut-off\fR value (\fIc\fR) specifies the filter cut-off frequency in terms of fraction of
-frequency bandwidth, also know as the Nyquist frequency.  See
-the \fBresample\fR effect for
-further information on Nyquist frequency.  If up-sampling, then this is the
-fraction of the original signal
-that should go through.  If down-sampling, this is the fraction of the
-signal left after down-sampling.  The default is 0\*d95.
-.SP
-See also
-.BR rate ,
-.B rabbit
-and
-.B resample
-for other sample-rate changing effects.
-.TP
+.br
 \fBrabbit\fR [\fB\-c0\fR\^|\^\fB\-c1\fR\^|\^\fB\-c2\fR\^|\^\fB\-c3\fR\^|\^\fB\-c4\fR]
-Change the sampling rate using libsamplerate, also known as `Secret Rabbit
-Code'.  This effect is optional and, due to licence issues,
-is not included in all versions of SoX.
-Compared with the \fBrate\fR effect, \fBrabbit\fR is very slow.
-.SP
-See http://www.mega-nerd.com/SRC for details of the algorithms.  Algorithms
-0 through 2 are progressively faster and lower quality versions of the
-sinc algorithm; the default is \fB\-c0\fR.
-Algorithm 3 is zero-order hold, and 4 is linear interpolation.
-.SP
-See also
-.BR rate ,
-.B polyphase
-and
-.B resample
-for other sample-rate changing effects, and see
-\fBresample\fR for more discussion of resampling.
-.TP
+.br
 \fBresample\fR [\fB\-qs\fR\^|\^\fB\-q\fR\^|\^\fB\-ql\fR] [\fIrolloff\fR [\fIbeta\fR]]
-Change the sampling rate using simulated analog filtration.
-Compared with the \fBrate\fR effect, \fBresample\fR is slow, and has poorer
-stop-band rejection.
-Only the low quality option works with all resampling ratios.
-.SP
-By default, linear interpolation of the filter coefficients is used,
-with a window width about 45 samples at the lower of the two rates.
-This gives an accuracy of about 16 bits, but insufficient stop-band rejection
-in the case that you want to have roll-off greater than about 0\*d8 of
-the Nyquist frequency.
-.SP
-The \fB\-q*\fR options will change the default values for roll-off and beta
-as well as use quadratic interpolation of filter
-coefficients, resulting in about 24 bits precision.
-The \fB\-qs\fR, \fB\-q\fR, or \fB\-ql\fR options specify increased accuracy
-at the cost of lower execution speed.  It is optional to specify
-roll-off and beta parameters when using the \fB\-q*\fR options.
-.SP
-Following is a table of the reasonable defaults which are built-in to
-SoX:
-.SP
-.TS
-center box;
-cB cB cB cB cB
-c c n c c
-cB c n c c.
-Option	Window	Roll-off	Beta	Interpolation
-(none)	45	0\*d80	16	linear
-\-qs	45	0\*d80	16	quadratic
-\-q	75	0\*d875	16	quadratic
-\-ql	149	0\*d94	16	quadratic
-.TE
-.DT
-.SP
-\fB\-qs\fR, \fB\-q\fR, or \fB\-ql\fR use window lengths of 45, 75, or 149
-samples, respectively, at the lower sample-rate of the two files.
-This means progressively sharper stop-band rejection, at proportionally
-slower execution times.
-.SP
-\fIrolloff\fR refers to the cut-off frequency of the
-low pass filter and is given in terms of the
-Nyquist frequency for the lower sample rate.  rolloff therefore should
-be something between 0 and 1, in practise 0\*d8\-0\*d95.  The defaults are
-indicated above.
-.SP
-The \fINyquist frequency\fR is equal to half the sample rate.  Logically,
-this is because the A/D converter needs at least 2 samples to detect 1
-cycle at the Nyquist frequency.  Frequencies higher then the Nyquist
-will actually appear as lower frequencies to the A/D converter and
-is called aliasing.  Normally, A/D converts run the signal through
-a lowpass filter first to avoid these problems.
-.SP
-Similar problems will happen in software when reducing the sample rate of
-an audio file (frequencies above the new Nyquist frequency can be aliased
-to lower frequencies).  Therefore, a good resample effect
-will remove all frequency information above the new Nyquist frequency.
-.SP
-The \fIrolloff\fR refers to how close to the Nyquist frequency this cut-off
-is, with closer being better.  When increasing the sample rate of an
-audio file you would not expect to have any frequencies exist that are
-past the original Nyquist frequency.  Because of resampling properties, it
-is common to have aliasing artifacts created above the old
-Nyquist frequency.  In that case the \fIrolloff\fR refers to how close
-to the original Nyquist frequency to use a highpass filter to remove
-these artifacts, with closer also being better.
-.SP
-The \fIbeta\fR, if unspecified, defaults to 16.  This selects a Kaiser window.
-You can select a Blackman-Nuttall window by specifying anything \(<= 2 here.
-For more discussion of beta, look under the \fBfilter\fR effect.
-.SP
-Default parameters are, as indicated above, Kaiser window of length 45,
-roll-off 0\*d80, beta 16, linear interpolation.
-.SP
-Note: \fB\-qs\fR is only slightly slower, but more accurate for
-16-bit or higher precision.
-.SP
-See also
-.BR rate ,
-.B polyphase
-and
-.B rabbit
-for other sample-rate changing effects.
-There is a detailed analysis of
-\fBresample\fR and \fBpolyphase\fR at
-http://leute.server.de/wilde/resample.html; see \fBrabbit\fR for a
-pointer to its own documentation.
+.if t .sp -.5
+.if n .sp -1
+.TP
+\ 
+Formerly sample-rate-changing effects in their own right, these are now just aliases for the
+.B rate
+effect.
 .SH DIAGNOSTICS
 Exit status is 0 for no error, 1 if there is a problem with the
 command-line parameters, or 2 if an error occurs during file processing.
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -28,16 +28,16 @@
 
 # Format with: !xargs echo|tr ' ' '\n'|sort|column|expand|sed 's/^/  /'
 set(effects_srcs
-  bend            dither          lowfir          phaser          speed
-  biquad          earwax          mcompand        polyphas        splice
-  biquads         echo            mixer           rate            stat
-  chorus          echos           noiseprof       remix           stretch
-  compand         fade            noisered        repeat          swap
-  compandt        fft4g           normalise       resample        synth
-  contrast        filter          output          reverb          tempo
-  dcshift         flanger         overdrive       reverse         tremolo
-  delay           input           pad             silence         trim
-  dft_filter      loudness        pan             skeleff         vol
+  bend            dither          lowfir          phaser          stat
+  biquad          earwax          mcompand        rate            stretch
+  biquads         echo            mixer           remix           swap
+  chorus          echos           noiseprof       repeat          synth
+  compand         fade            noisered        reverb          tempo
+  compandt        fft4g           normalise       reverse         tremolo
+  contrast        filter          output          silence         trim
+  dcshift         flanger         overdrive       skeleff         vol
+  delay           input           pad             speed
+  dft_filter      loudness        pan             splice
 )
 set(formats_srcs
   8svx            dat             ima-fmt         s3-fmt          u3-fmt
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -270,8 +270,8 @@
 	effects_i.c fade.c fft4g.c fft4g.h fifo.h filter.c flanger.c input.c \
 	ladspa.c loudness.c mcompand.c mcompand_xover.h mixer.c noiseprof.c \
 	noisered.c noisered.h normalise.c output.c pad.c pan.c phaser.c \
-	polyphas.c rabbit.c rate.c rate_filters.h rate_half_fir.h \
-	rate_poly_fir0.h rate_poly_fir.h remix.c repeat.c resample.c reverb.c \
+	rate.c rate_filters.h rate_half_fir.h \
+	rate_poly_fir0.h rate_poly_fir.h remix.c repeat.c reverb.c \
 	reverse.c silence.c skeleff.c speed.c splice.c stat.c swap.c stretch.c \
 	synth.c tempo.c tremolo.c trim.c vol.c overdrive.c effects_i_dsp.c \
 	dft_filter.c dft_filter.h lowfir.c
@@ -281,7 +281,7 @@
 
 # Libraries required by libsox for file handlers, effects, or utils;
 # regardless if libltdl is used or not.
-libsox_la_LIBADD = @PNG_LIBS@ @SAMPLERATE_LIBS@
+libsox_la_LIBADD = @PNG_LIBS@
 if HAVE_MAGIC
 libsox_la_LIBADD += @MAGIC_LIBS@
 endif
@@ -289,7 +289,7 @@
 libsox_la_LIBADD += @GOMP_LIBS@
 endif
 
-libsox_la_CFLAGS = @WARN_CFLAGS@  @SAMPLERATE_CFLAGS@
+libsox_la_CFLAGS = @WARN_CFLAGS@
 libsox_la_LDFLAGS = @APP_LDFLAGS@ -version-info @SHLIB_VERSION@
 
 if HAVE_LIBLTDL
--- a/src/effects.h
+++ b/src/effects.h
@@ -59,9 +59,7 @@
   EFFECT(phaser)
   EFFECT(pitch)
   EFFECT(polyphase)
-#ifdef HAVE_SAMPLERATE_H
   EFFECT(rabbit)
-#endif
   EFFECT(rate)
   EFFECT(remix)
   EFFECT(repeat)
--- a/src/effects_i.c
+++ b/src/effects_i.c
@@ -48,21 +48,6 @@
   return *usage;
 }
 
-/* here for linear interp.  might be useful for other things */
-unsigned lsx_gcd(unsigned a, unsigned b)
-{
-  if (b == 0)
-    return a;
-  else
-    return lsx_gcd(b, a % b);
-}
-
-unsigned lsx_lcm(unsigned a, unsigned b)
-{
-  /* parenthesize this way to avoid unsigned overflow in product term */
-  return a * (b / lsx_gcd(a, b));
-}
-
 lsx_enum_item const lsx_wave_enum[] = {
   LSX_ENUM_ITEM(SOX_WAVE_,SINE)
   LSX_ENUM_ITEM(SOX_WAVE_,TRIANGLE)
--- a/src/polyphas.c
+++ /dev/null
@@ -1,637 +1,0 @@
-/* libSoX rate change effect file.
- *
- * July 14, 1998
- * Copyright 1998  K. Bradley, Carnegie Mellon University
- *
- * 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.1 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * October 29, 1999
- * Various changes, bugfixes, speedups, by Stan Brooks.
- *
- */
-
-#include "sox_i.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#define Float float/*double*/
-#define ISCALE 0x10000
-#define MF 30
-
-typedef struct {
-  int up, down;   /* up/down conversion factors for this stage      */
-  int filt_len;   /* # coefficients in filter_array                 */
-  Float *filt_array; /* filter coefficients                         */
-  int held;       /* # samples held in input but not yet processed  */
-  int hsize;      /* # samples of past-history kept in lower window */
-  int size;       /* # samples current data which window can accept */
-  Float *window;  /* this is past_hist[hsize], then input[size]     */
-} polystage;
-
-typedef struct {
-  unsigned lcmrate;             /* least common multiple of rates */
-  unsigned inskip, outskip;     /* LCM increments for I & O rates */
-  double Factor;                 /* out_rate/in_rate               */
-  unsigned long total;           /* number of filter stages        */
-  size_t oskip;               /* output samples to skip at start*/
-  double inpipe;                 /* output samples 'in the pipe'   */
-  polystage *stage[MF];          /* array of pointers to polystage structs */
-  int win_type;
-  int win_width;
-  Float cutoff;
-  int m1[MF], m2[MF], b1[MF], b2[MF]; /* arrays used in optimize_factors */
-} priv_t;
-
-/*
- * Process options
- */
-static int sox_poly_getopts(sox_effect_t * effp, int argc, char **argv)
-{
-  priv_t * rate = (priv_t *) effp->priv;
-  --argc, ++argv;
-
-  rate->win_type = 0;           /* 0: nuttall, 1: hamming */
-  rate->win_width = 1024;
-  rate->cutoff = 0.95;
-
-  while (argc >= 2) {
-    /* Window type check */
-    if(!strcmp(argv[0], "-w")) {
-      if(!strcmp(argv[1], "ham"))
-        rate->win_type = 1;
-      if(!strcmp(argv[1], "nut"))
-        rate->win_type = 0;
-      argv += 2;
-      argc -= 2;
-      continue;
-    }
-
-    /* Window width check */
-    if(!strcmp(argv[0], "-width")) {
-        rate->win_width = atoi(argv[1]);
-      argv += 2;
-      argc -= 2;
-      continue;
-    }
-
-    /* Cutoff frequency check */
-    if(!strcmp(argv[0], "-cutoff")) {
-      rate->cutoff = atof(argv[1]);
-      argv += 2;
-      argc -= 2;
-      continue;
-    }
-
-    lsx_fail("Polyphase: unknown argument (%s %s)!", argv[0], argv[1]);
-    return SOX_EOF;
-  }
-
-  return SOX_SUCCESS;
-}
-
-/*
- * Prepare processing.
- */
-static const unsigned short primes[] = {
-  2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37,
-  41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89,
-  97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151,
-  157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223,
-  227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281,
-  283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359,
-  367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433,
-  439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503,
-  509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593,
-  599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659,
-  661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743,
-  751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827,
-  829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911,
-  919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997,
-  0
-};
-
-static int prime(unsigned n, int *q0)
-{
-  const unsigned short *p;
-  int pr, *q;
-
-  p = primes;
-  q = q0;
-  lsx_debug("factors(%d) =",n);
-  while (n > 1) {
-    while ((pr = *p) && (n % pr)) p++;
-    if (!pr) {
-      lsx_fail("Number %d too large of a prime.",n);
-      pr = n;
-    }
-    *q++ = pr;
-    n /= pr;
-  }
-  *q = 0;
-  for (pr=0; pr<q-q0; pr++) lsx_debug(" %d",q0[pr]);
-  lsx_debug(" ");
-  return (q-q0);
-}
-
-static int permute(int *m, int *l, int ct, int ct1, size_t amalg)
-{
-  size_t k, n;
-  int *p;
-  int *q;
-
-  p=l; q=m;
-  while (ct1>ct) { *q++=1; ct++;}
-  while ((*q++=*p++)) ;
-  if (ct<=1) return ct;
-
-  for (k=ct; k>1; ) {
-    int tmp;
-    unsigned long j;
-    j = (rand()%32768) + ((rand()%32768)<<13); /* reasonably big */
-    j = j % k; /* non-negative! */
-    k--;
-    if (j != k) {
-      tmp = m[k]; m[k]=m[j]; m[j]=tmp;
-    }
-  }
-  /* now m is a 'random' permutation of l */
-  p = q = m;
-  n = *q++;
-  while ((k=*q++)) {
-    if ((n * k <= amalg) && (rand() & 1)) {
-      n *= k;
-    } else {
-      *p++ = n;
-      n = k;
-    }
-  }
-  if (n) *p++=n;
-  *p = 0;
-  /*for (k=0; k<p-m; k++) lsx_debug(" %d",m[k]);*/
-  /*lsx_debug("");*/
-  return (p-m);
-}
-
-static int optimize_factors(priv_t * rate, unsigned numer, unsigned denom, int *l1, int *l2)
-{
-  unsigned f_min;
-  int c_min,u_min,ct1,ct2;
-  size_t amalg;
-  int k;
-
-  memset(rate->m1,0,sizeof(int)*MF);
-  memset(rate->m2,0,sizeof(int)*MF);
-  memset(rate->b1,0,sizeof(int)*MF);
-  memset(rate->b2,0,sizeof(int)*MF);
-
-  f_min = numer; if (f_min>denom) f_min = denom;
-  c_min = 1<<30;
-  u_min = 0;
-
-  /* Find the prime factors of numer and denom */
-  ct1 = prime(numer,l1);
-  ct2 = prime(denom,l2);
-
-  for (amalg = max(9,l2[0]); amalg <= (size_t)(9+l2[ct2-1]); amalg++) {
-    for (k = 0; k<100000; k++) {
-      unsigned f;
-      int u,u1,u2,j,cost;
-      cost = 0;
-      f = denom;
-      u = min(ct1,ct2) + 1;
-      /*lsx_debug("pfacts(%d): ", numer);*/
-      u1 = permute(rate->m1,l1,ct1,u,amalg);
-      /*lsx_debug("pfacts(%d): ", denom);*/
-      u2 = permute(rate->m2,l2,ct2,u,amalg);
-      u = max(u1,u2);
-      for (j=0; j<u; j++) {
-        if (j>=u1) rate->m1[j]=1;
-        if (j>=u2) rate->m2[j]=1;
-        f = (f * rate->m1[j])/rate->m2[j];
-        if (f < f_min) goto fail;
-        cost += f + rate->m1[j]*rate->m2[j];
-      }
-      if (c_min>cost) {
-        c_min = cost;
-        u_min = u;
-        if (sox_globals.verbosity >= 4) {
-          lsx_debug("c_min %d, [%d-%d]:",c_min,numer,denom);
-          for (j=0; j<u; j++)
-            lsx_debug(" (%d,%d)",rate->m1[j],rate->m2[j]);
-          lsx_debug(" ");
-        }
-        memcpy(rate->b1,rate->m1,u*sizeof(int));
-        memcpy(rate->b2,rate->m2,u*sizeof(int));
-      }
-     fail:
-        ;;
-    }
-    if (u_min) break;
-  }
-  if (u_min) {
-    memcpy(l1,rate->b1,u_min*sizeof(int));
-    memcpy(l2,rate->b2,u_min*sizeof(int));
-  }
-  l1[u_min] = 0;
-  l2[u_min] = 0;
-  return u_min;
-}
-
-/* Calculate a Nuttall window of a given length.
-   Buffer must already be allocated to appropriate size.
-   */
-
-static void nuttall(Float *buffer, int length)
-{
-  int j;
-  double N;
-  int N1;
-
-  if(buffer == NULL || length <= 0)
-    lsx_fail("Illegal buffer %p or length %d to nuttall.", (void *)buffer, length);
-
-  /* Initial variable setups. */
-  N = length;
-  N1 = length/2;
-
-  for(j = 0; j < length; j++) {
-    buffer[j] = 0.3635819 +
-      0.4891775 * cos(2*M_PI*1*(j - N1) / N) +
-      0.1365995 * cos(2*M_PI*2*(j - N1) / N) +
-      0.0106411 * cos(2*M_PI*3*(j - N1) / N);
-  }
-}
-/* Calculate a Hamming window of given length.
-   Buffer must already be allocated to appropriate size.
-*/
-
-static void hamming(Float *buffer, int length)
-{
-    int j;
-    int N1;
-
-    if(buffer == NULL || length <= 0)
-      lsx_fail("Illegal buffer %p or length %d to hamming.",(void *)buffer,length);
-
-    N1 = length/2;
-    for(j=0;j<length;j++)
-      buffer[j] = 0.5 - 0.46 * cos(M_PI*j/N1);
-}
-
-/* Calculate the sinc function properly */
-
-static Float sinc(double value)
-{
-    return(fabs(value) < 1E-50 ? 1.0 : sin(value) / value);
-}
-
-/* Design a low-pass FIR filter using window technique.
-   Length of filter is in length, cutoff frequency in cutoff.
-   0 < cutoff <= 1.0 (normalized frequency)
-
-   buffer must already be allocated.
-*/
-static void fir_design(priv_t * rate, Float *buffer, int length, double cutoff)
-{
-    int j;
-    double sum;
-
-    if(buffer == NULL || length < 0 || cutoff < 0 || cutoff > M_PI)
-      lsx_fail("Illegal buffer %p, length %d, or cutoff %f.",(void *)buffer,length,cutoff);
-
-    /* Use the user-option of window type */
-    if (rate->win_type == 0)
-      nuttall(buffer, length); /* Design Nuttall window:  ** dB cutoff */
-    else
-      hamming(buffer,length);  /* Design Hamming window:  43 dB cutoff */
-
-    /* lsx_debug("# fir_design length=%d, cutoff=%8.4f",length,cutoff); */
-    /* Design filter:  windowed sinc function */
-    sum = 0.0;
-    for(j=0;j<length;j++) {
-      buffer[j] *= sinc(M_PI*cutoff*(j-length/2)); /* center at length/2 */
-      /* lsx_debug("%.1f %.6f",(float)j,buffer[j]); */
-      sum += buffer[j];
-    }
-    sum = (double)1.0/sum;
-    /* Normalize buffer to have gain of 1.0: prevent roundoff error */
-    for(j=0;j<length;j++) {
-      buffer[j] *= sum;
-    }
-    /* lsx_debug("# end"); */
-}
-
-#define RIBLEN 2048
-
-static int sox_poly_start(sox_effect_t * effp)
-{
-    priv_t * rate = (priv_t *) effp->priv;
-    static int l1[MF], l2[MF];
-    double skip = 0;
-    int total, size, uprate;
-    int k;
-
-    if (effp->in_signal.rate == effp->out_signal.rate)
-      return SOX_EFF_NULL;
-
-    effp->out_signal.channels = effp->in_signal.channels;
-
-    rate->lcmrate = lsx_lcm((unsigned)effp->in_signal.rate,
-                           (unsigned)effp->out_signal.rate);
-
-    /* Cursory check for LCM overflow.
-     * If both rates are below 65k, there should be no problem.
-     * 16 bits x 16 bits = 32 bits, which we can handle.
-     */
-
-    rate->inskip = rate->lcmrate / (sox_sample_t)effp->in_signal.rate;
-    rate->outskip = rate->lcmrate / (sox_sample_t)effp->out_signal.rate;
-    rate->Factor = (double)rate->inskip / (double)rate->outskip;
-    rate->inpipe = 0;
-    {
-      int f = RIBLEN/max(rate->inskip,rate->outskip);
-      if (f == 0) f = 1;
-      size = f * rate->outskip; /* reasonable input block size */
-    }
-
-    /* Find the prime factors of inskip and outskip */
-    total = optimize_factors(rate, rate->inskip, rate->outskip, l1, l2);
-    rate->total = total;
-    /* l1 and l2 are now lists of the up/down factors for conversion */
-
-    lsx_debug("Poly:  input rate %g, output rate %g.  %d stages.",
-            effp->in_signal.rate, effp->out_signal.rate,total);
-    lsx_debug("Poly:  window: %s  size: %d  cutoff: %f.",
-            (rate->win_type == 0) ? ("nut") : ("ham"), rate->win_width, rate->cutoff);
-
-    /* Create an array of filters and past history */
-    uprate = effp->in_signal.rate;
-    for (k = 0; k < total; k++) {
-      int j, prod, f_cutoff, f_len;
-      polystage *s;
-
-      rate->stage[k] = s = lsx_malloc(sizeof(polystage));
-      s->up = l1[k];
-      s->down = l2[k];
-      f_cutoff = max(s->up, s->down);
-      f_len = max(20 * f_cutoff, rate->win_width);
-      prod = s->up * s->down;
-      if (prod > 2*f_len) prod = s->up;
-      f_len = ((f_len+prod-1)/prod) * prod; /* reduces rounding-errors in polyphase() */
-      s->size = size;
-      s->hsize = f_len/s->up; /* this much of window is past-history */
-      s->held = 0;
-      lsx_debug("Poly:  stage %d:  Up by %d, down by %d,  i_samps %d, hsize %d",
-              k+1,s->up,s->down,size, s->hsize);
-      s->filt_len = f_len;
-      s->filt_array = lsx_malloc(sizeof(Float) * f_len);
-      s->window = lsx_malloc(sizeof(Float) * (s->hsize+size));
-      /* zero past_history section of window */
-      for(j = 0; j < s->hsize; j++)
-        s->window[j] = 0.0;
-
-      uprate *= s->up;
-      lsx_debug("Poly:         :  filt_len %d, cutoff freq %.1f",
-              f_len, uprate * rate->cutoff / f_cutoff);
-      uprate /= s->down;
-      fir_design(rate, s->filt_array, f_len, rate->cutoff / f_cutoff);
-
-      skip *= s->up;
-      skip += f_len;
-      skip /= s->down;
-
-      size = (size * s->up) / s->down;  /* this is integer */
-    }
-    rate->oskip = skip/2;
-    { /* bogus last stage is for output buffering */
-      polystage *s;
-      rate->stage[k] = s = lsx_malloc(sizeof(polystage));
-      s->up = s->down = 0;
-      s->size = size;
-      s->hsize = 0;
-      s->held = 0;
-      s->filt_len = 0;
-      s->filt_array = NULL;
-      s->window = lsx_malloc(sizeof(Float) * size);
-    }
-    lsx_debug("Poly:  output samples %d, oskip %lu",size, (unsigned long)rate->oskip);
-    return (SOX_SUCCESS);
-}
-
-/*
- * Processed signed long samples from ibuf to obuf.
- * Return number of samples processed.
- */
-
-/* REMARK: putting this in a separate subroutine improves gcc's optimization */
-static double sox_prod(const Float *q, int qstep, const Float *p, int n)
-{
-  double sum = 0;
-  const Float *p0;
-  p0 = p-n;
-  while (p>p0) {
-    sum += *p * *q;
-    q += qstep;
-    p -= 1;
-  }
-  return sum;
-}
-
-static void polyphase(Float *output, polystage *s)
-{
-  int mm;
-  int up = s->up;
-  int down = s->down;
-  int f_len = s->filt_len;
-  const Float *in;
-  Float *o; /* output pointer */
-  Float *o_top;
-
-  in = s->window + s->hsize;
-  /*for (mm=0; mm<s->filt_len; mm++) lsx_debug("cf_%d %f",mm,s->filt_array[mm]);*/
-  /* assumes s->size divisible by down (now true) */
-  o_top = output + (s->size * up) / down;
-  /*lsx_debug(" isize %d, osize %d, up %d, down %d, N %d", s->size, o_top-output, up, down, f_len);*/
-  for (mm=0, o=output; o < o_top; mm+=down, o++) {
-    double sum;
-    const Float *p, *q;
-    q = s->filt_array + (mm%up);   /* decimated coef pointer */
-    p  = in + (mm/up);
-    sum = sox_prod(q, up, p, f_len/up);
-    *o = sum * up;
-  }
-}
-
-static void update_hist(Float *hist, int hist_size, int in_size)
-{
-  Float *p, *p1, *q;
-  p = hist;
-  p1 = hist+hist_size;
-  q = hist+in_size;
-  while (p<p1)
-    *p++ = *q++;
-
-}
-
-static int sox_poly_flow(sox_effect_t * effp, const sox_sample_t *ibuf, sox_sample_t *obuf,
-                 size_t *isamp, size_t *osamp)
-{
-  priv_t * rate = (priv_t *) effp->priv;
-  polystage *s0,*s1;
-
-  /* Sanity check:  how much can we tolerate? */
-  /* lsx_debug("*isamp=%d *osamp=%d",*isamp,*osamp); */
-  s0 = rate->stage[0];            /* the first stage */
-  s1 = rate->stage[rate->total];  /* the 'last' stage is output buffer */
-  {
-    size_t in_size, gap, k;
-
-    in_size = *isamp;
-    gap = s0->size - s0->held; /* space available in this 'input' buffer */
-    if ((in_size > gap) || (ibuf==NULL)) {
-      *isamp = in_size = gap;
-    }
-    if (in_size > 0) {
-      Float *q;
-                        q = s0->window + s0->hsize;
-      if (s0!=s1) q += s0->held;  /* the last (output) buffer doesn't shift history */
-      if (ibuf != NULL) {
-                                rate->inpipe += rate->Factor * in_size;
-        for (k=0; k<in_size; k++)
-          *q++ = (Float)ibuf[k] / ISCALE;
-      } else { /* ibuf==NULL is draining */
-        for(k=0;k<in_size;k++)
-          *q++ = 0.0;
-      }
-      s0->held += in_size;
-    }
-  }
-
-  if (s0->held == s0->size && s1->held == 0) {
-    size_t k;
-    /* input buffer full, output buffer empty, so do process */
-
-    for(k=0; k<rate->total; k++) {
-      polystage *s;
-      Float *out;
-
-      s = rate->stage[k];
-
-      out = rate->stage[k+1]->window + rate->stage[k+1]->hsize;
-
-      /* lsx_debug("k=%d  insize=%d",k,in_size); */
-      polyphase(out, s);
-
-      /* copy input history into lower portion of rate->window[k] */
-      update_hist(s->window, s->hsize, s->size);
-      s->held = 0;
-    }
-
-    s1->held = s1->size;
-    s1->hsize = 0;
-
-  }
-
-  {
-    sox_sample_t *q;
-    size_t out_size;
-    size_t oskip;
-    Float *out_buf;
-    size_t k;
-
-    oskip = rate->oskip;
-                out_size = s1->held;
-                out_buf = s1->window + s1->hsize;
-
-    if(ibuf == NULL && out_size > ceil(rate->inpipe)) {
-      out_size = ceil(rate->inpipe);
-    }
-
-                if (out_size > oskip + *osamp) out_size = oskip + *osamp;
-
-    for(q=obuf, k=oskip; k < out_size; k++)
-    {
-        float f;
-        f = out_buf[k] * ISCALE; /* should clip-limit */
-        SOX_SAMPLE_CLIP_COUNT(f, effp->clips);
-        *q++ = f;
-    }
-
-                *osamp = q-obuf;
-                rate->inpipe -= *osamp;
-                oskip -= out_size - *osamp;
-                rate->oskip = oskip;
-
-                s1->hsize += out_size;
-    s1->held -= out_size;
-    if (s1->held == 0) {
-      s1->hsize = 0;
-    }
-
-  }
-  return (SOX_SUCCESS);
-
-}
-
-/*
- * Process tail of input samples.
- */
-static int sox_poly_drain(sox_effect_t * effp, sox_sample_t *obuf, size_t *osamp)
-{
-  size_t in_size;
-  /* Call "flow" with NULL input. */
-  sox_poly_flow(effp, NULL, obuf, &in_size, osamp);
-  return (SOX_SUCCESS);
-}
-
-/*
- * Do anything required when you stop reading samples.
- * Don't close input file!
- */
-static int sox_poly_stop(sox_effect_t * effp)
-{
-    priv_t * rate = (priv_t *)effp->priv;
-    size_t k;
-
-    for (k = 0; k <= rate->total; k++) {
-      free(rate->stage[k]->window);
-      free(rate->stage[k]->filt_array);
-      free(rate->stage[k]);
-    }
-
-    return SOX_SUCCESS;
-}
-
-static sox_effect_handler_t sox_polyphase_effect = {
-  "polyphase",
-  "-w {nut|ham}   window type\n"
-  "       -width n       window width in samples [default 1024]\n"
-  "\n"
-  "       -cutoff float  frequency cutoff for base bandwidth [default 0.95]",
-  SOX_EFF_RATE | SOX_EFF_DEPRECATED,
-  sox_poly_getopts,
-  sox_poly_start,
-  sox_poly_flow,
-  sox_poly_drain,
-  sox_poly_stop,
-  NULL, sizeof(priv_t)
-};
-
-const sox_effect_handler_t *sox_polyphase_effect_fn(void)
-{
-    return &sox_polyphase_effect;
-}
--- a/src/rabbit.c
+++ /dev/null
@@ -1,197 +1,0 @@
-/* libsamplerate (aka Secret Rabbit Code) support for sox
- * (c) Reuben Thomas <rrt@sc3d.org> 2006
- *
- * 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.1 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-#include "sox_i.h"
-
-#ifdef HAVE_SAMPLERATE_H
-
-#include <limits.h>
-#include <stdlib.h>
-#include <string.h>
-#include <samplerate.h>
-
-/* Private data for resampling */
-typedef struct {
-  int converter_type;           /* SRC converter type */
-  double out_rate;
-  SRC_STATE *state;             /* SRC state struct */
-  SRC_DATA *data;               /* SRC_DATA control struct */
-  size_t i_alloc, o_alloc;  /* Samples allocated in data->data_{in,out} */
-} priv_t;
-
-/*
- * Process options
- */
-static int getopts(sox_effect_t * effp, int argc, char **argv)
-{
-  priv_t * r = (priv_t *) effp->priv;
-  char dummy;     /* To check for extraneous chars. */
-  --argc, ++argv;
-
-  r->converter_type = SRC_SINC_BEST_QUALITY;
-
-  if (argc) {
-    if (!strcmp(argv[0], "-c0")) {
-      r->converter_type = SRC_SINC_BEST_QUALITY;
-      argc--; argv++;
-    } else if (!strcmp(argv[0], "-c1")) {
-      r->converter_type = SRC_SINC_MEDIUM_QUALITY;
-      argc--; argv++;
-    } else if (!strcmp(argv[0], "-c2")) {
-      r->converter_type = SRC_SINC_FASTEST;
-      argc--; argv++;
-    } else if (!strcmp(argv[0], "-c3")) {
-      r->converter_type = SRC_ZERO_ORDER_HOLD;
-      argc--; argv++;
-    } else if (!strcmp(argv[0], "-c4")) {
-      r->converter_type = SRC_LINEAR;
-      argc--; argv++;
-    }
-  }
-
-  r->out_rate = HUGE_VAL;
-  if (argc) {
-    if (sscanf(*argv, "%lf %c", &r->out_rate, &dummy) != 1 || r->out_rate <= 0)
-      return lsx_usage(effp);
-    argc--; argv++;
-  }
-
-  return argc? lsx_usage(effp) : SOX_SUCCESS;
-}
-
-/*
- * Prepare processing.
- */
-static int start(sox_effect_t * effp)
-{
-  priv_t * r = (priv_t *) effp->priv;
-  int err = 0;
-  double out_rate = r->out_rate != HUGE_VAL? r->out_rate : effp->out_signal.rate;
-
-  if (effp->in_signal.rate == out_rate)
-    return SOX_EFF_NULL;
-
-  effp->out_signal.channels = effp->in_signal.channels;
-  effp->out_signal.rate = out_rate;
-
-  r->data = lsx_calloc(1, sizeof(SRC_DATA));
-  r->data->src_ratio = out_rate / effp->in_signal.rate;
-  r->i_alloc = r->o_alloc = 0;
-  r->state = src_new(r->converter_type, (int)effp->in_signal.channels, &err);
-  if (err) {
-    free(r->data);
-    lsx_fail("cannot initialise rabbit: %s", src_strerror(err));
-    return SOX_EOF;
-  }
-
-  return SOX_SUCCESS;
-}
-
-/*
- * Read, convert, return data.
- */
-static int flow(sox_effect_t * effp, const sox_sample_t *ibuf, sox_sample_t *obuf UNUSED,
-                   size_t *isamp, size_t *osamp)
-{
-  priv_t * r = (priv_t *) effp->priv;
-  SRC_DATA *d = r->data;
-  unsigned int channels = effp->in_signal.channels;
-  size_t i;
-  size_t isamples0 = d->input_frames * channels;
-  size_t isamples = isamples0 + *isamp;
-  size_t osamples = isamples * (d->src_ratio + 0.01) + 8;
-  SOX_SAMPLE_LOCALS;
-
-  if (osamples > *osamp) {
-    osamples = *osamp;
-    isamples = (osamples - 8) / (d->src_ratio + 0.01);
-  }
-
-  if (r->i_alloc < isamples) {
-    d->data_in = lsx_realloc(d->data_in, isamples * sizeof(float));
-    r->i_alloc = isamples;
-  }
-  if (r->o_alloc < osamples) {
-    d->data_out = lsx_realloc(d->data_out, osamples * sizeof(float));
-    r->o_alloc = osamples;
-    d->output_frames = osamples / channels;
-  }
-
-  for (i = 0; i < isamples - isamples0; i++)
-    d->data_in[isamples0 + i] = SOX_SAMPLE_TO_FLOAT_32BIT(ibuf[i], effp->clips);
-  *isamp = i;
-
-  d->input_frames = isamples / channels;
-
-  *osamp = 0;
-  while (d->input_frames > 0 || d->end_of_input != 0) {
-    if (src_process(r->state, r->data) != 0) {
-      lsx_fail("%s", src_strerror(src_error(r->state)));
-      return SOX_EOF;
-    }
-    d->input_frames -= d->input_frames_used;
-    if (d->input_frames)
-       memmove(d->data_in, d->data_in + d->input_frames_used * sizeof(float),
-           d->input_frames * sizeof(float));
-
-    for (i = 0; i < (size_t)d->output_frames_gen * channels; i++)
-      obuf[i] = SOX_FLOAT_32BIT_TO_SAMPLE(d->data_out[i], effp->clips);
-    *osamp += i;
-
-    if (!d->output_frames_gen || d->end_of_input)
-      break;
-  }
-
-  return SOX_SUCCESS;
-}
-
-/*
- * Process samples and write output.
- */
-static int drain(sox_effect_t * effp, sox_sample_t *obuf, size_t *osamp)
-{
-  priv_t * r = (priv_t *) effp->priv;
-  static size_t isamp = 0;
-  r->data->end_of_input = 1;
-  return flow(effp, NULL, obuf, &isamp, osamp);
-}
-
-/*
- * Do anything required when you stop reading samples.
- */
-static int stop(sox_effect_t * effp)
-{
-  priv_t * r = (priv_t *) effp->priv;
-
-  free(r->data);
-  src_delete(r->state);
-  return SOX_SUCCESS;
-}
-
-const sox_effect_handler_t *sox_rabbit_effect_fn(void)
-{
-  static sox_effect_handler_t handler = {
-    "rabbit", "[-c0|-c1|-c2|-c3|-c4] [rate]",
-    SOX_EFF_RATE | SOX_EFF_MCHAN | SOX_EFF_DEPRECATED,
-    getopts, start, flow, drain, stop, NULL, sizeof(priv_t)
-  };
-
-  return &handler;
-}
-
-#endif /* HAVE_SAMPLERATE */
--- a/src/rate.c
+++ b/src/rate.c
@@ -562,3 +562,125 @@
   handler.usage = lsx_usage_lines(&usage, lines, array_length(lines));
   return &handler;
 }
+
+/*------------------- emulation of the old `rabbit' effect -------------------*/
+
+static int rabbit_getopts(sox_effect_t * effp, int argc, char * * argv)
+{
+  static char const * const qualities[] = {"-v", "-h", "-l", "-q", "-q"};
+  char quality[2] = "0", dummy;     /* To check for extraneous chars. */
+  char * args[] = {0, 0, 0};
+  int argc2 = 2;
+
+  if (argc > 1) {
+    int n = sscanf(argv[1], "-c%1[0-4] %c", quality, &dummy);
+    if (n > 1)
+      return lsx_usage(effp);
+    if (n == 1)
+      --argc, ++argv;
+  }
+
+  args[0] = argv[0];
+  args[1] = (char *)qualities[quality[0] - '0'];
+  if (argc > 1) {
+    args[2] = argv[1];
+    --argc, ++argv;
+    ++argc2;
+  }
+  return argc > 1? lsx_usage(effp) : 
+    sox_rate_effect_fn()->getopts(effp, argc2, args);
+}
+
+sox_effect_handler_t const * sox_rabbit_effect_fn(void)
+{
+  static sox_effect_handler_t handler;
+  handler = *sox_rate_effect_fn();
+  handler.name = "rabbit";
+  handler.usage = "[-c0|-c1|-c2|-c3|-c4] [rate]";
+  handler.getopts = rabbit_getopts;
+  handler.flags |= SOX_EFF_DEPRECATED;
+  return &handler;
+}
+
+/*------------------ emulation of the old `polyphase' effect -----------------*/
+
+static int polyphase_getopts(sox_effect_t * effp, int argc, char * * argv)
+{
+  char arg[100], * args[] = {0, "-vb", 0};
+  double bandwidth = 95;
+
+  for (--argc, ++argv; argc >= 2; argc -= 2, argv += 2)
+    if (!strcmp(argv[0], "-cutoff"))
+      bandwidth = 100 * atof(argv[1]);
+    else if (strcmp(argv[0], "-w") && strcmp(argv[0], "-width")) {
+      lsx_fail("unknown parameter: %s %s", argv[0], argv[1]);
+      return SOX_EOF;
+    }
+  args[0] = argv[0];
+  args[2] = arg;
+  sprintf(arg, "%f", bandwidth);
+  return argc? lsx_usage(effp) : 
+    sox_rate_effect_fn()->getopts(effp, array_length(args), args);
+}
+
+sox_effect_handler_t const * sox_polyphase_effect_fn(void)
+{
+  static sox_effect_handler_t handler;
+  handler = *sox_rate_effect_fn();
+  handler.name = "polyphase";
+  handler.usage = "-cutoff factor    Cutoff frequency 0 to 1, default 0.95";
+  handler.getopts = polyphase_getopts;
+  handler.flags |= SOX_EFF_DEPRECATED;
+  return &handler;
+}
+
+/*------------------ emulation of the old `resample' effect ------------------*/
+
+static int resample_getopts(sox_effect_t * effp, int argc, char * * argv)
+{
+  char arg[100], * args[] = {0, 0, "-b", 0};
+  double bandwidth = .8;
+  char const * quality = NULL;
+
+  --argc, ++argv;
+  if (argc) {
+    if (!strcmp(argv[0], "-qs")) {
+      quality = "-h";
+      --argc, ++argv;
+    }
+    else if (!strcmp(argv[0], "-q")) {
+      bandwidth = .875;
+      quality = "-v";
+      --argc, ++argv;
+    }
+    else if (!strcmp(argv[0], "-ql")) {
+      bandwidth = .94;
+      quality = "-v";
+      --argc, ++argv;
+    }
+  }
+  if (argc) {
+    if (sscanf(argv[0], "%lf", &bandwidth) != 1)
+      return lsx_usage(effp);
+    if (!quality)
+      quality = "-m";
+  }
+
+  args[0] = argv[0];
+  args[1] = (char *)(quality? quality : "-l");
+  args[3] = arg;
+  sprintf(arg, "%f", 100 * bandwidth);
+  return argc > 2 ? lsx_usage(effp) : 
+    sox_rate_effect_fn()->getopts(effp, quality? 4 : 2, args);
+}
+
+sox_effect_handler_t const * sox_resample_effect_fn(void)
+{
+  static sox_effect_handler_t handler;
+  handler = *sox_rate_effect_fn();
+  handler.name = "resample";
+  handler.usage = "[ -qs | -q | -ql ] [ rolloff [ beta ] ]",
+  handler.getopts = resample_getopts;
+  handler.flags |= SOX_EFF_DEPRECATED;
+  return &handler;
+}
--- a/src/resample.c
+++ /dev/null
@@ -1,589 +1,0 @@
-/* libSoX rate change effect file.
- * Spiffy rate changer using Smith & Wesson Bandwidth-Limited Interpolation.
- * The algorithm is described in "Bandlimited Interpolation -
- * Introduction and Algorithm" by Julian O. Smith III.
- * Available on ccrma-ftp.stanford.edu as
- * pub/BandlimitedInterpolation.eps.Z or similar.
- *
- * The latest stand alone version of this algorithm can be found
- * at ftp://ccrma-ftp.stanford.edu/pub/NeXT/
- * under the name of resample-version.number.tar.Z
- *
- *
- * FILE: resample.h
- *   BY: Julius Smith (at CCRMA, Stanford U)
- * C BY: translated from SAIL to C by Christopher Lee Fraley
- *          (cf0v@andrew.cmu.edu)
- * DATE: 7-JUN-88
- * VERS: 2.0  (17-JUN-88, 3:00pm)
- *
- * July 5, 1991
- * Copyright 1991 Lance Norskog And Sundry Contributors
- * This source code is freely redistributable and may be used for
- * any purpose.  This copyright notice must be maintained.
- * Lance Norskog And Sundry Contributors are not responsible for
- * the consequences of using this software.
- *
- * This source code 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.
- *
- * Fixed bug: roll off frequency was wrong, too high by 2 when upsampling,
- * too low by 2 when downsampling.
- * Andreas Wilde, 12. Feb. 1999, andreas@eakaw2.et.tu-dresden.de
- *
- * October 29, 1999
- * Various changes, bugfixes(?), increased precision, by Stan Brooks.
- */
-
-#include "sox_i.h"
-
-#include <stdlib.h>
-#include <string.h>
-
-/* Conversion constants */
-#define Lc        7
-#define Nc       (1<<Lc)
-#define La        16
-#define Na       (1<<La)
-#define Lp       (Lc+La)
-#define Np       (1<<Lp)
-#define Amask    (Na-1)
-#define Pmask    (Np-1)
-
-/* Description of constants:
- *
- * Nc - is the number of look-up values available for the lowpass filter
- *    between the beginning of its impulse response and the "cutoff time"
- *    of the filter.  The cutoff time is defined as the reciprocal of the
- *    lowpass-filter cut off frequence in Hz.  For example, if the
- *    lowpass filter were a sinc function, Nc would be the index of the
- *    impulse-response lookup-table corresponding to the first zero-
- *    crossing of the sinc function.  (The inverse first zero-crossing
- *    time of a sinc function equals its nominal cutoff frequency in Hz.)
- *    Nc must be a power of 2 due to the details of the current
- *    implementation. The default value of 128 is sufficiently high that
- *    using linear interpolation to fill in between the table entries
- *    gives approximately 16-bit precision, and quadratic interpolation
- *    gives about 23-bit (float) precision in filter coefficients.
- *
- * Lc - is log base 2 of Nc.
- *
- * La - is the number of bits devoted to linear interpolation of the
- *    filter coefficients.
- *
- * Lp - is La + Lc, the number of bits to the right of the binary point
- *    in the integer "time" variable. To the left of the point, it indexes
- *    the input array (X), and to the right, it is interpreted as a number
- *    between 0 and 1 sample of the input X.  The default value of 23 is
- *    about right.  There is a constraint that the filter window must be
- *    "addressable" in a int32_t, more precisely, if Nmult is the number
- *    of sinc zero-crossings in the right wing of the filter window, then
- *    (Nwing<<Lp) must be expressible in 31 bits.
- *
- */
-
-#define ISCALE 0x10000
-
-/* largest factor for which exact-coefficients upsampling will be used */
-#define NQMAX 511
-
-#define BUFFSIZE 8192 /*16384*/  /* Total I/O buffer size */
-
-/* Private data for Lerp via LCM file */
-typedef struct {
-   double Factor;     /* Factor = Fout/Fin sample rates */
-   double rolloff;    /* roll-off frequency */
-   double beta;       /* passband/stopband tuning magic */
-   int quadr;         /* non-zero to use qprodUD quadratic interpolation */
-   long Nmult;
-   long Nwing;
-   long Nq;
-   double *Imp;        /* impulse [Nwing+1] Filter coefficients */
-
-   double Time;       /* Current time/pos in input sample */
-   long dhb;
-
-   long a,b;          /* gcd-reduced input,output rates   */
-   long t;            /* Current time/pos for exact-coeff's method */
-
-   long Xh;           /* number of past/future samples needed by filter  */
-   long Xoff;         /* Xh plus some room for creep  */
-   long Xread;        /* X[Xread] is start-position to enter new samples */
-   long Xp;           /* X[Xp] is position to start filter application   */
-   unsigned long Xsize,Ysize; /* size (doubles) of X[],Y[]         */
-   double *X, *Y;      /* I/O buffers */
-} priv_t;
-
-/* lsx_makeFilter() declared in filter.c */
-int lsx_makeFilter(double Imp[],
-               long Nwing,
-               double Froll,
-               double Beta,
-               long Num,
-               int Normalize);
-
-static long SrcUD(priv_t * r, long Nx);
-static long SrcEX(priv_t * r, long Nx);
-
-
-/*
- * Process options
- */
-static int getopts(sox_effect_t * effp, int argc, char **argv)
-{
-        priv_t * r = (priv_t *) effp->priv;
-  --argc, ++argv;
-
-        /* These defaults are conservative with respect to aliasing. */
-        r->rolloff = 0.80;
-        r->beta = 16; /* anything <=2 means Nutall window */
-        r->quadr = 0;
-        r->Nmult = 45;
-
-        if (argc >= 1) {
-                if (!strcmp(argv[0], "-qs")) {
-                        r->quadr = 1;
-                        argc--; argv++;
-                }
-                else if (!strcmp(argv[0], "-q")) {
-                        r->rolloff = 0.875;
-                        r->quadr = 1;
-                        r->Nmult = 75;
-                        argc--; argv++;
-                }
-                else if (!strcmp(argv[0], "-ql")) {
-                        r->rolloff = 0.94;
-                        r->quadr = 1;
-                        r->Nmult = 149;
-                        argc--; argv++;
-                }
-        }
-
-        if ((argc >= 1) && (sscanf(argv[0], "%lf", &r->rolloff) != 1)) {
-          return lsx_usage(effp);
-        } else if ((r->rolloff <= 0.01) || (r->rolloff >= 1.0)) {
-          lsx_fail("rolloff factor (%f) no good, should be 0.01<x<1.0", r->rolloff);
-          return(SOX_EOF);
-        }
-
-
-        if ((argc >= 2) && !sscanf(argv[1], "%lf", &r->beta)) {
-          return lsx_usage(effp);
-        } else if (r->beta <= 2.0) {
-        	r->beta = 0;
-                lsx_debug("opts: Nuttall window, cutoff %f", r->rolloff);
-        } else
-                lsx_debug("opts: Kaiser window, cutoff %f, beta %f", r->rolloff, r->beta);
-        return (SOX_SUCCESS);
-}
-
-/*
- * Prepare processing.
- */
-static int start(sox_effect_t * effp)
-{
-  priv_t * r = (priv_t *) effp->priv;
-  long Xoff, gcdrate;
-  int i;
-
-  if (effp->in_signal.rate == effp->out_signal.rate)
-    return SOX_EFF_NULL;
-
-  effp->out_signal.channels = effp->in_signal.channels;
-
-  r->Factor = effp->out_signal.rate / effp->in_signal.rate;
-
-  gcdrate = lsx_gcd((unsigned) effp->in_signal.rate, (unsigned) effp->out_signal.rate);
-  r->a = effp->in_signal.rate / gcdrate;
-  r->b = effp->out_signal.rate / gcdrate;
-
-  if (r->a <= r->b && r->b <= NQMAX) {
-    r->quadr = -1;      /* exact coeffs */
-    r->Nq = r->b;       /* max(r->a,r->b) */
-  } else
-    r->Nq = Nc; /* for now */
-
-  /* Nwing: # of filter coeffs in right wing */
-  r->Nwing = r->Nq * (r->Nmult / 2 + 1) + 1;
-
-  r->Imp = lsx_malloc(sizeof(double) * (r->Nwing + 2));
-  ++r->Imp;
-  /* need Imp[-1] and Imp[Nwing] for quadratic interpolation */
-  /* returns error # <=0, or adjusted wing-len > 0 */
-  i = lsx_makeFilter(r->Imp, r->Nwing, r->rolloff, r->beta, r->Nq, 1);
-  if (i <= 0) {
-    lsx_fail("Unable to make filter");
-    return (SOX_EOF);
-  }
-
-  lsx_debug("Nmult: %ld, Nwing: %ld, Nq: %ld", r->Nmult, r->Nwing, r->Nq);
-
-  if (r->quadr < 0) {     /* exact coeff's method */
-    r->Xh = r->Nwing / r->b;
-    lsx_debug("rate ratio %ld:%ld, coeff interpolation not needed", r->a, r->b);
-  } else {
-    r->dhb = Np;        /* Fixed-point Filter sampling-time-increment */
-    if (r->Factor < 1.0)
-      r->dhb = r->Factor * Np + 0.5;
-    r->Xh = (r->Nwing << La) / r->dhb;
-    /* (Xh * dhb)>>La is max index into Imp[] */
-  }
-
-  /* reach of LP filter wings + some creeping room */
-  Xoff = r->Xh + 10;
-  r->Xoff = Xoff;
-
-  /* Current "now"-sample pointer for input to filter */
-  r->Xp = Xoff;
-  /* Position in input array to read into */
-  r->Xread = Xoff;
-  /* Current-time pointer for converter */
-  r->Time = Xoff;
-  if (r->quadr < 0) {     /* exact coeff's method */
-    r->t = Xoff * r->Nq;
-  }
-  i = BUFFSIZE - 2 * Xoff;
-  if (i < r->Factor + 1.0 / r->Factor) {  /* Check input buffer size */
-    lsx_fail("Factor is too small or large for BUFFSIZE");
-    return (SOX_EOF);
-  }
-
-  r->Xsize = 2 * Xoff + i / (1.0 + r->Factor);
-  r->Ysize = BUFFSIZE - r->Xsize;
-  lsx_debug("Xsize %li, Ysize %li, Xoff %li", r->Xsize, r->Ysize, r->Xoff);
-
-  r->X = lsx_malloc(sizeof(double) * (BUFFSIZE));
-  r->Y = r->X + r->Xsize;
-
-  /* Need Xoff zeros at beginning of sample */
-  for (i = 0; i < Xoff; i++)
-    r->X[i] = 0;
-  return (SOX_SUCCESS);
-}
-
-/*
- * Processed signed long samples from ibuf to obuf.
- * Return number of samples processed.
- */
-static int flow(sox_effect_t * effp, const sox_sample_t *ibuf, sox_sample_t *obuf,
-                     size_t *isamp, size_t *osamp)
-{
-        priv_t * r = (priv_t *) effp->priv;
-        long i, last, Nout, Nx, Nproc;
-
-        lsx_debug_more("Xp %li, Xread %li, isamp %lu, ",r->Xp, r->Xread,(unsigned long)*isamp);
-
-        /* constrain amount we actually process */
-        Nproc = r->Xsize - r->Xp;
-
-        i = (r->Ysize < *osamp)? r->Ysize : *osamp;
-        if (Nproc * r->Factor >= i)
-          Nproc = i / r->Factor;
-
-        Nx = Nproc - r->Xread; /* space for right-wing future-data */
-        if (Nx <= 0)
-        {
-                lsx_fail("Can not handle this sample rate change. Nx not positive: %li", Nx);
-                return (SOX_EOF);
-        }
-        if ((unsigned long)Nx > *isamp)
-                Nx = *isamp;
-        lsx_debug_more("Nx %li",Nx);
-
-        if (ibuf == NULL) {
-                for(i = r->Xread; i < Nx + r->Xread  ; i++)
-                        r->X[i] = 0;
-        } else {
-                for(i = r->Xread; i < Nx + r->Xread  ; i++)
-                        r->X[i] = (double)(*ibuf++)/ISCALE;
-        }
-        last = i;
-        Nproc = last - r->Xoff - r->Xp;
-
-        if (Nproc <= 0) {
-                /* fill in starting here next time */
-                r->Xread = last;
-                /* leave *isamp alone, we consumed it */
-                *osamp = 0;
-                return (SOX_SUCCESS);
-        }
-        if (r->quadr < 0) { /* exact coeff's method */
-                long creep;
-                Nout = SrcEX(r, Nproc);
-                lsx_debug_more("Nproc %li --> %li",Nproc,Nout);
-                /* Move converter Nproc samples back in time */
-                r->t -= Nproc * r->b;
-                /* Advance by number of samples processed */
-                r->Xp += Nproc;
-                /* Calc time accumulation in Time */
-                creep = r->t/r->b - r->Xoff;
-                if (creep)
-                {
-                  r->t -= creep * r->b;  /* Remove time accumulation   */
-                  r->Xp += creep;        /* and add it to read pointer */
-                  lsx_debug_more("Nproc %ld, creep %ld",Nproc,creep);
-                }
-        } else { /* approx coeff's method */
-                long creep;
-                Nout = SrcUD(r, Nproc);
-                lsx_debug_more("Nproc %li --> %li",Nproc,Nout);
-                /* Move converter Nproc samples back in time */
-                r->Time -= Nproc;
-                /* Advance by number of samples processed */
-                r->Xp += Nproc;
-                /* Calc time accumulation in Time */
-                creep = r->Time - r->Xoff;
-                if (creep)
-                {
-                  r->Time -= creep;   /* Remove time accumulation   */
-                  r->Xp += creep;     /* and add it to read pointer */
-                  lsx_debug_more("Nproc %ld, creep %ld",Nproc,creep);
-                }
-        }
-
-        {
-        long i,k;
-        /* Copy back portion of input signal that must be re-used */
-        k = r->Xp - r->Xoff;
-        lsx_debug_more("k %li, last %li",k,last);
-        for (i=0; i<last - k; i++)
-            r->X[i] = r->X[i+k];
-
-        /* Pos in input buff to read new data into */
-        r->Xread = i;
-        r->Xp = r->Xoff;
-
-        for(i=0; i < Nout; i++) {
-                double ftemp = r->Y[i] * ISCALE;
-
-                SOX_SAMPLE_CLIP_COUNT(ftemp, effp->clips);
-                *obuf++ = ftemp;
-        }
-
-        *isamp = Nx;
-        *osamp = Nout;
-
-        }
-        return (SOX_SUCCESS);
-}
-
-/*
- * Process tail of input samples.
- */
-static int drain(sox_effect_t * effp, sox_sample_t *obuf, size_t *osamp)
-{
-        priv_t * r = (priv_t *) effp->priv;
-        long isamp_res, osamp_res;
-        sox_sample_t *Obuf;
-        int rc;
-
-        lsx_debug("Xoff %li  <--- DRAIN",r->Xoff);
-
-        /* stuff end with Xoff zeros */
-        isamp_res = r->Xoff;
-        osamp_res = *osamp;
-        Obuf = obuf;
-        while (isamp_res>0 && osamp_res>0) {
-                size_t Isamp, Osamp;
-                Isamp = isamp_res;
-                Osamp = osamp_res;
-                rc = flow(effp, NULL, Obuf, &Isamp, &Osamp);
-                if (rc)
-                    return rc;
-                lsx_debug("DRAIN isamp,osamp  (%li,%li) -> (%lu,%lu)",
-                         isamp_res,osamp_res,(unsigned long)Isamp,(unsigned long)Osamp);
-                Obuf += Osamp;
-                osamp_res -= Osamp;
-                isamp_res -= Isamp;
-        }
-        *osamp -= osamp_res;
-        lsx_debug("DRAIN osamp %lu", (unsigned long)*osamp);
-        if (isamp_res)
-                lsx_warn("drain overran obuf by %li", isamp_res);
-        /* FIXME: This is very picky.  IF obuf is not big enough to
-         * drain remaining samples, they will be lost.
-         */
-        return (SOX_EOF);
-}
-
-/*
- * Do anything required when you stop reading samples.
- * Don't close input file!
- */
-static int stop(sox_effect_t * effp)
-{
-        priv_t * r = (priv_t *) effp->priv;
-
-        free(r->Imp - 1);
-        free(r->X);
-        /* free(r->Y); Y is in same block starting at X */
-        return (SOX_SUCCESS);
-}
-
-/* over 90% of CPU time spent in this iprodUD() function */
-/* quadratic interpolation */
-static double qprodUD(const double Imp[], const double *Xp, long Inc, double T0,
-                      long dhb, long ct)
-{
-  const double f = 1.0/(1<<La);
-  double v;
-  long Ho;
-
-  Ho = T0 * dhb;
-  Ho += (ct-1)*dhb; /* so double sum starts with smallest coef's */
-  Xp += (ct-1)*Inc;
-  v = 0;
-  do {
-    double coef;
-    long Hoh;
-    Hoh = Ho>>La;
-    coef = Imp[Hoh];
-    {
-      double dm,dp,t;
-      dm = coef - Imp[Hoh-1];
-      dp = Imp[Hoh+1] - coef;
-      t =(Ho & Amask) * f;
-      coef += ((dp-dm)*t + (dp+dm))*t*0.5;
-    }
-    /* filter coef, lower La bits by quadratic interpolation */
-    v += coef * *Xp;   /* sum coeff * input sample */
-    Xp -= Inc;     /* Input signal step. NO CHECK ON ARRAY BOUNDS */
-    Ho -= dhb;     /* IR step */
-  } while(--ct);
-  return v;
-}
-
-/* linear interpolation */
-static double iprodUD(const double Imp[], const double *Xp, long Inc,
-                      double T0, long dhb, long ct)
-{
-  const double f = 1.0/(1<<La);
-  double v;
-  long Ho;
-
-  Ho = T0 * dhb;
-  Ho += (ct-1)*dhb; /* so double sum starts with smallest coef's */
-  Xp += (ct-1)*Inc;
-  v = 0;
-  do {
-    double coef;
-    long Hoh;
-    Hoh = Ho>>La;
-    /* if (Hoh >= End) break; */
-    coef = Imp[Hoh] + (Imp[Hoh+1]-Imp[Hoh]) * (Ho & Amask) * f;
-    /* filter coef, lower La bits by linear interpolation */
-    v += coef * *Xp;   /* sum coeff * input sample */
-    Xp -= Inc;     /* Input signal step. NO CHECK ON ARRAY BOUNDS */
-    Ho -= dhb;     /* IR step */
-  } while(--ct);
-  return v;
-}
-
-/* From resample:filters.c */
-/* Sampling rate conversion subroutine */
-
-static long SrcUD(priv_t * r, long Nx)
-{
-   double *Ystart, *Y;
-   double Factor;
-   double dt;                  /* Step through input signal */
-   double time;
-   double (*prodUD)(const double[], const double *, long, double, long, long);
-   int n;
-
-   prodUD = (r->quadr)? qprodUD:iprodUD; /* quadratic or linear interp */
-   Factor = r->Factor;
-   time = r->Time;
-   dt = 1.0/Factor;        /* Output sampling period */
-   lsx_debug_more("Factor %f, dt %f, ",Factor,dt);
-   lsx_debug_more("Time %f, ",r->Time);
-   /* (Xh * dhb)>>La is max index into Imp[] */
-   lsx_debug_more("ct=%.2f %li",(double)r->Nwing*Na/r->dhb, r->Xh);
-   lsx_debug_more("ct=%ld, T=%.6f, dhb=%6f, dt=%.6f",
-                         r->Xh, time-floor(time),(double)r->dhb/Na,dt);
-   Ystart = Y = r->Y;
-   n = (int)ceil((double)Nx/dt);
-   while(n--)
-      {
-      double *Xp;
-      double v;
-      double T;
-      T = time-floor(time);        /* fractional part of Time */
-      Xp = r->X + (long)time;      /* Ptr to current input sample */
-
-      /* Past  inner product: */
-      v = (*prodUD)(r->Imp, Xp, -1L, T, r->dhb, r->Xh); /* needs Np*Nmult in 31 bits */
-      /* Future inner product: */
-      v += (*prodUD)(r->Imp, Xp+1, 1L, (1.0-T), r->dhb, r->Xh); /* prefer even total */
-
-      if (Factor < 1) v *= Factor;
-      *Y++ = v;              /* Deposit output */
-      time += dt;            /* Move to next sample by time increment */
-      }
-   r->Time = time;
-   lsx_debug_more("Time %f",r->Time);
-   return (Y - Ystart);        /* Return the number of output samples */
-}
-
-/* exact coeff's */
-static double prodEX(const double Imp[], const double *Xp,
-                     long Inc, long T0, long dhb, long ct)
-{
-  double v;
-  const double *Cp;
-
-  Cp  = Imp + (ct-1)*dhb + T0; /* so double sum starts with smallest coef's */
-  Xp += (ct-1)*Inc;
-  v = 0;
-  do {
-    v += *Cp * *Xp;   /* sum coeff * input sample */
-    Cp -= dhb;     /* IR step */
-    Xp -= Inc;     /* Input signal step. */
-  } while(--ct);
-  return v;
-}
-
-static long SrcEX(priv_t * r, long Nx)
-{
-   double *Ystart, *Y;
-   double Factor;
-   long a,b;
-   long time;
-   int n;
-
-   Factor = r->Factor;
-   time = r->t;
-   a = r->a;
-   b = r->b;
-   Ystart = Y = r->Y;
-   n = (Nx*b + (a-1))/a;
-   while(n--)
-      {
-        double *Xp;
-        double v;
-        long T;
-        T = time % b;              /* fractional part of Time */
-        Xp = r->X + (time/b);      /* Ptr to current input sample */
-
-        /* Past  inner product: */
-        v = prodEX(r->Imp, Xp, -1L, T, b, r->Xh);
-        /* Future inner product: */
-        v += prodEX(r->Imp, Xp+1, 1L, b-T, b, r->Xh);
-
-        if (Factor < 1) v *= Factor;
-        *Y++ = v;             /* Deposit output */
-        time += a;            /* Move to next sample by time increment */
-      }
-   r->t = time;
-   return (Y - Ystart);        /* Return the number of output samples */
-}
-
-const sox_effect_handler_t *sox_resample_effect_fn(void)
-{
-  static sox_effect_handler_t handler = {
-     "resample", "[ -qs | -q | -ql ] [ rolloff [ beta ] ]",
-     SOX_EFF_RATE | SOX_EFF_DEPRECATED, getopts, start, flow, drain, stop, NULL, sizeof(priv_t)
-  };
-  return &handler;
-}
--- a/src/sox.c
+++ b/src/sox.c
@@ -2682,10 +2682,8 @@
     exit(0);
   }
 
-  if (!sox_globals.repeatable) { /* Re-seed PRNG? */
+  if (!sox_globals.repeatable) /* Re-seed PRNG? */
     sox_globals.ranqd1 = (int32_t)time(NULL);
-    srand((unsigned int)sox_globals.ranqd1); /* srand only for polyphase */
-  }
 
   /* Save things that sox_sequence needs to be reinitialised for each segued
    * block of input files.*/
--- a/src/sox_i.h
+++ b/src/sox_i.h
@@ -73,9 +73,6 @@
 char const * lsx_parsesamples(sox_rate_t rate, const char *str, size_t *samples, int def);
 double lsx_parse_frequency(char const * text, char * * end_ptr);
 
-unsigned lsx_gcd(unsigned a, unsigned b);
-unsigned lsx_lcm(unsigned a, unsigned b);
-
 void lsx_prepare_spline3(double const * x, double const * y, int n,
     double start_1d, double end_1d, double * y_2d);
 double lsx_spline3(double const * x, double const * y, double const * y_2d,
--- a/src/soxconfig.h.cmake
+++ b/src/soxconfig.h.cmake
@@ -26,7 +26,6 @@
 #cmakedefine HAVE_OPENMP              1
 #cmakedefine HAVE_POPEN               1
 #cmakedefine HAVE_PNG                 1
-#cmakedefine HAVE_SAMPLERATE_H        1
 #cmakedefine HAVE_SNDFILE_1_0_12      1
 #cmakedefine HAVE_SNDFILE             1
 #cmakedefine HAVE_STDINT_H            1