shithub: sox

Download patch

ref: 6ab46f5ce1be3069d817e83304b716c728a30b13
parent: 8c3e9929c87493382bf82983aa1cb0b20aa99e3b
author: robs <robs>
date: Sat Nov 25 13:30:06 EST 2006

Split -V messages in two via st_report and newly created st_debug

--- a/Changelog
+++ b/Changelog
@@ -47,6 +47,8 @@
   o Make sox and soxmix a single binary.  (Reuben Thomas)
   o Consistent (and hopefully complete) clipping detection and
     reporting.  (robs)
+  o -V now gives only user-relevant messages, use -V -V to get
+    developer-relevant messages.  (robs)
 
 sox-12.18.2
 -----------
--- a/sox.1
+++ b/sox.1
@@ -154,13 +154,48 @@
 .TP 10
 \fB--version\fR
 Print version number and exit.
-.TP 10
-\fB-V\fR
-Print a description of processing phases.
+.IP "\fB\-V[level]\fP"
+Set verbosity.
+.I Sox
+prints messages to the console (stderr) according to the following
+verbosity levels:
+.IP
+.RS
+.IP 0
+No messages are printed at all; use the exit status to determine
+if an error has ocurred.
+.IP 1
+Only error messages are printed. These are generated if
+.I SoX
+cannot complete the requested commands.
+.IP 2
+Warning messages are also printed.  These are generated if
+.I SoX
+can complete the requested commands,
+but not exactly according to the requested command parameters,
+or if clipping occurs.
+.IP 3
+Descriptions of
+.I SoX's
+processing phases are also printed.
 Useful for figuring out exactly how
 .I SoX
-.PP
 is mangling your sound samples.
+.IP "4 and above"
+Messages to help with debugging
+.I SoX
+are also printed.
+.RE
+.IP
+By default, the verbosity level is set to 2.  Each occurrence of the \fI-V\fR
+option increases the verbosity level by 1.  Alternatively, the verbosity
+level can be set to an absolute number by specifying it immediately after
+the
+.I -V
+e.g.
+.I -V0
+sets it to 0.
+.IP
 .PP
 \fBFormat options:\fR
 .PP
--- a/src/8svx.c
+++ b/src/8svx.c
@@ -111,7 +111,7 @@
                                 return(ST_EOF);
                         }
                         chunk_buf[chunksize] = '\0';
-                        st_report("%s",chunk_buf);
+                        st_debug("%s",chunk_buf);
                         free(chunk_buf);
 
                         continue;
@@ -134,7 +134,7 @@
                                 return(ST_EOF);
                         }
                         chunk_buf[chunksize] = '\0';
-                        st_report("%s",chunk_buf);
+                        st_debug("%s",chunk_buf);
                         free(chunk_buf);
 
                         continue;
--- a/src/FFT.c
+++ b/src/FFT.c
@@ -51,6 +51,8 @@
 #include <math.h>
 #include <assert.h>
 
+#include "st_i.h"
+
 #include "FFT.h"
 
 int **gFFTBitTable = NULL;
@@ -75,7 +77,7 @@
    int i;
 
    if (PowerOfTwo < 2) {
-      fprintf(stderr, "Error: FFT called with size %d\n", PowerOfTwo);
+      st_debug("Error: FFT called with size %d", PowerOfTwo);
       exit(1);
    }
 
@@ -140,7 +142,7 @@
    float tr, ti;                /* temp real, temp imaginary */
 
    if (!IsPowerOfTwo(NumSamples)) {
-      fprintf(stderr, "%d is not a power of two\n", NumSamples);
+      st_debug("%d is not a power of two", NumSamples);
       exit(1);
    }
 
--- a/src/aiff.c
+++ b/src/aiff.c
@@ -366,7 +366,7 @@
                         if (st_eof(ft))
                                 break;
                         buf[4] = 0;
-                        st_report("AIFFstartread: ignoring '%s' chunk\n", buf);
+                        st_debug("AIFFstartread: ignoring '%s' chunk", buf);
                         st_readdw(ft, &chunksize);
                         if (st_eof(ft))
                                 break;
@@ -441,7 +441,7 @@
                         || (ft->info.rate == 0)
                         || (ft->info.encoding == -1)
                         || (ft->info.size == -1)) {
-                  st_report("You must specify # channels, sample rate, signed/unsigned,\n");
+                  st_report("You must specify # channels, sample rate, signed/unsigned,");
                   st_report("and 8/16 on the command line.");
                   st_fail_errno(ft,ST_EFMT,"Bogus AIFF file: no COMM section.");
                   return(ST_EOF);
@@ -460,12 +460,12 @@
         
         if (foundmark && !foundinstr)
         {
-            st_report("Ignoring MARK chunk since no INSTR found.");
+            st_debug("Ignoring MARK chunk since no INSTR found.");
             foundmark = 0;
         }
         if (!foundmark && foundinstr)
         {
-            st_report("Ignoring INSTR chunk since no MARK found.");
+            st_debug("Ignoring INSTR chunk since no MARK found.");
             foundinstr = 0;
         }
         if (foundmark && foundinstr) {
@@ -524,7 +524,7 @@
   int loopNum;
 
   if(ft->instr.nloops > 0)
-    st_report("AIFF Loop markers:\n");
+    st_report("AIFF Loop markers:");
   for(loopNum  = 0; loopNum < ft->instr.nloops; loopNum++) {
     if (ft->loops[loopNum].count) {
       st_report("Loop %d: start: %6d", loopNum, ft->loops[loopNum].start);
@@ -533,15 +533,15 @@
       st_report(" count: %6d", ft->loops[loopNum].count);
       st_report(" type:  ");
       switch(ft->loops[loopNum].type & ~ST_LOOP_SUSTAIN_DECAY) {
-      case 0: st_report("off\n"); break;
-      case 1: st_report("forward\n"); break;
-      case 2: st_report("forward/backward\n"); break;
+      case 0: st_report("off"); break;
+      case 1: st_report("forward"); break;
+      case 2: st_report("forward/backward"); break;
       }
     }
   }
-  st_report("Unity MIDI Note: %d\n", ft->instr.MIDInote);
-  st_report("Low   MIDI Note: %d\n", ft->instr.MIDIlow);
-  st_report("High  MIDI Note: %d\n", ft->instr.MIDIhi);
+  st_report("Unity MIDI Note: %d", ft->instr.MIDInote);
+  st_report("Low   MIDI Note: %d", ft->instr.MIDIlow);
+  st_report("High  MIDI Note: %d", ft->instr.MIDIhi);
 }
 
 /* Process a text chunk, allocate memory, display it if verbose and return */
@@ -572,7 +572,7 @@
                         return(ST_EOF);
                 }
         }
-  st_report("%-10s   \"%s\"\n", chunkDescription, *text);
+  st_debug("%-10s   \"%s\"", chunkDescription, *text);
   return(ST_SUCCESS);
 }
 
@@ -626,7 +626,7 @@
         }
     }
   }
