shithub: sox

Download patch

ref: 19a10cb2b8a643e7d96a3f322cb94a49827c16a4
parent: 9e04963740c0f4afb924bd7308b290f0745f1536
author: Ulrich Klauer <ulrich@chirlu.de>
date: Mon Dec 26 09:17:03 EST 2011

fir effect: support for --plot

--- a/sox.1
+++ b/sox.1
@@ -2140,12 +2140,14 @@
 .EX
    # HP filter
    # freq=10000
-     1.2311233052619888e-01
-    \-4.4777096106211783e-01
-     5.1031563346705155e-01
-    \-6.6502926320995331e-02
+     1.2311233052619888e\-01
+    \-4.4777096106211783e\-01
+     5.1031563346705155e\-01
+    \-6.6502926320995331e\-02
    ...
 .EE
+.SP
+This effect supports the \fB\-\-plot\fR global option.
 .TP
 \fBflanger\fR [\fIdelay depth regen width speed shape phase interp\fR]
 Apply a flanging effect to the audio.
--- a/src/fir.c
+++ b/src/fir.c
@@ -73,6 +73,14 @@
     lsx_report("%i coefficients", p->n);
     if (!p->n)
       return SOX_EFF_NULL;
+    if (effp->global_info->plot != sox_plot_off) {
+      char title[100];
+      sprintf(title, "SoX effect: fir (%d coefficients)", p->n);
+      lsx_plot_fir(p->h, p->n, effp->in_signal.rate,
+          effp->global_info->plot, title, -30., 30.);
+      free(p->h);
+      return SOX_EOF;
+    }
     lsx_set_dft_filter(f, p->h, p->n, p->n >> 1);
   }
   return lsx_dft_filter_effect_fn()->start(effp);