   cas2wav - convert Dragon/CoCo .cas file to WAV.
   Ciaran Anscomb, 2013.  Public Domain.

   v0.5a: converted to C, fixed Perl ancestry typo
   v0.6: support different sample rates, 8- or 16-bit sample sizes, 1 or 2
         channels, sine or approximated square wave.

   C99 required - you might need -std=c99 when compiling with gcc.
   Maths functions used: link with -lm.

   Set sample rate with -r, sample size with -b, channel count with -c.

   If sample rate is less than 11025Hz, exactly 1200Hz and 2400Hz cycles are
   output, otherwise cycles are closer to what a Dragon would actually write.

   Pure sine waves are the default, so -s is a no-op.

   -q doesn't generate pure square wave data, but instead adds harmonics to the
   fundamental up to nyquist (sample rate / 2).  This seems to make it more
   resilient during subsequent sample rate conversions.

   The harmonic limit can be modified with -t.  Simulate your naff old tapes
   with -t 12000!  Just need a noise option now...