-  st_report("%-10s   \"%s\"\n", chunkDescription, *text);
+  st_debug("%-10s   \"%s\"", chunkDescription, *text);
   /* make sure we read the whole chunk */
   if (totalReadLength < chunksize) {
        int i;
@@ -671,10 +671,10 @@
                 if (st_eof(ft))
                         break;
                 buf[4] = '\0';
-                st_warn("Ignoring AIFF tail chunk: '%s', %d bytes long\n", 
+                st_warn("Ignoring AIFF tail chunk: '%s', %d bytes long", 
                         buf, chunksize);
                 if (! strcmp(buf, "MARK") || ! strcmp(buf, "INST"))
-                        st_warn("       You're stripping MIDI/loop info!\n");
+                        st_warn("       You're stripping MIDI/loop info!");
                 while (chunksize-- > 0) 
                 {
                         if (st_readb(ft, (unsigned char *)&trash) == ST_EOF)
@@ -1042,7 +1042,7 @@
         char buf[10];
         ConvertToIeeeExtended(x, buf);
         /*
-        st_report("converted %g to %o %o %o %o %o %o %o %o %o %o",
+        st_debug("converted %g to %o %o %o %o %o %o %o %o %o %o",
                 x,
                 buf[0], buf[1], buf[2], buf[3], buf[4],
                 buf[5], buf[6], buf[7], buf[8], buf[9]);
--- a/src/alsa.c
+++ b/src/alsa.c
@@ -452,7 +452,7 @@
         {
             if (xrun_recovery(alsa->pcm_handle, err) < 0)
             {
-                st_fail_errno(ft, ST_EPERM, "ALSA write error\n");
+                st_fail_errno(ft, ST_EPERM, "ALSA write error");
                 return ST_EOF;
             }
         }
--- a/src/au.c
+++ b/src/au.c
@@ -99,7 +99,7 @@
             *size = ST_SIZE_32BIT;
             break;
     default:
-            st_report("encoding: 0x%lx", encoding);
+            st_debug("encoding: 0x%lx", encoding);
             return(ST_EOF);
     }
     return(ST_SUCCESS);
@@ -171,17 +171,17 @@
                  * endianess.  Its not hurting though.
                  */
                 ft->swap = ft->swap ? 0 : 1;
-                st_report("Found inverted DEC magic word.  Swapping bytes.");
+                st_debug("Found inverted DEC magic word.  Swapping bytes.");
         }
         else if (magic == SUN_INV_MAGIC) {
                 ft->swap = ft->swap ? 0 : 1;
-                st_report("Found inverted Sun/NeXT magic word. Swapping bytes.");
+                st_debug("Found inverted Sun/NeXT magic word. Swapping bytes.");
         }
         else if (magic == SUN_MAGIC) {
-                st_report("Found Sun/NeXT magic word");
+                st_debug("Found Sun/NeXT magic word");
         }
         else if (magic == DEC_MAGIC) {
-                st_report("Found DEC magic word");
+                st_debug("Found DEC magic word");
         }
         else
         {
@@ -424,7 +424,7 @@
         if ((encoding = st_ausunencoding(ft->info.size, ft->info.encoding)) == -1) {
                 st_report("Unsupported output encoding/size for Sun/NeXT header or .AU format not specified.");
                 st_report("Only U-law, A-law signed bytes, and signed words are supported.");
-                st_report("Defaulting to 8khz u-law\n");
+                st_report("Defaulting to 8khz u-law");
                 encoding = SUN_ULAW;
                 ft->info.encoding = ST_ENCODING_ULAW;
                 ft->info.size = ST_SIZE_BYTE;
--- a/src/auto.c
+++ b/src/auto.c
@@ -185,7 +185,7 @@
 
     if(!type)
     {
-        st_fail_errno(ft,ST_EFMT, "Could not determine file type.\n");
+        st_fail_errno(ft,ST_EFMT, "Could not determine file type.");
         return (ST_EOF);
     }
     free(ft->filetype);
@@ -193,11 +193,11 @@
     rc = st_gettype(ft); /* Change ft->h to the new format */
     if(rc != ST_SUCCESS)
     {
-        st_fail_errno(ft,ST_EFMT,"Do not understand format type: %s\n",type);
+        st_fail_errno(ft,ST_EFMT,"Do not understand format type: %s",type);
         return (rc);
     }
 
-    st_report("Detected file format type: %s\n", type);
+    st_report("Detected file format type: %s", type);
     return ((* ft->h->startread)(ft));
 }
 
--- a/src/band.c
+++ b/src/band.c
@@ -93,7 +93,7 @@
         band_t band = (band_t) effp->priv;
         if (band->center > effp->ininfo.rate/2)
         {
-                st_fail("Band: center must be < minimum data rate/2\n");
+                st_fail("Band: center must be < minimum data rate/2");
                 return (ST_EOF);
         }
 
--- a/src/chorus.c
+++ b/src/chorus.c
@@ -146,17 +146,17 @@
 
         if ( chorus->in_gain < 0.0 )
         {
-                st_fail("chorus: gain-in must be positive!\n");
+                st_fail("chorus: gain-in must be positive!");
                 return (ST_EOF);
         }
         if ( chorus->in_gain > 1.0 )
         {
-                st_fail("chorus: gain-in must be less than 1.0!\n");
+                st_fail("chorus: gain-in must be less than 1.0!");
                 return (ST_EOF);
         }
         if ( chorus->out_gain < 0.0 )
         {
-                st_fail("chorus: gain-out must be positive!\n");
+                st_fail("chorus: gain-out must be positive!");
                 return (ST_EOF);
         }
         for ( i = 0; i < chorus->num_chorus; i++ ) {
@@ -167,42 +167,42 @@
 
                 if ( chorus->delay[i] < 20.0 )
                 {
-                        st_fail("chorus: delay must be more than 20.0 msec!\n");
+                        st_fail("chorus: delay must be more than 20.0 msec!");
                         return (ST_EOF);
                 }
                 if ( chorus->delay[i] > 100.0 )
                 {
-                        st_fail("chorus: delay must be less than 100.0 msec!\n");
+                        st_fail("chorus: delay must be less than 100.0 msec!");
                         return (ST_EOF);
                 }
                 if ( chorus->speed[i] < 0.1 )
                 {
-                        st_fail("chorus: speed must be more than 0.1 Hz!\n");
+                        st_fail("chorus: speed must be more than 0.1 Hz!");
                         return (ST_EOF);
                 }
                 if ( chorus->speed[i] > 5.0 )
                 {
-                        st_fail("chorus: speed must be less than 5.0 Hz!\n");
+                        st_fail("chorus: speed must be less than 5.0 Hz!");
                         return (ST_EOF);
                 }
                 if ( chorus->depth[i] < 0.0 )
                 {
-                        st_fail("chorus: delay must be more positive!\n");
+                        st_fail("chorus: delay must be more positive!");
                         return (ST_EOF);
                 }
                 if ( chorus->depth[i] > 10.0 )
                 {
-                    st_fail("chorus: delay must be less than 10.0 msec!\n");
+                    st_fail("chorus: delay must be less than 10.0 msec!");
                     return (ST_EOF);
                 }
                 if ( chorus->decay[i] < 0.0 )
                 {
-                        st_fail("chorus: decay must be positive!\n" );
+                        st_fail("chorus: decay must be positive!" );
                         return (ST_EOF);
                 }
                 if ( chorus->decay[i] > 1.0 )
                 {
-                        st_fail("chorus: decay must be less that 1.0!\n" );
+                        st_fail("chorus: decay must be less that 1.0!" );
                         return (ST_EOF);
                 }
                 chorus->length[i] = effp->ininfo.rate / chorus->speed[i];
@@ -209,7 +209,7 @@
                 if (! (chorus->lookup_tab[i] = 
                         (int *) malloc(sizeof (int) * chorus->length[i])))
                 {
-                        st_fail("chorus: Cannot malloc %d bytes!\n", 
+                        st_fail("chorus: Cannot malloc %d bytes!", 
                                 sizeof(int) * chorus->length[i]);
                         return (ST_EOF);
                 }
@@ -238,7 +238,7 @@
         if (! (chorus->chorusbuf = 
                 (float *) malloc(sizeof (float) * chorus->maxsamples)))
         {
-                st_fail("chorus: Cannot malloc %d bytes!\n", 
+                st_fail("chorus: Cannot malloc %d bytes!", 
                         sizeof(float) * chorus->maxsamples);
                 return (ST_EOF);
         }
--- a/src/compand.c
+++ b/src/compand.c
@@ -124,7 +124,7 @@
       if (commas % 2 == 0) /* There must be an even number of
                               transfer parameters */
       {
-        st_fail("compander: Odd number of transfer function parameters\n"
+        st_fail("compander: Odd number of transfer function parameters"
              "Each input value in dB must have a corresponding output value");
         return (ST_EOF);
       }
@@ -196,26 +196,22 @@
   compand_t l = (compand_t) effp->priv;
   int i;
 
-# ifdef DEBUG
-  {
-    fprintf(stderr, "Starting compand effect\n");
-    fprintf(stderr, "\nRate %ld, size %d, encoding %d, output gain %g.\n",
-           effp->outinfo.rate, effp->outinfo.size, effp->outinfo.encoding,
-           l->outgain);
-    fprintf(stderr, "%d input channel(s) expected: actually %d\n",
-           l->expectedChannels, effp->outinfo.channels);
-    fprintf(stderr, "\nAttack and decay rates\n"
-             "======================\n");
-    for (i = 0; i < l->expectedChannels; ++i)
-      fprintf(stderr, "Channel %d: attack = %-12g decay = %-12g\n",
-             i, l->attackRate[i], l->decayRate[i]);
-    fprintf(stderr, "\nTransfer function (linear values)\n"
-             "=================  =============\n");
-    for (i = 0; i < l->transferPoints; ++i)
-      fprintf(stderr, "%12g -> %-12g\n",
-             l->transferIns[i], l->transferOuts[i]);
-  }
-# endif
+  st_debug("Starting compand effect");
+  st_debug("Rate %ld, size %d, encoding %d, output gain %g.",
+         effp->outinfo.rate, effp->outinfo.size, effp->outinfo.encoding,
+         l->outgain);
+  st_debug("%d input channel(s) expected: actually %d",
+         l->expectedChannels, effp->outinfo.channels);
+  st_debug("Attack and decay rates"
+           "======================");
+  for (i = 0; i < l->expectedChannels; ++i)
+    st_debug("Channel %d: attack = %-12g decay = %-12g",
+           i, l->attackRate[i], l->decayRate[i]);
+  st_debug("Transfer function (linear values)"
+           "=================  =============");
+  for (i = 0; i < l->transferPoints; ++i)
+    st_debug("%12g -> %-12g",
+           l->transferIns[i], l->transferOuts[i]);
   
   /* Convert attack and decay rates using number of samples */
 
--- a/src/cvsd.c
+++ b/src/cvsd.c
@@ -153,7 +153,7 @@
         p->bytes_written = 0;
         p->com.v_min = 1;
         p->com.v_max = -1;
-        st_report("cvsd: bit rate %dbit/s, bits from %s\n", p->cvsd_rate,
+        st_report("cvsd: bit rate %dbit/s, bits from %s", p->cvsd_rate,
                p->swapbits ? "msb to lsb" : "lsb to msb");
 }
 
@@ -215,7 +215,7 @@
                 st_writeb(ft, p->bit.shreg);
                 p->bytes_written++;
         }
-        st_report("cvsd: min slope %f, max slope %f\n", 
+        st_debug("cvsd: min slope %f, max slope %f", 
                p->com.v_min, p->com.v_max);     
 
         return (ST_SUCCESS);
@@ -227,7 +227,7 @@
 {
         struct cvsdpriv *p = (struct cvsdpriv *) ft->priv;
 
-        st_report("cvsd: min value %f, max value %f\n", 
+        st_debug("cvsd: min value %f, max value %f", 
                p->com.v_min, p->com.v_max);
 
         return(ST_SUCCESS);
@@ -496,7 +496,7 @@
         hdr->Crc = get16(&pch);
         if (sum != hdr->Crc) 
         {
-                st_report("DVMS header checksum error, read %u, calculated %u\n",
+                st_report("DVMS header checksum error, read %u, calculated %u",
                      hdr->Crc, sum);
                 return (ST_EOF);
         }
@@ -543,7 +543,7 @@
         }
         if (st_writebuf(ft, hdrbuf, sizeof(hdrbuf), 1) != 1)
         {
-                st_report("%s\n",strerror(errno));
+                st_report("%s",strerror(errno));
                 return (ST_EOF);
         }
         return (ST_SUCCESS);
@@ -585,25 +585,25 @@
 
         rc = dvms_read_header(ft, &hdr);
         if (rc){
-            st_fail_errno(ft,ST_EHDR,"unable to read DVMS header\n");
+            st_fail_errno(ft,ST_EHDR,"unable to read DVMS header");
             return rc;
         }
 
-        st_report("DVMS header of source file \"%s\":");
-        st_report("  filename  \"%.14s\"",ft->filename);
-        st_report("  id        0x%x", hdr.Filename);
-        st_report("  state     0x%x", hdr.Id, hdr.State);
-        st_report("  time      %s",ctime(&hdr.Unixtime)); /* ctime generates lf */
-        st_report("  usender   %u", hdr.Usender);
-        st_report("  ureceiver %u", hdr.Ureceiver);
-        st_report("  length    %u", hdr.Length);
-        st_report("  srate     %u", hdr.Srate);
-        st_report("  days      %u", hdr.Days);
-        st_report("  custom1   %u", hdr.Custom1);
-        st_report("  custom2   %u", hdr.Custom2);
-        st_report("  info      \"%.16s\"\n", hdr.Info);
+        st_debug("DVMS header of source file \"%s\":");
+        st_debug("  filename  \"%.14s\"",ft->filename);
+        st_debug("  id        0x%x", hdr.Filename);
+        st_debug("  state     0x%x", hdr.Id, hdr.State);
+        st_debug("  time      %s",ctime(&hdr.Unixtime)); /* ctime generates lf */
+        st_debug("  usender   %u", hdr.Usender);
+        st_debug("  ureceiver %u", hdr.Ureceiver);
+        st_debug("  length    %u", hdr.Length);
+        st_debug("  srate     %u", hdr.Srate);
+        st_debug("  days      %u", hdr.Days);
+        st_debug("  custom1   %u", hdr.Custom1);
+        st_debug("  custom2   %u", hdr.Custom2);
+        st_debug("  info      \"%.16s\"", hdr.Info);
         ft->info.rate = (hdr.Srate < 240) ? 16000 : 32000;
-        st_report("DVMS rate %dbit/s using %dbit/s deviation %d%%\n", 
+        st_debug("DVMS rate %dbit/s using %dbit/s deviation %d%%", 
                hdr.Srate*100, ft->info.rate, 
                ((ft->info.rate - hdr.Srate*100) * 100) / ft->info.rate);
         rc = st_cvsdstartread(ft);
@@ -629,7 +629,7 @@
         make_dvms_hdr(ft, &hdr);
         rc = dvms_write_header(ft, &hdr);
         if (rc){
-                st_fail_errno(ft,rc,"cannot write DVMS header\n");
+                st_fail_errno(ft,rc,"cannot write DVMS header");
             return rc;
         }
 
@@ -661,7 +661,7 @@
         make_dvms_hdr(ft, &hdr);
         rc = dvms_write_header(ft, &hdr);
         if(rc){
-            st_fail_errno(ft,rc,"cannot write DVMS header\n");
+            st_fail_errno(ft,rc,"cannot write DVMS header");
             return rc;
         }       
         return rc;
--- a/src/deemphas.c
+++ b/src/deemphas.c
@@ -109,6 +109,9 @@
      double      lastout;
 } *deemph_t;
 
+assert_static(sizeof(struct deemphstuff) <= ST_MAX_EFFECT_PRIVSIZE, 
+    /* else */ deemph_PRIVSIZE_too_big);
+
 /*
  * Process options
  *
@@ -120,11 +123,6 @@
      if (n)
      {
           st_fail(st_deemph_effect.usage);
-          return (ST_EOF);
-     }
-     if (sizeof(double)*ST_MAX_EFFECT_PRIVSIZE < sizeof(struct deemphstuff))
-     {
-          st_fail("Internal error: PRIVSIZE too small.\n");
           return (ST_EOF);
      }
      return (ST_SUCCESS);
--- a/src/earwax.c
+++ b/src/earwax.c
@@ -100,7 +100,7 @@
   if (effp->ininfo.encoding != ST_ENCODING_SIGN2
       || effp->ininfo.rate != 44100
       || effp->ininfo.channels != 2){
-    st_fail("the earwax effect works only with audio cd (44.1 kHz, twos-complement signed linear, stereo) samples.\n");
+    st_fail("the earwax effect works only with audio cd (44.1 kHz, twos-complement signed linear, stereo) samples.");
     return (ST_EOF);
   }
 
@@ -107,7 +107,7 @@
   /* allocate tap memory */
   earwax->tap = (st_sample_t*)malloc( sizeof(st_sample_t) * EARWAX_NUMTAPS );
   if( !earwax->tap ){
-    st_fail("earwax: Cannot malloc %d bytes!\n", 
+    st_fail("earwax: Cannot malloc %d bytes!", 
             sizeof(st_sample_t) * EARWAX_NUMTAPS );
     return (ST_EOF);
   }
--- a/src/echo.c
+++ b/src/echo.c
@@ -123,17 +123,17 @@
         echo->maxsamples = 0L;
         if ( echo->in_gain < 0.0 )
         {
-                st_fail("echo: gain-in must be positive!\n");
+                st_fail("echo: gain-in must be positive!");
                 return (ST_EOF);
         }
         if ( echo->in_gain > 1.0 )
         {
-                st_fail("echo: gain-in must be less than 1.0!\n");
+                st_fail("echo: gain-in must be less than 1.0!");
                 return (ST_EOF);
         }
         if ( echo->out_gain < 0.0 )
         {
-                st_fail("echo: gain-in must be positive!\n");
+                st_fail("echo: gain-in must be positive!");
                 return (ST_EOF);
         }
         for ( i = 0; i < echo->num_delays; i++ ) {
@@ -140,23 +140,23 @@
                 echo->samples[i] = echo->delay[i] * effp->ininfo.rate / 1000.0;
                 if ( echo->samples[i] < 1 )
                 {
-                    st_fail("echo: delay must be positive!\n");
+                    st_fail("echo: delay must be positive!");
                     return (ST_EOF);
                 }
                 if ( echo->samples[i] > DELAY_BUFSIZ )
                 {
-                        st_fail("echo: delay must be less than %g seconds!\n",
+                        st_fail("echo: delay must be less than %g seconds!",
                                 DELAY_BUFSIZ / (float) effp->ininfo.rate );
                         return (ST_EOF);
                 }
                 if ( echo->decay[i] < 0.0 )
                 {
-                    st_fail("echo: decay must be positive!\n" );
+                    st_fail("echo: decay must be positive!" );
                     return (ST_EOF);
                 }
                 if ( echo->decay[i] > 1.0 )
                 {
-                    st_fail("echo: decay must be less than 1.0!\n" );
+                    st_fail("echo: decay must be less than 1.0!" );
                     return (ST_EOF);
                 }
                 if ( echo->samples[i] > echo->maxsamples )
@@ -164,7 +164,7 @@
         }
         if (! (echo->delay_buf = (double *) malloc(sizeof (double) * echo->maxsamples)))
         {
-                st_fail("echo: Cannot malloc %d bytes!\n", 
+                st_fail("echo: Cannot malloc %d bytes!", 
                         sizeof(long) * echo->maxsamples);
                 return (ST_EOF);
         }
--- a/src/echos.c
+++ b/src/echos.c
@@ -116,17 +116,17 @@
 
         if ( echos->in_gain < 0.0 )
         {
-                st_fail("echos: gain-in must be positive!\n");
+                st_fail("echos: gain-in must be positive!");
                 return (ST_EOF);
         }
         if ( echos->in_gain > 1.0 )
         {
-                st_fail("echos: gain-in must be less than 1.0!\n");
+                st_fail("echos: gain-in must be less than 1.0!");
                 return (ST_EOF);
         }
         if ( echos->out_gain < 0.0 )
         {
-                st_fail("echos: gain-in must be positive!\n");
+                st_fail("echos: gain-in must be positive!");
                 return (ST_EOF);
         }
         for ( i = 0; i < echos->num_delays; i++ ) {
@@ -133,23 +133,23 @@
                 echos->samples[i] = echos->delay[i] * effp->ininfo.rate / 1000.0;
                 if ( echos->samples[i] < 1 )
                 {
-                    st_fail("echos: delay must be positive!\n");
+                    st_fail("echos: delay must be positive!");
                     return (ST_EOF);
                 }
                 if ( echos->samples[i] > DELAY_BUFSIZ )
                 {
-                        st_fail("echos: delay must be less than %g seconds!\n",
+                        st_fail("echos: delay must be less than %g seconds!",
                                 DELAY_BUFSIZ / (float) effp->ininfo.rate );
                         return (ST_EOF);
                 }
                 if ( echos->decay[i] < 0.0 )
                 {
-                    st_fail("echos: decay must be positive!\n" );
+                    st_fail("echos: decay must be positive!" );
                     return (ST_EOF);
                 }
                 if ( echos->decay[i] > 1.0 )
                 {
-                    st_fail("echos: decay must be less than 1.0!\n" );
+                    st_fail("echos: decay must be less than 1.0!" );
                     return (ST_EOF);
                 }
                 echos->counter[i] = 0;
@@ -158,7 +158,7 @@
         }
         if (! (echos->delay_buf = (double *) malloc(sizeof (double) * echos->sumsamples)))
         {
-                st_fail("echos: Cannot malloc %d bytes!\n", 
+                st_fail("echos: Cannot malloc %d bytes!", 
                         sizeof(double) * echos->sumsamples);
                 return(ST_EOF);
         }
--- a/src/equalizer.c
+++ b/src/equalizer.c
@@ -101,13 +101,13 @@
   amp = pow( 10, eq->gain/40 );
   alpha = sin(w0)/( 2*eq->Q );
 
-  st_report("Debug: cfreq: %fHz", eq->cfreq);
-  st_report("Debug: Q: %f", eq->Q);
-  st_report("Debug: gain: %fdB", eq->gain);
-  st_report("Debug: rate: %f", eq->rate);
-  st_report("Debug: w0: %f", w0);
-  st_report("Debug: amp: %f", amp);
-  st_report("Debug: alpha: %f", alpha);
+  st_debug("cfreq: %fHz", eq->cfreq);
+  st_debug("Q: %f", eq->Q);
+  st_debug("gain: %fdB", eq->gain);
+  st_debug("rate: %f", eq->rate);
+  st_debug("w0: %f", w0);
+  st_debug("amp: %f", amp);
+  st_debug("alpha: %f", alpha);
 
   // Initialisation
   eq->b[0] =  1 + alpha*amp;
--- a/src/fade.c
+++ b/src/fade.c
@@ -206,7 +206,7 @@
 
     fade->endpadwarned = 0;
 
-    /* fprintf(stderr, "fade: in_start = %d in_stop = %d out_start = %d out_stop = %d\n", fade->in_start, fade->in_stop, fade->out_start, fade->out_stop); */
+    /* st_debug("fade: in_start = %d in_stop = %d out_start = %d out_stop = %d", fade->in_start, fade->in_stop, fade->out_start, fade->out_stop); */
 
     return(ST_SUCCESS);
 }
--- a/src/filter.c
+++ b/src/filter.c
@@ -81,7 +81,7 @@
                 }
                 if (*p) f->freq1 = f->freq0 = 0;
         }
-        /* fprintf(stderr,"freq: %d-%d\n", f->freq0, f->freq1);fflush(stderr); */
+        st_debug("freq: %d-%d", f->freq0, f->freq1);
         if (f->freq0 == 0 && f->freq1 == 0)
         {
                 st_fail(st_filter_effect.usage);
@@ -104,7 +104,7 @@
                 return (ST_EOF);
         }
 
-        st_report("filter opts: %d-%d, window-len %d, beta %f\n", f->freq0, f->freq1, f->Nwin, f->beta);
+        st_debug("filter opts: %d-%d, window-len %d, beta %f", f->freq0, f->freq1, f->Nwin, f->beta);
         return (ST_SUCCESS);
 }
 
@@ -137,7 +137,7 @@
                 Xh0 = makeFilter(Fp0, Xh, 2.0*(double)f->freq0/f->rate, f->beta, 1, 0);
                 if (Xh0 <= 1)
                 {
-                        st_fail("filter: Unable to make low filter\n");
+                        st_fail("filter: Unable to make low filter");
                         return (ST_EOF);
                 }
         } else {
@@ -149,7 +149,7 @@
                 Xh1 = makeFilter(Fp1, Xh, 2.0*(double)f->freq1/f->rate, f->beta, 1, 0);
                 if (Xh1 <= 1)
                 {
-                        st_fail("filter: Unable to make high filter\n");
+                        st_fail("filter: Unable to make high filter");
                         return (ST_EOF);
                 }
         } else {
@@ -196,7 +196,7 @@
         long i, Nx, Nproc;
 
         /* constrain amount we actually process */
-        /* fprintf(stderr,"Xh %d, Xt %d, isamp %d, ",f->Xh, f->Xt, *isamp);fflush(stderr); */
+        /* st_debug("Xh %d, Xt %d, isamp %d, ",f->Xh, f->Xt, *isamp); */
         Nx = BUFFSIZE + 2*f->Xh - f->Xt;
         if (Nx > *isamp) Nx = *isamp;
         if (Nx > *osamp) Nx = *osamp;
@@ -222,7 +222,7 @@
                 *osamp = 0;
                 return (ST_SUCCESS);
         }
-        /* fprintf(stderr,"flow Nproc %d\n",Nproc); */
+        st_debug("flow Nproc %d",Nproc);
         FiltWin(f, Nproc);
 
         /* Copy back portion of input signal that must be re-used */
@@ -247,7 +247,7 @@
         long isamp_res, osamp_res;
         st_sample_t *Obuf;
 
-        /* fprintf(stderr,"Xh %d, Xt %d  <--- DRAIN\n",f->Xh, f->Xt); */
+        st_debug("Xh %d, Xt %d  <--- DRAIN",f->Xh, f->Xt);
 
         /* stuff end with Xh zeros */
         isamp_res = f->Xh;
@@ -258,7 +258,7 @@
                 Isamp = isamp_res;
                 Osamp = osamp_res;
                 st_filter_flow(effp, NULL, Obuf, (st_size_t *)&Isamp, (st_size_t *)&Osamp);
-          /* fprintf(stderr,"DRAIN isamp,osamp  (%d,%d) -> (%d,%d)\n",
+          /* st_debug("DRAIN isamp,osamp  (%d,%d) -> (%d,%d)",
                  * isamp_res,osamp_res,Isamp,Osamp); */
                 Obuf += Osamp;
                 osamp_res -= Osamp;
@@ -265,9 +265,9 @@
                 isamp_res -= Isamp;
         };
         *osamp -= osamp_res;
-        /* fprintf(stderr,"DRAIN osamp %d\n", *osamp); */
+        /* st_debug("DRAIN osamp %d", *osamp); */
         if (isamp_res)
-                st_warn("drain overran obuf by %d\n", isamp_res); fflush(stderr);
+                st_warn("drain overran obuf by %d", isamp_res);
         /* FIXME: This is very picky. osamp better be big enough to grab
          * all remaining samples or they will be discarded.
          */
--- a/src/flanger.c
+++ b/src/flanger.c
@@ -123,47 +123,47 @@
 
         if ( flanger->in_gain < 0.0 )
         {
-            st_fail("flanger: gain-in must be positive!\n");
+            st_fail("flanger: gain-in must be positive!");
             return (ST_EOF);
         }
         if ( flanger->in_gain > 1.0 )
         {
-            st_fail("flanger: gain-in must be less than 1.0!\n");
+            st_fail("flanger: gain-in must be less than 1.0!");
             return (ST_EOF);
         }
         if ( flanger->out_gain < 0.0 )
         {
-            st_fail("flanger: gain-out must be positive!\n");
+            st_fail("flanger: gain-out must be positive!");
             return (ST_EOF);
         }
         if ( flanger->delay < 0.0 )
         {
-            st_fail("flanger: delay must be positive!\n");
+            st_fail("flanger: delay must be positive!");
             return (ST_EOF);
         }
         if ( flanger->delay > 5.0 )
         {
-            st_fail("flanger: delay must be less than 5.0 msec!\n");
+            st_fail("flanger: delay must be less than 5.0 msec!");
             return (ST_EOF);
         }
         if ( flanger->speed < 0.1 )
         {
-            st_fail("flanger: speed must be more than 0.1 Hz!\n");
+            st_fail("flanger: speed must be more than 0.1 Hz!");
             return (ST_EOF);
         }
         if ( flanger->speed > 2.0 )
         {
-            st_fail("flanger: speed must be less than 2.0 Hz!\n");
+            st_fail("flanger: speed must be less than 2.0 Hz!");
             return (ST_EOF);
         }
         if ( flanger->decay < 0.0 )
         {
-            st_fail("flanger: decay must be positive!\n" );
+            st_fail("flanger: decay must be positive!" );
             return (ST_EOF);
         }
         if ( flanger->decay > 1.0 )
         {
-            st_fail("flanger: decay must be less that 1.0!\n" );
+            st_fail("flanger: decay must be less that 1.0!" );
             return (ST_EOF);
         }
         /* Be nice and check the hint with warning, if... */
@@ -175,7 +175,7 @@
         if (! (flanger->flangerbuf = 
                 (double *) malloc(sizeof (double) * flanger->maxsamples)))
         {
-                st_fail("flanger: Cannot malloc %d bytes!\n", 
+                st_fail("flanger: Cannot malloc %d bytes!", 
                         sizeof(double) * flanger->maxsamples);
                 return (ST_EOF);
         }
@@ -184,7 +184,7 @@
         if (! (flanger->lookup_tab = 
                 (int *) malloc(sizeof (int) * flanger->length)))
         {
-                st_fail("flanger: Cannot malloc %d bytes!\n", 
+                st_fail("flanger: Cannot malloc %d bytes!", 
                         sizeof(int) * flanger->length);
                 return(ST_EOF);
         }
--- a/src/hcom.c
+++ b/src/hcom.c
@@ -140,7 +140,7 @@
                 st_readw(ft, (unsigned short *)&(p->dictionary[i].dict_leftson));
                 st_readw(ft, (unsigned short *)&(p->dictionary[i].dict_rightson));
                 /*
-                st_report("%d %d",
+                st_debug("%d %d",
                        p->dictionary[i].dict_leftson,
                        p->dictionary[i].dict_rightson);
                        */
@@ -153,7 +153,7 @@
         p->checksum = checksum;
         p->deltacompression = compresstype;
         if (!p->deltacompression)
-                st_report("HCOM data using value compression");
+                st_debug("HCOM data using value compression");
         p->huffcount = huffcount;
         p->cksum = 0;
         p->dictentry = 0;
@@ -419,10 +419,8 @@
     d = (datafork[i] - (sample & 0xff)) & 0xff; /* creates absolute entries LMS */
     sample = datafork[i];
     datafork[i] = d;
-#if 0                           /* checking our table is accessed correctly */
-    if(d < 0 || d > 255)
-      printf("d is outside array bounds %d\n", d);
-#endif
+    if(d < 0 || d > 255) /* checking our table is accessed correctly */
+      st_debug("d is outside array bounds %d", d);
     frequtable[d]++;
   }
   de = dictionary;
@@ -476,8 +474,8 @@
           l += frequtable[i] * codesize[i];
   }
   l = (((l + 31) >> 5) << 2) + 24 + dictsize * 4;
-  st_report("  Original size: %6d bytes", *dl);
-  st_report("Compressed size: %6d bytes", l);
+  st_debug("  Original size: %6d bytes", *dl);
+  st_debug("Compressed size: %6d bytes", l);
   if((datafork = (unsigned char *)malloc((unsigned)l)) == NULL)
   {
     return (ST_ENOMEM);
--- a/src/highp.c
+++ b/src/highp.c
@@ -64,7 +64,7 @@
         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)\n");
+                st_fail("Highpass: cutoff must be < sample rate / 2 (Nyquest rate)");
                 return (ST_EOF);
         }
 
--- a/src/ima_rw.c
+++ b/src/ima_rw.c
@@ -83,8 +83,7 @@
         val = (short)(ip[0] + (ip[1]<<8)); /* need cast for sign-extend */
         state = ip[2];
         if (state > ISSTMAX) {
-                st_warn("IMA_ADPCM block ch%d initial-state (%d) out of range\n", ch, state);
-                fflush(stderr);
+                st_warn("IMA_ADPCM block ch%d initial-state (%d) out of range", ch, state);
                 state = 0;
         }
         /* specs say to ignore ip[3] , but write it as 0 */
@@ -247,9 +246,6 @@
 
         }
         d2 /= n; /* be sure it's non-negative */
-        if (sho) {
-                fflush(stderr);
-        }
         *st = state;
         return (int) sqrt(d2);
 }
--- a/src/lowp.c
+++ b/src/lowp.c
@@ -62,7 +62,7 @@
         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)\n");
+                st_fail("Lowpass: cutoff must be < sample rate / 2 (Nyquest rate)");
                 return (ST_EOF);
         }
 
--- a/src/maud.c
+++ b/src/maud.c
@@ -93,7 +93,7 @@
                 
                 /*
                 buf[4] = 0;
-                st_report("chunk %s",buf);
+                st_debug("chunk %s",buf);
                 */
                 
                 if (strncmp(buf,"MHDR",4) == 0) {
@@ -196,7 +196,7 @@
                                 return(ST_EOF);
                         }
                         chunk_buf[chunksize] = '\0';
-                        st_report("%s",chunk_buf);
+                        st_debug("%s",chunk_buf);
                         free(chunk_buf);
                         
                         continue;
--- a/src/mcompand.c
+++ b/src/mcompand.c
@@ -311,7 +311,7 @@
         l->transferIns[i]  = pow(10.0, atof(s)/20.0);
         if (l->transferIns[i] > 1.0)
         {
-          st_fail("dB values are relative to maximum input, and, ipso facto, "
+          st_fail("dB values are relative to maximum input, and, ipso facto, \n"
                "cannot exceed 0");
           return (ST_EOF);
         }
@@ -319,7 +319,7 @@
           --(l->transferPoints);
         if (i > 0 && l->transferIns[i] <= l->transferIns[i-1])
         {
-          st_fail("Transfer function points don't have strictly ascending "
+          st_fail("Transfer function points don't have strictly ascending \n"
                "input amplitude");
           return (ST_EOF);
         }
--- a/src/mp3.c
+++ b/src/mp3.c
@@ -327,7 +327,7 @@
                     continue;
                 else
                 {
-                    st_report("unrecoverable frame level error (%s).\n",
+                    st_report("unrecoverable frame level error (%s).",
                               mad_stream_errorstr(p->Stream));
                     return done;
                 }
--- a/src/noisered.c
+++ b/src/noisered.c
@@ -114,7 +114,7 @@
         fchannels ++;
     }
     if (fchannels != channels) {
-        st_fail("noisered: channel mismatch: %d in input, %d in profile.\n",
+        st_fail("noisered: channel mismatch: %d in input, %d in profile.",
                 channels, fchannels);
         return ST_EOF;
     }
--- a/src/oss.c
+++ b/src/oss.c
@@ -147,7 +147,7 @@
 
     if (tmp != dsp_stereo)
     {
-        st_warn("Sound card appears to only support %d channels.  Overriding format\n", tmp+1);
+        st_warn("Sound card appears to only support %d channels.  Overriding format", tmp+1);
         ft->info.channels = tmp + 1;
     }
 
--- a/src/phaser.c
+++ b/src/phaser.c
@@ -123,32 +123,32 @@
 
         if ( phaser->delay < 0.0 )
         {
-            st_fail("phaser: delay must be positive!\n");
+            st_fail("phaser: delay must be positive!");
             return (ST_EOF);
         }
         if ( phaser->delay > 5.0 )
         {
-            st_fail("phaser: delay must be less than 5.0 msec!\n");
+            st_fail("phaser: delay must be less than 5.0 msec!");
             return (ST_EOF);
         }
         if ( phaser->speed < 0.1 )
         {
-            st_fail("phaser: speed must be more than 0.1 Hz!\n");
+            st_fail("phaser: speed must be more than 0.1 Hz!");
             return (ST_EOF);
         }
         if ( phaser->speed > 2.0 )
         {
-            st_fail("phaser: speed must be less than 2.0 Hz!\n");
+            st_fail("phaser: speed must be less than 2.0 Hz!");
             return (ST_EOF);
         }
         if ( phaser->decay < 0.0 )
         {
-            st_fail("phaser: decay must be positive!\n" );
+            st_fail("phaser: decay must be positive!" );
             return (ST_EOF);
         }
         if ( phaser->decay >= 1.0 )
         {
-            st_fail("phaser: decay must be less that 1.0!\n" );
+            st_fail("phaser: decay must be less that 1.0!" );
             return (ST_EOF);
         }
         /* Be nice and check the hint with warning, if... */
@@ -162,7 +162,7 @@
         if (! (phaser->phaserbuf = 
                 (double *) malloc(sizeof (double) * phaser->maxsamples)))
         {
-                st_fail("phaser: Cannot malloc %d bytes!\n", 
+                st_fail("phaser: Cannot malloc %d bytes!", 
                         sizeof(double) * phaser->maxsamples);
                 return (ST_EOF);
         }
@@ -171,7 +171,7 @@
         if (! (phaser->lookup_tab = 
                 (int *) malloc(sizeof (int) * phaser->length)))
         {
-                st_fail("phaser: Cannot malloc %d bytes!\n", 
+                st_fail("phaser: Cannot malloc %d bytes!", 
                         sizeof(int) * phaser->length);
                 return (ST_EOF);
         }
--- a/src/pitch.c
+++ b/src/pitch.c
@@ -148,8 +148,7 @@
 
 static void debug(pitch_t pitch, char * where)
 {
-  fprintf(stderr, 
-  "%s: ind=%d sz=%ld step=%d o=%d rate=%f ia=%d st=%d fo=%s\n", 
+  st_debug("%s: ind=%d sz=%ld step=%d o=%d rate=%f ia=%d st=%d fo=%s", 
   where, pitch->index, pitch->size, pitch->step, pitch->overlap, 
   pitch->rate, pitch->iacc, pitch->state, fadeoptname(pitch->fadeopt));
 }
--- a/src/polyphas.c
+++ b/src/polyphas.c
@@ -171,11 +171,11 @@
 
   p = primes;
   q = q0;
-  st_report("factors(%d) =",n);
+  st_debug("factors(%d) =",n);
   while (n > 1) {
     while ((pr = *p) && (n % pr)) p++;
     if (!pr) {
-      st_fail("Number %d too large of a prime.\n",n);
+      st_fail("Number %d too large of a prime.",n);
       pr = n;
     }
     *q++ = pr;
@@ -182,8 +182,8 @@
     n /= pr;
   }
   *q = 0;
-  for (pr=0; pr<q-q0; pr++) st_report(" %d",q0[pr]);
-  st_report("\n");
+  for (pr=0; pr<q-q0; pr++) st_debug(" %d",q0[pr]);
+  st_debug("");
   return (q-q0);
 }
 
@@ -221,8 +221,8 @@
   }
   if (n) *p++=n;
   *p = 0;
-  /*for (k=0; k<p-m; k++) st_report(" %d",m[k]);*/
-  /*st_report("\n");*/
+  /*for (k=0; k<p-m; k++) st_debug(" %d",m[k]);*/
+  /*st_debug("");*/
   return (p-m);
 }
 
@@ -253,9 +253,9 @@
       cost = 0;
       f = denom;
       u = min(ct1,ct2) + 1;
-      /*st_report("pfacts(%d): ", numer);*/
+      /*st_debug("pfacts(%d): ", numer);*/
       u1 = permute(m1,l1,ct1,u,amalg);
-      /*st_report("pfacts(%d): ", denom);*/
+      /*st_debug("pfacts(%d): ", denom);*/
       u2 = permute(m2,l2,ct2,u,amalg);
       u = max(u1,u2);
       for (j=0; j<u; j++) {
@@ -269,10 +269,10 @@
         c_min = cost;
         u_min = u;
 #       if 0
-        st_report("c_min %d, [%d-%d]:",c_min,numer,denom);
+        st_debug("c_min %d, [%d-%d]:",c_min,numer,denom);
         for (j=0; j<u; j++)
-          st_report(" (%d,%d)",m1[j],m2[j]);
-        st_report("\n");
+          st_debug(" (%d,%d)",m1[j],m2[j]);
+        st_debug("");
 #       endif
        memcpy(b1,m1,u*sizeof(int));
        memcpy(b2,m2,u*sizeof(int));
@@ -306,7 +306,7 @@
   int N1;
 
   if(buffer == NULL || length <= 0)
-    st_fail("Illegal buffer %p or length %d to nuttall.\n", buffer, length);
+    st_fail("Illegal buffer %p or length %d to nuttall.", buffer, length);
 
   /* Initial variable setups. */
   N = length;
@@ -329,7 +329,7 @@
     int N1;
 
     if(buffer == NULL || length <= 0)
-      st_fail("Illegal buffer %p or length %d to hamming.\n",buffer,length);
+      st_fail("Illegal buffer %p or length %d to hamming.",buffer,length);
 
     N1 = length/2;
     for(j=0;j<length;j++)
@@ -355,7 +355,7 @@
     double sum;
 
     if(buffer == NULL || length < 0 || cutoff < 0 || cutoff > PI)
-      st_fail("Illegal buffer %p, length %d, or cutoff %f.\n",buffer,length,cutoff);
+      st_fail("Illegal buffer %p, length %d, or cutoff %f.",buffer,length,cutoff);
 
     /* Use the user-option of window type */
     if(win_type == 0)
@@ -363,12 +363,12 @@
     else
       hamming(buffer,length);  /* Design Hamming window:  43 dB cutoff */
 
-    /* st_report("# fir_design length=%d, cutoff=%8.4f\n",length,cutoff); */
+    /* st_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(PI*cutoff*(j-length/2)); /* center at length/2 */
-      /* st_report("%.1f %.6f\n",(float)j,buffer[j]); */
+      /* st_debug("%.1f %.6f",(float)j,buffer[j]); */
       sum += buffer[j];
     }
     sum = (double)1.0/sum;
@@ -376,7 +376,7 @@
     for(j=0;j<length;j++) {
       buffer[j] *= sum;
     }
-    /* st_report("# end\n\n"); */
+    /* st_debug("# end"); */
 }
 
 #define RIBLEN 2048
@@ -420,9 +420,9 @@
     rate->total = total;
     /* l1 and l2 are now lists of the up/down factors for conversion */
 
-    st_report("Poly:  input rate %d, output rate %d.  %d stages.",
+    st_debug("Poly:  input rate %d, output rate %d.  %d stages.",
             effp->ininfo.rate, effp->outinfo.rate,total);
-    st_report("Poly:  window: %s  size: %d  cutoff: %f.",
+    st_debug("Poly:  window: %s  size: %d  cutoff: %f.",
             (win_type == 0) ? ("nut") : ("ham"), win_width, cutoff);
 
     /* Create an array of filters and past history */
@@ -442,7 +442,7 @@
       s->size = size;
       s->hsize = f_len/s->up; /* this much of window is past-history */
       s->held = 0;
-      st_report("Poly:  stage %d:  Up by %d, down by %d,  i_samps %d, hsize %d",
+      st_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 = (Float *) malloc(sizeof(Float) * f_len);
@@ -452,7 +452,7 @@
         s->window[j] = 0.0;
 
       uprate *= s->up;
-      st_report("Poly:         :  filt_len %d, cutoff freq %.1f",
+      st_debug("Poly:         :  filt_len %d, cutoff freq %.1f",
               f_len, uprate*cutoff/f_cutoff);
       uprate /= s->down;
       fir_design(s->filt_array, f_len, cutoff/f_cutoff);
@@ -476,7 +476,7 @@
       s->filt_array = NULL;
       s->window = (Float *) malloc(sizeof(Float) * size);
     }
-    st_report("Poly:  output samples %d, oskip %d",size, rate->oskip);
+    st_debug("Poly:  output samples %d, oskip %d",size, rate->oskip);
     return (ST_SUCCESS);
 }
 
@@ -510,10 +510,10 @@
   Float *o_top;
 
   in = s->window + s->hsize;
-  /*for (mm=0; mm<s->filt_len; mm++) st_report("cf_%d %f\n",mm,s->filt_array[mm]);*/
+  /*for (mm=0; mm<s->filt_len; mm++) st_debug("cf_%d %f",mm,s->filt_array[mm]);*/
   /* assumes s->size divisible by down (now true) */
   o_top = output + (s->size * up) / down;
-  /*st_report(" isize %d, osize %d, up %d, down %d, N %d", s->size, o_top-output, up, down, f_len);*/
+  /*st_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;
@@ -542,7 +542,7 @@
   polystage *s0,*s1;
 
   /* Sanity check:  how much can we tolerate? */
-  /* st_report("*isamp=%d *osamp=%d\n",*isamp,*osamp); fflush(stderr); */
+  /* st_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 */
   {
@@ -581,7 +581,7 @@
 
       out = rate->stage[k+1]->window + rate->stage[k+1]->hsize;
 
-      /* st_report("k=%d  insize=%d\n",k,in_size); fflush(stderr); */
+      /* st_debug("k=%d  insize=%d",k,in_size); */
       polyphase(out, s);
 
       /* copy input history into lower portion of rate->window[k] */
--- a/src/prc.c
+++ b/src/prc.c
@@ -86,7 +86,7 @@
         /* Check the header */
         st_readbuf(ft, head,1, sizeof(header));
         if (memcmp(head, header, sizeof(header))==0) {
-                st_report("Found Psion record.app header");
+                st_debug("Found Psion record.app header");
         }
         else
         {
@@ -96,7 +96,7 @@
 
         st_readw(ft, &(len));
         p->length=len;
-        st_report("Found length=%d",len);
+        st_debug("Found length=%d",len);
 
         /* dummy read rest */
         st_readbuf(ft, head,1,14+2+2);
@@ -172,7 +172,7 @@
 {
         prc_t p = (prc_t ) ft->priv;
         p->length += samp * ft->info.size;
-        st_report("length now = %d", p->length);
+        st_debug("length now = %d", p->length);
         return st_rawwrite(ft, buf, samp);
 }
 
@@ -201,7 +201,7 @@
   char nullbuf[15];
   prc_t p = (prc_t ) ft->priv;
 
-  st_report("Final length=%d",p->length);
+  st_debug("Final length=%d",p->length);
   memset(nullbuf,0,14);
   st_writebuf(ft, header, 1, sizeof(header));
   st_writew(ft, p->length);
--- a/src/repeat.c
+++ b/src/repeat.c
@@ -77,7 +77,7 @@
 
         if (fwrite((char *)ibuf, sizeof(st_sample_t), *isamp, repeat->fp) !=
                         *isamp) {
-                st_fail("repeat: write error on temporary file\n");
+                st_fail("repeat: write error on temporary file");
                 return (ST_EOF);
         }
 
@@ -102,7 +102,7 @@
                 repeat->total = ftell(repeat->fp);
 
                 if ((repeat->total % sizeof(st_sample_t)) != 0) {
-                        st_fail("repeat: corrupted temporary file\n");
+                        st_fail("repeat: corrupted temporary file");
                         return (ST_EOF);
                 }
         
@@ -131,7 +131,7 @@
                                 repeat->fp);
                 if (read != samp) {
                         perror(strerror(errno));
-                        st_fail("repeat1: read error on temporary file\n");
+                        st_fail("repeat1: read error on temporary file");
                         return(ST_EOF);
                 }
 
@@ -176,7 +176,7 @@
                                 repeat->fp);
                 if (read != *osamp) {
                         perror(strerror(errno));
-                        st_fail("repeat3: read error on temporary file\n");
+                        st_fail("repeat3: read error on temporary file");
                         return(ST_EOF);
                 }
                 repeat->remaining -= *osamp;
--- a/src/resample.c
+++ b/src/resample.c
@@ -163,9 +163,9 @@
         }
         else if (r->beta <= 2.0) {
           r->beta = 0;
-                st_report("resample opts: Nuttall window, cutoff %f\n", r->rolloff);
+                st_debug("resample opts: Nuttall window, cutoff %f", r->rolloff);
         } else {
-                st_report("resample opts: Kaiser window, cutoff %f, beta %f\n", r->rolloff, r->beta);
+                st_debug("resample opts: Kaiser window, cutoff %f, beta %f", r->rolloff, r->beta);
         }
         return (ST_SUCCESS);
 }
@@ -214,15 +214,15 @@
         i = makeFilter(r->Imp, r->Nwing, r->rolloff, r->beta, r->Nq, 1);
         if (i <= 0)
         {
-                st_fail("resample: Unable to make filter\n");
+                st_fail("resample: Unable to make filter");
                 return (ST_EOF);
         }
 
-        /*st_report("Nmult: %ld, Nwing: %ld, Nq: %ld\n",r->Nmult,r->Nwing,r->Nq);*/
+        /*st_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;
-          st_report("resample: rate ratio %ld:%ld, coeff interpolation not needed\n", r->a, r->b);
+          st_debug("resample: 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;
@@ -252,7 +252,7 @@
         
         r->Xsize = 2*Xoff + i/(1.0+r->Factor);
         r->Ysize = BUFFSIZE - r->Xsize;
-        /* st_report("Xsize %d, Ysize %d, Xoff %d",r->Xsize,r->Ysize,r->Xoff); */
+        /* st_debug("Xsize %d, Ysize %d, Xoff %d",r->Xsize,r->Ysize,r->Xoff); */
 
         r->X = (Float *) malloc(sizeof(Float) * (BUFFSIZE));
         r->Y = r->X + r->Xsize;
@@ -274,7 +274,7 @@
         long i, last, Nout, Nx, Nproc;
 
         /* constrain amount we actually process */
-        /*fprintf(stderr,"Xp %d, Xread %d, isamp %d, ",r->Xp, r->Xread,*isamp);*/
+        /*st_debug("Xp %d, Xread %d, isamp %d, ",r->Xp, r->Xread,*isamp);*/
 
         Nproc = r->Xsize - r->Xp;
 
@@ -290,7 +290,7 @@
         }
         if ((unsigned long)Nx > *isamp)
                 Nx = *isamp;
-        /*fprintf(stderr,"Nx %d\n",Nx);*/
+        st_debug("Nx %d",Nx);
 
         if (ibuf == NULL) {
                 for(i = r->Xread; i < Nx + r->Xread  ; i++) 
@@ -312,7 +312,7 @@
         if (r->quadr < 0) { /* exact coeff's method */
                 long creep; 
                 Nout = SrcEX(r, Nproc);
-                /*fprintf(stderr,"Nproc %d --> %d\n",Nproc,Nout);*/
+                st_debug("Nproc %d --> %d",Nproc,Nout);
                 /* Move converter Nproc samples back in time */
                 r->t -= Nproc * r->b;
                 /* Advance by number of samples processed */
@@ -323,12 +323,12 @@
                 {
                   r->t -= creep * r->b;  /* Remove time accumulation   */
                   r->Xp += creep;        /* and add it to read pointer */
-                  /*fprintf(stderr,"Nproc %ld, creep %ld\n",Nproc,creep);*/
+                  /*st_debug("Nproc %ld, creep %ld",Nproc,creep);*/
                 }
         } else { /* approx coeff's method */
                 long creep; 
                 Nout = SrcUD(r, Nproc);
-                /*fprintf(stderr,"Nproc %d --> %d\n",Nproc,Nout);*/
+                /*st_debug("Nproc %d --> %d",Nproc,Nout);*/
                 /* Move converter Nproc samples back in time */
                 r->Time -= Nproc;
                 /* Advance by number of samples processed */
@@ -339,7 +339,7 @@
                 {
                   r->Time -= creep;   /* Remove time accumulation   */
                   r->Xp += creep;     /* and add it to read pointer */
-                  /* fprintf(stderr,"Nproc %ld, creep %ld\n",Nproc,creep); */
+                  /* st_debug("Nproc %ld, creep %ld",Nproc,creep); */
                 }
         }
 
@@ -347,7 +347,7 @@
         long i,k;
         /* Copy back portion of input signal that must be re-used */
         k = r->Xp - r->Xoff;
-        /*fprintf(stderr,"k %d, last %d\n",k,last);*/
+        /*st_debug("k %d, last %d",k,last);*/
         for (i=0; i<last - k; i++) 
             r->X[i] = r->X[i+k];
 
@@ -380,7 +380,7 @@
         st_sample_t *Obuf;
         int rc;
 
-        /* fprintf(stderr,"Xoff %d  <--- DRAIN\n",r->Xoff); */
+        /* st_debug("Xoff %d  <--- DRAIN",r->Xoff); */
 
         /* stuff end with Xoff zeros */
         isamp_res = r->Xoff;
@@ -393,7 +393,7 @@
                 rc = st_resample_flow(effp, NULL, Obuf, (st_size_t *)&Isamp, (st_size_t *)&Osamp);
                 if (rc)
                     return rc;
-                /* fprintf(stderr,"DRAIN isamp,osamp  (%d,%d) -> (%d,%d)\n",
+                /* st_debug("DRAIN isamp,osamp  (%d,%d) -> (%d,%d)",
                         isamp_res,osamp_res,Isamp,Osamp); */
                 Obuf += Osamp;
                 osamp_res -= Osamp;
@@ -400,9 +400,9 @@
                 isamp_res -= Isamp;
         }
         *osamp -= osamp_res;
-        /* fprintf(stderr,"DRAIN osamp %d\n", *osamp); */
+        /* st_debug("DRAIN osamp %d", *osamp); */
         if (isamp_res)
-                st_warn("drain overran obuf by %d\n", isamp_res); fflush(stderr);
+                st_warn("drain overran obuf by %d", isamp_res);
         /* FIXME: This is very picky.  IF obuf is not big enough to
          * drain remaining samples, they will be lost.
          */
@@ -498,12 +498,12 @@
    Factor = r->Factor;
    time = r->Time;
    dt = 1.0/Factor;        /* Output sampling period */
-   /*fprintf(stderr,"Factor %f, dt %f, ",Factor,dt); */
-   /*fprintf(stderr,"Time %f, ",r->Time);*/
+   /*st_debug("Factor %f, dt %f, ",Factor,dt); */
+   /*st_debug("Time %f, ",r->Time);*/
    /* (Xh * dhb)>>La is max index into Imp[] */
-   /*fprintf(stderr,"ct=%d\n",ct);*/
-   /*fprintf(stderr,"ct=%.2f %d\n",(double)r->Nwing*Na/r->dhb, r->Xh);*/
-   /*fprintf(stderr,"ct=%ld, T=%.6f, dhb=%6f, dt=%.6f\n",
+   /*st_debug("ct=%d",ct);*/
+   /*st_debug("ct=%.2f %d",(double)r->Nwing*Na/r->dhb, r->Xh);*/
+   /*st_debug("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);
@@ -525,7 +525,7 @@
       time += dt;            /* Move to next sample by time increment */
       }
    r->Time = time;
-   /*fprintf(stderr,"Time %f\n",r->Time);*/
+   /*st_debug("Time %f",r->Time);*/
    return (Y - Ystart);        /* Return the number of output samples */
 }
 
@@ -612,7 +612,7 @@
       for (i=Dh; i<Mwing; i+=Dh)
          DCgain += ImpR[i];
       DCgain = 2*DCgain + ImpR[0];    /* DC gain of real coefficients */
-      /*st_report("DCgain err=%.12f",DCgain-1.0);*/
+      /*st_debug("DCgain err=%.12f",DCgain-1.0);*/
   
       DCgain = 1.0/DCgain;
       for (i=0; i<Mwing; i++)
--- a/src/reverb.c
+++ b/src/reverb.c
@@ -173,12 +173,12 @@
                 reverb->samples[i] = reverb->delay[i] * effp->ininfo.rate / 1000.0;
                 if ( reverb->samples[i] < 1 )
                 {
-                    st_fail("reverb: delay must be positive!\n");
+                    st_fail("reverb: delay must be positive!");
                     return (ST_EOF);
                 }
                 if ( reverb->samples[i] > DELAY_BUFSIZ )
                 {
-                        st_fail("reverb: delay must be less than %g seconds!\n",
+                        st_fail("reverb: delay must be less than %g seconds!",
                                 DELAY_BUFSIZ / (float) effp->ininfo.rate );
                         return(ST_EOF);
                 }
@@ -189,7 +189,7 @@
         }
         if (! (reverb->reverbbuf = (float *) malloc(sizeof (float) * reverb->maxsamples)))
         {
-                st_fail("reverb: Cannot malloc %d bytes!\n", 
+                st_fail("reverb: Cannot malloc %d bytes!", 
                         sizeof(float) * reverb->maxsamples);
                 return(ST_EOF);
         }
--- a/src/reverse.c
+++ b/src/reverse.c
@@ -56,7 +56,7 @@
         reverse->fp = tmpfile();
         if (reverse->fp == NULL)
         {
-                st_fail("Reverse effect can't create temporary file\n");
+                st_fail("Reverse effect can't create temporary file");
                 return (ST_EOF);
         }
         reverse->phase = WRITING;
@@ -80,7 +80,7 @@
         if (fwrite((char *)ibuf, sizeof(st_sample_t), *isamp, reverse->fp)
             != *isamp)
         {
-                st_fail("Reverse effect write error on temporary file\n");
+                st_fail("Reverse effect write error on temporary file");
                 return(ST_EOF);
         }
         *osamp = 0;
@@ -104,7 +104,7 @@
                 reverse->pos = ftell(reverse->fp);
                 if (reverse->pos % sizeof(st_sample_t) != 0)
                 {
-                        st_fail("Reverse effect finds odd temporary file\n");
+                        st_fail("Reverse effect finds odd temporary file");
                         return(ST_EOF);
                 }
                 reverse->phase = READING;
@@ -119,7 +119,7 @@
         fseek(reverse->fp, reverse->pos, SEEK_SET);
         if (fread((char *)obuf, sizeof(st_sample_t), len, reverse->fp) != len)
         {
-                st_fail("Reverse effect read error from temporary file\n");
+                st_fail("Reverse effect read error from temporary file");
                 return(ST_EOF);
         }
         for (i = 0, j = len-1; i < j; i++, j--) {
--- a/src/sf.c
+++ b/src/sf.c
@@ -137,7 +137,7 @@
                         samplesize = sizeof(float);
                         break;
                 default:
-                        st_fail("Soundfile input: unknown format 0x%x\n",
+                        st_fail("Soundfile input: unknown format 0x%x",
                                 sf->info.sf_packmode);
                         return(ST_EOF);
         }
--- a/src/smp.c
+++ b/src/smp.c
@@ -233,12 +233,12 @@
         }
         if (strncmp(header.Id, SVmagic, 17) != 0)
         {
-                st_fail_errno(ft,ST_EHDR,"SMP header does not begin with magic word %s\n", SVmagic);
+                st_fail_errno(ft,ST_EHDR,"SMP header does not begin with magic word %s", SVmagic);
                 return(ST_EOF);
         }
         if (strncmp(header.version, SVvers, 4) != 0)
         {
-                st_fail_errno(ft,ST_EHDR,"SMP header is not version %s\n", SVvers);
+                st_fail_errno(ft,ST_EHDR,"SMP header is not version %s", SVvers);
                 return(ST_EOF);
         }
 
@@ -288,7 +288,7 @@
         smp->dataStart = samplestart;
         ft->length = smp->NoOfSamps;
 
-        st_report("SampleVision trailer:\n");
+        st_report("SampleVision trailer:");
         for(i = 0; i < 8; i++) if (1 || trailer.loops[i].count) {
 #ifdef __alpha__
                 st_report("Loop %d: start: %6d", i, trailer.loops[i].start);
@@ -299,12 +299,12 @@
 #endif
                 st_report(" count: %6d", trailer.loops[i].count);
                 switch(trailer.loops[i].type) {
-                    case 0: st_report("type:  off\n"); break;
-                    case 1: st_report("type:  forward\n"); break;
-                    case 2: st_report("type:  forward/backward\n"); break;
+                    case 0: st_report("type:  off"); break;
+                    case 1: st_report("type:  forward"); break;
+                    case 2: st_report("type:  forward/backward"); break;
                 }
         }
-        st_report("MIDI Note number: %d\n\n", trailer.MIDInote);
+        st_report("MIDI Note number: %d", trailer.MIDInote);
 
         ft->instr.nloops = 0;
         for(i = 0; i < 8; i++) 
--- a/src/sndrtool.c
+++ b/src/sndrtool.c
@@ -117,7 +117,7 @@
                 st_fail_errno(ft,ST_EHDR,"SND: unexpected EOF in SND header");
                 return(ST_EOF);
         }
-        st_report("%s",buf);
+        st_debug("%s",buf);
         }
 
         ft->info.channels = 1;
--- a/src/sox.c
+++ b/src/sox.c
@@ -165,6 +165,23 @@
 static struct st_effect user_efftab[MAX_USER_EFF];
 static int nuser_effects;
 
+static int verbosity_level = 2;        /* be noisy on stderr */
+static char * myname = 0;
+
+
+
+static void sox_output_message(int level, st_output_message_t m)
+{
+  if (verbosity_level >= level)
+  {
+    fprintf(stderr, "%s ", myname);
+    st_output_message(stderr, m);
+    fprintf(stderr, "\n");
+  }
+}
+
+
+
 int main(int argc, char **argv)
 {
     file_options_t *fo;
@@ -176,6 +193,8 @@
     if (i >= sizeof("soxmix") - 1)
       soxmix = strcmp(myname + i - (sizeof("soxmix") - 1), "soxmix") == 0;
     
+    st_output_message_handler = sox_output_message;
+
     /* Loop over arguments and filenames, stop when an effect name is 
      * found.
      */
@@ -183,7 +202,7 @@
     {
         if (file_count >= MAX_FILES)
         {
-            st_fail("to many filenames. max of %d input files and 1 output file\n", MAX_INPUT_FILES);
+            st_fail("too many filenames. max of %d input files and 1 output file", MAX_INPUT_FILES);
             exit(1);
         }
 
@@ -295,7 +314,7 @@
     return(0);
 }
 
-static char *getoptstr = "+r:v:t:c:C:phsuUAaig1b2w34lfdxVSqo";
+static char *getoptstr = "+r:v:t:c:C:phsuUAaig1b2w34lfdxV::Sqo";
 
 static struct option long_options[] =
 {
@@ -368,7 +387,7 @@
                 }
                 fo->uservolume = 1;
                 if (fo->volume < 0.0)
-                    st_report("Volume adjustment is negative.  This will result in a phase change\n");
+                    st_report("Volume adjustment is negative.  This will result in a phase change");
                 break;
 
             case 'c':
@@ -452,7 +471,17 @@
                 break;
 
             case 'V':
-                verbose = 1;
+                str = optarg;
+                if (optarg == NULL)
+                {
+                  ++verbosity_level;
+                }
+                else if (sscanf(str, "%i", &verbosity_level) == 0)
+                {
+                  st_fail("argument for -V must be an integer");
+                  cleanup();
+                  exit(1);
+                }
                 break;
 
             case 'S':
@@ -537,7 +566,7 @@
                   (file_desc[f]->info.channels > 1) ? "channels" : "channel");
 
         if (file_desc[f]->comment)
-            st_report("Input file %s: comment \"%s\"\n",
+            st_report("Input file %s: comment \"%s\"",
                       file_desc[f]->filename, file_desc[f]->comment);
     }
 
@@ -621,7 +650,7 @@
                   (file_desc[file_count-1]->info.channels > 1) ? "channels" : "channel");
 
         if (file_desc[file_count-1]->comment)
