shithub: sox

Download patch

ref: 7f1b933514428948f8708feb6430f6375b0c5314
parent: 546452fba192387faad314496c6e5d990b6b1564
author: robs <robs>
date: Tue Nov 18 14:49:07 EST 2008

updates

--- a/scripts/synth.sh
+++ b/scripts/synth.sh
@@ -19,36 +19,66 @@
 sox=../src/sox
 play=../src/play
 
-A0="pl %-29 pl %-24 pl %-17 pl %-12 pl %-8 pl %-5"
-B0="pl %-27 pl %-22 pl %-15 pl %-10 pl %-6 pl %-3"
-A1="pl %-17 pl %-12 pl %-9 pl %-5 pl %0 pl %4"
-B1="pl %-15 pl %-10 pl %-7 pl %-3 pl %2 pl %6"
+G0="pl %-26 pl %-19 pl %-14 pl %-10 pl %-7 pl %-2"
+A0="pl %-24 pl %-17 pl %-12 pl %-8 pl %-5 pl %0"
+C0="pl %-26 pl %-21 pl %-14 pl %-9 pl %-5 pl %-2"
+D0="pl %-24 pl %-19 pl %-12 pl %-7 pl %-3 pl %0"
+E0="pl %-22 pl %-17 pl %-10 pl %-5 pl %-1 pl %2"
+Bb0="pl %-23 pl %-16 pl %-11 pl %-7 pl %-4 pl %1"
 
-e="delay 0 .02 .04 .06 .08 .1 remix - overdrive 40 gain -11 fade 0"
+o="overdrive 40 gain -8"
+e="delay 0 .02 .04 .06 .08 .1 remix - $o fade 0"
 s="$sox -q -n -p synth 0 0 0 80 87"