-            st_report("Output file: comment \"%s\"\n", 
+            st_report("Output file: comment \"%s\"", 
                       file_desc[file_count-1]->comment);
     }
 
@@ -692,7 +721,7 @@
                          (st_ssize_t)ST_BUFSIZ);
           if (ilen[0] > ST_BUFSIZ)
             {
-              st_warn("WARNING: Corrupt value of %d!  Assuming 0 bytes read.\n", ilen);
+              st_warn("WARNING: Corrupt value of %d!  Assuming 0 bytes read.", ilen);
               ilen[0] = 0;
             }
           
@@ -886,7 +915,7 @@
     {
         if (nuser_effects >= MAX_USER_EFF)
         {
-            st_fail("Too many effects specified.\n");
+            st_fail("Too many effects specified.");
             cleanup();
             exit(2);
         }
--- a/src/speed.c
+++ b/src/speed.c
@@ -64,7 +64,7 @@
 /*
 static void debug(char * where, speed_t s)
 {
-    fprintf(stderr, "%s: f=%f r=%f comp=%d i=%d ic=%d frac=%f state=%d v=%f\n",
+    st_debug("%s: f=%f r=%f comp=%d i=%d ic=%d frac=%f state=%d v=%f",
             where, s->factor, s->rate, s->compression, s->index,
             s->icbuf, s->frac, s->state, s->cbuf[0]);
 }
@@ -107,7 +107,7 @@
     if (n && (!sscanf(argv[0], SPEED_FLOAT_SCAN, &speed->factor) ||
               (cent==0 && speed->factor<=ZERO)))
     {
-        printf("n = %d cent = %d speed = %f\n",n,cent,speed->factor);
+        st_debug("n = %d cent = %d speed = %f",n,cent,speed->factor);
         st_fail(st_speed_effect.usage);
         return ST_EOF;
     }
@@ -114,7 +114,7 @@
     else if (cent != 0) /* CONST==2**(1/1200) */
     {
         speed->factor = pow((double)1.00057778950655, speed->factor);
-        /* fprintf(stderr, "Speed factor: %f\n", speed->factor);*/
+        /* st_debug("Speed factor: %f", speed->factor);*/
     }
 
     return ST_SUCCESS;
--- a/src/sphere.c
+++ b/src/sphere.c
@@ -177,7 +177,7 @@
 
         if (!strcmp(sphere->shorten_check,"ajkg"))
         {
-            st_fail_errno(ft,ST_EFMT,"File uses shorten compression, can not handle this.\n");
+            st_fail_errno(ft,ST_EFMT,"File uses shorten compression, can not handle this.");
             free(buf);
             return(ST_EOF);
         }
@@ -268,7 +268,7 @@
 
     if (st_seeki(ft, 0L, 0) != 0)
     {
-        st_fail_errno(ft,errno,"Could not rewird output file to rewrite sphere header.\n");
+        st_fail_errno(ft,errno,"Could not rewird output file to rewrite sphere header.");
         return (ST_EOF);
     }
 
--- a/src/st.h
+++ b/src/st.h
@@ -356,9 +356,7 @@
 ft_t st_initformat(void);
 int st_parsesamples(st_rate_t rate, char *str, st_size_t *samples, char def);
 
-/* FIXME: these declared in util.c, global is inappropriate for lib */
-extern int verbose;     /* be noisy on stderr */
-extern char *myname;
+extern char const * filename;
 
 #define ST_EOF (-1)
 #define ST_SUCCESS (0)
--- a/src/st_i.h
+++ b/src/st_i.h
@@ -102,9 +102,26 @@
 double st_swapd(double d);
 
 /* util.c */
-void st_report(const char *, ...);
-void st_warn(const char *, ...);
+struct st_output_message_s;
+typedef struct st_output_message_s * st_output_message_t;
+typedef void (* st_output_message_handler_t)(int level, st_output_message_t);
+extern st_output_message_handler_t st_output_message_handler;
+void st_output_message(FILE * file, st_output_message_t);
+
 void st_fail(const char *, ...);
+void st_warn(const char *, ...);
+void st_report(const char *, ...);
+void st_debug(const char *, ...);
+void st_debug_more(char const * fmt, ...);
+void st_debug_most(char const * fmt, ...);
+
+#define st_fail       filename=__FILE__,st_fail
+#define st_warn       filename=__FILE__,st_warn
+#define st_report     filename=__FILE__,st_report
+#define st_debug      filename=__FILE__,st_debug
+#define st_debug_more filename=__FILE__,st_debug_more
+#define st_debug_most filename=__FILE__,st_debug_most
+
 void st_fail_errno(ft_t, int, const char *, ...);
 
 int st_is_bigendian(void);
--- a/src/stat.c
+++ b/src/stat.c
@@ -139,7 +139,7 @@
 
             if (bitmask && (stat->fft_size & ~bitmask))
             {
-                st_fail("FFT can only use sample buffers of 2^n. Buffer size used is %ld\n",stat->fft_size);
+                st_fail("FFT can only use sample buffers of 2^n. Buffer size used is %ld",stat->fft_size);
                 return(ST_EOF);
             }
 
@@ -148,7 +148,7 @@
 
             if (!stat->re || !stat->im)
             {
-                st_fail("Unable to allocate memory for FFT buffers.\n");
+                st_fail("Unable to allocate memory for FFT buffers.");
                 return (ST_EOF);
             }
         }
--- a/src/stretch.c
+++ b/src/stretch.c
@@ -86,7 +86,7 @@
 /*
 static void debug(stretch_t s, char * where)
 {
-    fprintf(stderr, 
+    st_debug(
             "%s: (f=%.2f w=%.2f r=%.2f f=%.2f)"
             " st=%d s=%d ii=%d is=%d oi=%d os=%d fs=%d\n",
             where, s->factor, s->window, s->shift, s->fading,
--- a/src/sunaudio.c
+++ b/src/sunaudio.c
@@ -76,7 +76,7 @@
         st_fail_errno(ft,errno,"Unable to get device information.");
         return(ST_EOF);
     }
-    st_report("Hardware detected:  %s\n",audio_dev.name);
+    st_report("Hardware detected:  %s",audio_dev.name);
     if (strcmp("SUNW,am79c30",audio_dev.name) == 0)
     {
         simple_hw = 1;
@@ -210,7 +210,7 @@
         st_fail_errno(ft,errno,"Unable to get device information.");
         return(ST_EOF);
     }
-    st_report("Hardware detected:  %s\n",audio_dev.name);
+    st_report("Hardware detected:  %s",audio_dev.name);
     if (strcmp("SUNW,am79c30",audio_dev.name) == 0)
     {
         simple_hw = 1;
--- a/src/tx16w.c
+++ b/src/tx16w.c
@@ -123,7 +123,7 @@
      */
 
     /* Check to make sure we got a good filetype ID from file */