+l="$sox -q -n -p synth 0 0 0 80 0"
 
 $play -m -v .8 \
 "|$sox \
 \"|$sox -n -p synth noise fade 0 .5 .48 trim 0 .15\" \
 \"|$sox -n -p synth noise fade h 0 .26 .11 gain -35 lowpass -1 12k\" \
--p splice .15,.06,0 gain -15 lowpass -1 12k highpass -1 9k \
+-p splice .15,.06,0 gain -14 lowpass -1 12k highpass -1 9k \
 equalizer 14k 1.3 13 \
 equalizer 9500 10 8 \
 equalizer 7000 10 8 \
 equalizer 5200 10 8 \
 equalizer 3800 10 8 \
-equalizer 1500 10 8 pad 0 .21 remix 1 1 reverb 20 repeat 72" \
+equalizer 1500 10 8 pad 0 .21 remix 1 1 reverb 20 repeat 59" \
 "|$sox \
 \"|$sox -n -p trim 0 1.4\" \
-\"|$s $A0 $e 4 .1 bend .4,+200,.3\" \
-\"|$s $A0 $e 4 .1 bend .4,+200,.3\" \
-\"|$s $B0 $e 4 .1 bend .4,-200,.3\" \
-\"|$s $A0 $e 4 .1 bend .4,-300,.3\" \
-\"|$s $A1 $e 4 .1 bend .4,+200,.3\" \
-\"|$s $A1 $e 4 .1 bend .4,+200,.3\" \
-\"|$s $B1 $e 4 .1 bend .4,-200,.3\" \
-\"|$s $A1 $e 4 .1 bend .4,-300,.3\" \
-\"|$s $A1 $e 3.05 .1 bend .4,+200,.3\" \
-\"|$s $A1 $e .5 .2 \" \
-\"|$s $B1 $e .5 .2 \" \
--p pad 0 3 remix 1 1 flanger reverb 70"
+\"|$s $G0 $e 2.6 .1 bend .5,200,.2\" \
+\"|$s $C0 $e 2 .1\" \
+\"|$s $D0 $e 4 .1\" \
+\"|$s $A0 $e 2 .1\" \
+\"|$s $C0 $e 2 .1\" \
+\"|$s $D0 $e 4 .1\" \
+\"|$s $A0 $e 2 .1\" \
+\"|$s $C0 $e 2 .1\" \
+\"|$s $D0 $e 2 .1\" \
+\"|$s $Bb0 $e 2 .1\" \
+\"|$s $E0 $e 4 .1\" \
+-p pad 0 3 remix 1 1 flanger reverb 70" \
+"|$sox \
+\"|$sox -n -p trim 0 8\" \
+\"|$l pl %7 $o trim 0 .25\" \
+\"|$l pl %12 $o trim 0 .2\" \
+\"|$l pl %10 $o trim 0 .5 bend .2,-300,.1\" \
+\"|$l pl %5 $o trim 0 .5 bend .2,-200,.1\" \
+\"|$l pl %0 $o fade 0 .55 .1 bend .2,-200,.1\" \
+\"|$l pl %12 $o trim 0 5.95\" \
+\"|$l pl %12 $o trim 0 .5 bend .2,-200,.1\" \
+\"|$l pl %12 $o trim 0 .5 bend .2,-200,.1\" \
+\"|$l pl %12 $o trim 0 .5 bend .2,-200,.1\" \
+\"|$l pl %12 $o fade 0 .6 .1 bend .2,-200,.1\" \
+\"|$l pl %12 $o trim 0 1.95 bend .3,-100,1\" \
+\"|$l pl %10 $o trim 0 2 bend .3,-50,1\" \
+\"|$l pl %9 $o trim 0 2 gain -3 \" \
+\"|$l pl %8 $o trim 0 2 gain -6 \" \
+\"|$l pl %2 pl %7 delay 0 .02 remix - $o trim 0 .25\" \
+\"|$l pl %-5 $o trim 0 .25\" \
+\"|$l pl %-5 $o trim 0 .25\" \
+\"|$l pl %2 pl %7 delay 0 .02 remix - $o trim 0 .25\" \
+\"|$l pl %-5 $o trim 0 .25\" \
+\"|$l pl %-5 $o trim 0 .25\" \
+\"|$l pl %2 pl %7 delay 0 .02 remix - $o trim 0 .25\" \
+\"|$l pl %-5 $o trim 0 .25\" \
+\"|$l pl %2 pl %7 delay 0 .02 remix - $o fade h 0 6 6\" \
+-p gain -4 remix 1 1 flanger"
--- a/src/overdrive.c
+++ b/src/overdrive.c
@@ -37,19 +37,10 @@
 static int start(sox_effect_t * effp)
 {
   priv_t * p = (priv_t *)effp->priv;
-  double fc = 10;
-  double w0 = 2 * M_PI * fc / effp->in_signal.rate;
 
   if (p->gain == 1)
     return SOX_EFF_NULL;
 
-  if (w0 > M_PI) {
-    lsx_fail("frequency must be less than half the sample-rate (Nyquist rate)");
-    return SOX_EOF;
-  }
-  p->a1 = -exp(-w0);
-  p->b0 = (1 - p->a1)/2;
-  p->b1 = -p->b0;
   return SOX_SUCCESS;
 }
 
@@ -59,13 +50,13 @@
   priv_t * p = (priv_t *)effp->priv;
   size_t dummy = 0, len = *isamp = *osamp = min(*isamp, *osamp);
   while (len--) {
-    double d = SOX_SAMPLE_TO_FLOAT_64BIT(*ibuf++, dummy);
+    double d = SOX_SAMPLE_TO_FLOAT_64BIT(*ibuf++, dummy), d0 = d;
     d *= p->gain;
     d += p->colour;
     d = d < -1? -2./3 : d > 1? 2./3 : d - d * d * d * (1./3);
-    p->last_out = p->b0 * d + p->b1 * p->last_in - p->a1 * p->last_out;
+    p->last_out = d - p->last_in + .995 * p->last_out;
     p->last_in = d;
-    *obuf++ = SOX_FLOAT_64BIT_TO_SAMPLE(p->last_out, dummy);
+    *obuf++ = SOX_FLOAT_64BIT_TO_SAMPLE(d0 * .5 + p->last_out * .75, dummy);
   }
   return SOX_SUCCESS;
 }