-    st_report("Found header filetype %s",filetype);
+    st_debug("Found header filetype %s",filetype);
     if(strcmp(filetype,"LM8953"))
     {
         st_fail_errno(ft,ST_EHDR,"Invalid filetype ID in input file header, != LM8953");
@@ -166,11 +166,11 @@
                     break;
             }
             if ( blewIt ) {
-                st_report("Invalid sample rate identifier found %d", (int)sample_rate);
+                st_debug("Invalid sample rate identifier found %d", (int)sample_rate);
                 ft->info.rate = 33333;
             }
     }
-    st_report("Sample rate = %ld",ft->info.rate);
+    st_debug("Sample rate = %ld",ft->info.rate);
 
     ft->info.channels = 1 ; /* not sure about stereo sample data yet ??? */
     ft->info.size = ST_SIZE_WORD; /* this is close enough */
@@ -249,7 +249,7 @@
 {
     struct WaveHeader_ WH;
 
-    st_report("tx16w selected output");
+    st_debug("tx16w selected output");
 
     memset(&WH, 0, sizeof(struct WaveHeader_));
 
@@ -308,7 +308,7 @@
     /* If file header needs fixing up, for example it needs the */
     /* the number of samples in a field, seek back and write them here. */
 
-    st_report("tx16w:output finished");
+    st_debug("tx16w:output finished");
 
     memset(&WH, 0, sizeof(struct WaveHeader_));
     strncpy(WH.filetype,"LM8953",6);
@@ -326,7 +326,7 @@
     else                            WH.sample_rate = 2;
 
     if (tx16w_len >= TXMAXLEN) {
-        st_warn("Sound too large for TX16W. Truncating, Loop Off\n");
+        st_warn("Sound too large for TX16W. Truncating, Loop Off");
         AttackLength       = TXMAXLEN/2;
         LoopLength         = TXMAXLEN/2;
     }
--- a/src/util.c
+++ b/src/util.c
@@ -25,56 +25,109 @@
  * and utility routines for other main programs to use.
  */
 
-/* export flags */
-/* FIXME: To be moved inside of fileop structure per handler. */
-int verbose = 0;        /* be noisy on stderr */
 
-/* FIXME:  These functions are user level concepts.  Move them outside
- * the ST library.
- */
-char *myname = 0;
 
-void st_report(const char *fmt, ...)
+
+struct st_output_message_s
 {
-        va_list args;
+  char const * filename;
+  char const * fmt;
+  va_list      ap;
+};
 
-        if (! verbose)
-                return;
 
-        fprintf(stderr, "%s: ", myname);
-        va_start(args, fmt);
-        vfprintf(stderr, fmt, args);
-        va_end(args);
-        fprintf(stderr, "\n");
-}
 
-void st_warn(const char *fmt, ...)
+st_output_message_handler_t st_output_message_handler = NULL;
+
+
+
+/* This is a bit of a hack.  It's useful to have the ST library
+ * report which driver (i.e. format or effect handler) is outputing
+ * the message.  Using the filename for this purpose is only an
+ * approximation, but it saves a lot of work. ;)
+ */
+char const * filename = 0;
+
+
+
+void st_output_message(FILE * file, st_output_message_t message)
 {
-        va_list args;
+  char buffer[10];
+  char const * drivername;
+  char const * dot_pos;
+ 
+  drivername = strrchr(message->filename, '/');
+  if (drivername != NULL)
+  {
+    ++drivername;
+  }
+  else
+  {
+    drivername = strrchr(message->filename, '\\');
+    if (drivername != NULL)
+    {
+      ++drivername;
+    }
+    else
+    {
+      drivername = message->filename;
+    }
+  }
 
-        fprintf(stderr, "%s: ", myname);
-        va_start(args, fmt);
+  dot_pos = strrchr(drivername, '.');
+  if (dot_pos != NULL && dot_pos - drivername <= sizeof(buffer) - 1)
+  {
+    strncpy(buffer, drivername, dot_pos - drivername);
+    buffer[dot_pos - drivername] = '\0';
+    drivername = buffer;
+  }
 
-        vfprintf(stderr, fmt, args);
-        va_end(args);
-        fprintf(stderr, "\n");
+  fprintf(file, "%s: ", drivername);
+  vfprintf(file, message->fmt, message->ap);
 }
 
-/* Warning: This function is depricated.  st_fail_errno() is
- * the preferred way so that applications can control printing
- * to their choice; not just stderr.
- */
-void st_fail(const char *fmt, ...)
+
+
+static void st_emit_message(int level, char const * fmt, va_list ap)
 {
-        va_list args;
+  if (st_output_message_handler != NULL)
+  {
+    struct st_output_message_s m;
+    m.filename = filename;
+    m.fmt = fmt;
+    m.ap = ap;
+    (*st_output_message_handler)(level, &m);
+  }
+}
 
-        fprintf(stderr, "%s: ", myname);
 
-        va_start(args, fmt);
-        vfprintf(stderr, fmt, args);
-        va_end(args);
-        fprintf(stderr, "\n");
+
+#undef st_fail
+#undef st_warn
+#undef st_report
+#undef st_debug
+#undef st_debug_more
+#undef st_debug_most
+
+#define ST_MESSAGE_FUNCTION(name,level) \
+void name(char const * fmt, ...) \
+{ \
+  va_list args; \
+\
+  va_start(args, fmt); \
+  st_emit_message(level, fmt, args); \
+  va_end(args); \
 }
+
+ST_MESSAGE_FUNCTION(st_fail  , 1)
+ST_MESSAGE_FUNCTION(st_warn  , 2)
+ST_MESSAGE_FUNCTION(st_report, 3)
+ST_MESSAGE_FUNCTION(st_debug , 4)
+ST_MESSAGE_FUNCTION(st_debug_more , 5)
+ST_MESSAGE_FUNCTION(st_debug_most , 6)
+
+#undef ST_MESSAGE_FUNCTION
+
 
 
 /* Warning: no error checking is done with errstr.  Be sure not to
--- a/src/voc.c
+++ b/src/voc.c
@@ -275,15 +275,15 @@
             ft->info.encoding = ST_ENCODING_UNSIGNED;
             break;
         case VOC_FMT_CRLADPCM4:  /*     1    Creative 8-bit to 4-bit ADPCM */
-            st_warn ("Unsupported VOC format CRLADPCM4 %d", v->format);
+            st_fail ("Unsupported VOC format CRLADPCM4 %d", v->format);
             rtn=ST_EOF;
             break;
         case VOC_FMT_CRLADPCM3:  /*     2    Creative 8-bit to 3-bit ADPCM */
-            st_warn ("Unsupported VOC format CRLADPCM3 %d", v->format);
+            st_fail ("Unsupported VOC format CRLADPCM3 %d", v->format);
             rtn=ST_EOF;
             break;
         case VOC_FMT_CRLADPCM2:  /*     3    Creative 8-bit to 2-bit ADPCM */
-            st_warn ("Unsupported VOC format CRLADPCM2 %d", v->format);
+            st_fail ("Unsupported VOC format CRLADPCM2 %d", v->format);
             rtn=ST_EOF;
             break;
         case VOC_FMT_LIN16:      /*     4    16-bit signed PCM */
@@ -296,11 +296,11 @@
             ft->info.encoding = ST_ENCODING_ULAW;
             break;
         case VOC_FMT_CRLADPCM4A: /*0x200    Creative 16-bit to 4-bit ADPCM */
-            printf ("Unsupported VOC format CRLADPCM4A %d", v->format);
+            st_fail ("Unsupported VOC format CRLADPCM4A %d", v->format);
             rtn=ST_EOF;
             break;
         default:
-            printf ("Unknown VOC format %d", v->format);
+            st_fail ("Unknown VOC format %d", v->format);
             rtn=ST_EOF;
             break;
         }
@@ -655,27 +655,37 @@
                         st_readb(ft, &uc);
                         /* Falling! Falling! */
                 case VOC_TEXT:
-                        {
-                            uint32_t i;
-                            /* Could add to comment in SF? */
-                            for(i = 0; i < sblen; i++) {
-                                st_readb(ft, (unsigned char *)&trash);
-                                /* uncomment lines below to display text */
-                                /* Note, if this is uncommented, studio */
-                                /* will not be able to read the VOC file */
-                                /* ANN:  added verbose dump of text info */
-                                /* */
-                                if (verbose) {
-                                    if ((trash != '\0') && (trash != '\r'))
-                                        putc (trash, stderr);
-                                }
-                                /* */
+                        { 
+                          /* TODO: Could add to comment in SF? */
+
+                          /* Note, if this is sent to stderr, studio */
+                          /* will not be able to read the VOC file */
+
+                          uint32_t i = sblen;
+                          char c/*, line_buf[80];
+                          int len = 0*/;
+
+                          while (i--)
+                          {
+                            st_readb(ft, (unsigned char *)&c);
+                            /* FIXME: this needs to be tested but I couldn't
+                             * find a voc file with a VOC_TEXT chunk :(
+                            if (c != '\0' && c != '\r')
+                              line_buf[len++] = c;
+                            if (len && (c == '\0' || c == '\r' ||
+                                i == 0 || len == sizeof(line_buf) - 1))
+                            {
+                              st_report("%s", line_buf);
+                              line_buf[len] = '\0';
+                              len = 0;
                             }
+                            */
+                          }
                         }
                         continue;       /* get next block */
                 case VOC_LOOP:
                 case VOC_LOOPEND:
-                        st_report("File %s: skipping repeat loop");
+                        st_debug("File %s: skipping repeat loop");
                         for(i = 0; i < sblen; i++)
                             st_readb(ft, (unsigned char *)&trash);
                         break;
@@ -720,7 +730,7 @@
                         /* can be grabed.                               */
                         continue;
                 default:
-                        st_report("File %s: skipping unknown block code %d",
+                        st_debug("File %s: skipping unknown block code %d",
                                 ft->filename, block);
                         for(i = 0; i < sblen; i++)
                             st_readb(ft, (unsigned char *)&trash);
--- a/src/vorbis.c
+++ b/src/vorbis.c
@@ -211,7 +211,7 @@
                 if (num_read == 0)
                         return (BUF_EOF);
                 else if (num_read == OV_HOLE)
-                        st_warn("Warning: hole in stream; probably harmless\n");
+                        st_warn("Warning: hole in stream; probably harmless");
                 else if (num_read < 0)
                         return (BUF_ERROR);
                 else
--- a/src/wav.c
+++ b/src/wav.c
@@ -409,7 +409,7 @@
                           Label);
             return ST_EOF;
         }
-        st_report("WAV Chunk %s", magic);
+        st_debug("WAV Chunk %s", magic);
         if (st_readdw(ft, len) == ST_EOF)
         {
             st_fail_errno(ft, ST_EHDR, "WAVE file %s chunk is to short", 
@@ -474,7 +474,7 @@
     /* RIFX is a Big-endian RIFF */
     if (strncmp("RIFX", magic, 4) == 0) 
     {
-        st_report("Found RIFX header, swapping bytes");
+        st_debug("Found RIFX header, swapping bytes");
         ft->swap = ft->swap ? 0 : 1;
     }
 
@@ -728,7 +728,7 @@
 
         st_readw(ft, &(wav->nCoefs));
         if (wav->nCoefs < 7 || wav->nCoefs > 0x100) {
-            st_fail_errno(ft,ST_EOF,"ADPCM file nCoefs (%.4hx) makes no sense\n", wav->nCoefs);
+            st_fail_errno(ft,ST_EOF,"ADPCM file nCoefs (%.4hx) makes no sense", wav->nCoefs);
             return ST_EOF;
         }
         wav->packet = (unsigned char *)malloc(wav->blockAlign);
@@ -766,7 +766,7 @@
                 st_readw(ft, (unsigned short *)&(wav->iCoefs[i]));
                 len -= 2;
                 if (i<14) errct += (wav->iCoefs[i] != iCoef[i/2][i%2]);
-                /* fprintf(stderr,"iCoefs[%2d] %4d\n",i,wav->iCoefs[i]); */
+                /* st_debug("iCoefs[%2d] %4d",i,wav->iCoefs[i]); */
             }
             if (errct) st_warn("base iCoefs differ in %d/14 positions",errct);
         }
@@ -925,7 +925,7 @@
         wav->numSamples = 
             AdpcmSamplesIn(dwDataLength, ft->info.channels, 
                            wav->blockAlign, wav->samplesPerBlock);
-        /*st_report("datalen %d, numSamples %d",dwDataLength, wav->numSamples);*/
+        /*st_debug("datalen %d, numSamples %d",dwDataLength, wav->numSamples);*/
         wav->blockSamplesRemaining = 0;        /* Samples left in buffer */
         ft->length = wav->numSamples*ft->info.channels;
         break;
@@ -936,7 +936,7 @@
         wav->numSamples = 
             ImaSamplesIn(dwDataLength, ft->info.channels, 
                          wav->blockAlign, wav->samplesPerBlock);
-        /*st_report("datalen %d, numSamples %d",dwDataLength, wav->numSamples);*/
+        /*st_debug("datalen %d, numSamples %d",dwDataLength, wav->numSamples);*/
         wav->blockSamplesRemaining = 0;        /* Samples left in buffer */
         initImaTable();
         ft->length = wav->numSamples*ft->info.channels;
@@ -955,10 +955,10 @@
         ft->length = wav->numSamples*ft->info.channels;
     }
 
-    st_report("Reading Wave file: %s format, %d channel%s, %d samp/sec",
+    st_debug("Reading Wave file: %s format, %d channel%s, %d samp/sec",
            wav_format_str(wav->formatTag), ft->info.channels,
            wChannels == 1 ? "" : "s", dwSamplesPerSecond);
-    st_report("        %d byte/sec, %d block align, %d bits/samp, %u data bytes",
+    st_debug("        %d byte/sec, %d block align, %d bits/samp, %u data bytes",
            dwAvgBytesPerSec, wav->blockAlign, wBitsPerSample, dwDataLength);
 
     /* Can also report extended fmt information */
@@ -965,13 +965,13 @@
     switch (wav->formatTag)
     {
         case WAVE_FORMAT_ADPCM:
-            st_report("        %d Extsize, %d Samps/block, %d bytes/block %d Num Coefs, %d Samps/chan",
+            st_debug("        %d Extsize, %d Samps/block, %d bytes/block %d Num Coefs, %d Samps/chan",
                       wExtSize,wav->samplesPerBlock,bytesPerBlock,wav->nCoefs,
                       wav->numSamples);
             break;
 
         case WAVE_FORMAT_IMA_ADPCM:
-            st_report("        %d Extsize, %d Samps/block, %d bytes/block %d Samps/chan",
+            st_debug("        %d Extsize, %d Samps/block, %d bytes/block %d Samps/chan",
                       wExtSize, wav->samplesPerBlock, bytesPerBlock, 
                       wav->numSamples);
             break;
@@ -978,13 +978,13 @@
 
 #ifdef ENABLE_GSM
         case WAVE_FORMAT_GSM610:
-            st_report("GSM .wav: %d Extsize, %d Samps/block, %d Samples/chan",
+            st_debug("GSM .wav: %d Extsize, %d Samps/block, %d Samples/chan",
                       wExtSize, wav->samplesPerBlock, wav->numSamples);
             break;
 #endif
 
         default:
-            st_report("        %d Samps/chans", wav->numSamples);
+            st_debug("        %d Samps/chans", wav->numSamples);
     }
 
     /* Horrible way to find Cool Edit marker points. Taken from Quake source*/
@@ -1015,12 +1015,12 @@
                 if (strncmp(magic, "INFO", 4) == 0)
                 {
                     /*Skip*/
-                    st_report("Type INFO");
+                    st_debug("Type INFO");
                 }
                 else if (strncmp(magic, "adtl", 4) == 0)
                 {
                     /* Skip */
-                    st_report("Type adtl");
+                    st_debug("Type adtl");
                 }
                 else
                 {
@@ -1028,10 +1028,10 @@
                         break;
                     if (strncmp(magic,"ICRD",4) == 0)
                     {
-                        st_report("Chunk ICRD");
+                        st_debug("Chunk ICRD");
                         if (len > 254)
                         {
-                            st_warn("Possible buffer overflow hack attack (ICRD)!\n");
+                            st_warn("Possible buffer overflow hack attack (ICRD)!");
                             break;
                         }
                         st_reads(ft,text,len);
@@ -1047,10 +1047,10 @@
                     } 
                     else if (strncmp(magic,"ISFT",4) == 0)
                     {
-                        st_report("Chunk ISFT");
+                        st_debug("Chunk ISFT");
                         if (len > 254)
                         {
-                            st_warn("Possible buffer overflow hack attack (ISFT)!\n");
+                            st_warn("Possible buffer overflow hack attack (ISFT)!");
                             break;
                         }
                         st_reads(ft,text,len);
@@ -1066,7 +1066,7 @@
                     } 
                     else if (strncmp(magic,"cue ",4) == 0)
                     {
-                        st_report("Chunk cue ");
+                        st_debug("Chunk cue ");
                         st_seeki(ft,len-4,SEEK_CUR);
                         st_readdw(ft,&dwLoopPos);
                         ft->loops[0].start = dwLoopPos;
@@ -1073,7 +1073,7 @@
                     } 
                     else if (strncmp(magic,"ltxt",4) == 0)
                     {
-                        st_report("Chunk ltxt");
+                        st_debug("Chunk ltxt");
                         st_readdw(ft,&dwLoopPos);
                         ft->loops[0].length = dwLoopPos - ft->loops[0].start;
                         if (len > 4)
@@ -1081,7 +1081,7 @@
                     } 
                     else 
                     {
-                        st_report("Attempting to seek beyond unsupported chunk '%c%c%c%c' of length %d bytes\n", magic[0], magic[1], magic[2], magic[3], len);
+                        st_debug("Attempting to seek beyond unsupported chunk '%c%c%c%c' of length %d bytes", magic[0], magic[1], magic[2], magic[3], len);
                         len = (len + 1) & ~1;
                         st_seeki(ft, len, SEEK_CUR);
                     }
@@ -1493,7 +1493,7 @@
         case ST_ENCODING_IMA_ADPCM:
             if (wChannels>16)
             {
-                st_fail_errno(ft,ST_EOF,"Channels(%d) must be <= 16\n",wChannels);
+                st_fail_errno(ft,ST_EOF,"Channels(%d) must be <= 16",wChannels);
                 return ST_EOF;
             }
             wFormatTag = WAVE_FORMAT_IMA_ADPCM;
@@ -1505,7 +1505,7 @@
         case ST_ENCODING_ADPCM:
             if (wChannels>16)
             {
-                st_fail_errno(ft,ST_EOF,"Channels(%d) must be <= 16\n",wChannels);
+                st_fail_errno(ft,ST_EOF,"Channels(%d) must be <= 16",wChannels);
                 return ST_EOF;
             }
             wFormatTag = WAVE_FORMAT_ADPCM;
@@ -1518,7 +1518,7 @@
 #ifdef ENABLE_GSM
             if (wChannels!=1)
             {
-                st_report("Overriding GSM audio from %d channel to 1\n",wChannels);
+                st_report("Overriding GSM audio from %d channel to 1",wChannels);
                 wChannels = ft->info.channels = 1;
             }
             wFormatTag = WAVE_FORMAT_GSM610;
@@ -1657,17 +1657,17 @@
     st_writedw(ft, dwDataLength);               /* data chunk size */
 
     if (!second_header) {
-        st_report("Writing Wave file: %s format, %d channel%s, %d samp/sec",
+        st_debug("Writing Wave file: %s format, %d channel%s, %d samp/sec",
                 wav_format_str(wFormatTag), wChannels,
                 wChannels == 1 ? "" : "s", dwSamplesPerSecond);
-        st_report("        %d byte/sec, %d block align, %d bits/samp",
+        st_debug("        %d byte/sec, %d block align, %d bits/samp",
                 dwAvgBytesPerSec, wBlockAlign, wBitsPerSample);
     } else {
-        st_report("Finished writing Wave file, %u data bytes %u samples\n",
+        st_debug("Finished writing Wave file, %u data bytes %u samples",
                 dwDataLength,wav->numSamples);
 #ifdef ENABLE_GSM
         if (wFormatTag == WAVE_FORMAT_GSM610){
-            st_report("GSM6.10 format: %u blocks %u padded samples %u padded data bytes\n",
+            st_debug("GSM6.10 format: %u blocks %u padded samples %u padded data bytes",
                     blocksWritten, dwSamplesWritten, dwDataLength);
             if (wav->gsmbytecount != dwDataLength)
                 st_warn("help ! internal inconsistency - data_written %u gsmbytecount %u",
--- a/src/wve.c
+++ b/src/wve.c
@@ -72,7 +72,7 @@
         /* Check the magic word (null-terminated) */
         st_reads(ft, magic, 16);
         if (strncmp(magic, PSION_MAGIC, 15)==0) {
-                st_report("Found Psion magic word");
+                st_debug("Found Psion magic word");
         }
         else
         {
@@ -90,11 +90,11 @@
                  * it doesn't hurt.
                  */
                 ft->swap = ft->swap ? 0 : 1;
-                st_report("Found inverted PSION magic word.  Swapping bytes.");
+                st_debug("Found inverted PSION magic word.  Swapping bytes.");
         }
         else if (version == PSION_VERSION)
         {
-            st_report("Found PSION magic word");
+            st_debug("Found PSION magic word");
         }
         else
         {
--- a/src/xa.c
+++ b/src/xa.c
@@ -117,20 +117,20 @@
     if (st_readw(ft, &xa->header.bits) != ST_SUCCESS) return ST_EOF;
 
     /* Output the data from the header */
-    st_report("XA Header:");
-    st_report(" szID:          %02x %02x %02x %02x  |%c%c%c%c|",
+    st_debug("XA Header:");
+    st_debug(" szID:          %02x %02x %02x %02x  |%c%c%c%c|",
         magic[0], magic[1], magic[2], magic[3],
         (magic[0] >= 0x20 && magic[0] <= 0x7e) ? magic[0] : '.',
         (magic[1] >= 0x20 && magic[1] <= 0x7e) ? magic[1] : '.',
         (magic[2] >= 0x20 && magic[2] <= 0x7e) ? magic[2] : '.',
         (magic[3] >= 0x20 && magic[3] <= 0x7e) ? magic[3] : '.');
-    st_report(" dwOutSize:     %u", xa->header.outSize);
-    st_report(" wTag:          0x%04x", xa->header.tag);
-    st_report(" wChannels:     %u", xa->header.channels);
-    st_report(" dwSampleRate:  %u", xa->header.sampleRate);
-    st_report(" dwAvgByteRate: %u", xa->header.avgByteRate);
-    st_report(" wAlign:        %u", xa->header.align);
-    st_report(" wBits:         %u", xa->header.bits);
+    st_debug(" dwOutSize:     %u", xa->header.outSize);
+    st_debug(" wTag:          0x%04x", xa->header.tag);
+    st_debug(" wChannels:     %u", xa->header.channels);
+    st_debug(" dwSampleRate:  %u", xa->header.sampleRate);
+    st_debug(" dwAvgByteRate: %u", xa->header.avgByteRate);
+    st_debug(" wAlign:        %u", xa->header.align);
+    st_debug(" wBits:         %u", xa->header.bits);
 
     /* Populate the st_soundstream structure */
     ft->info.encoding = ST_ENCODING_SIGN2;