shithub: soundpipe

Download patch

ref: 50243ce8b8f884879d506c0900da0591ce4b4603
parent: d8ddc90c497260a1f22cfbbc72c58ba1434eb366
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Mon May 24 11:27:38 EDT 2021

compile stuff

--- a/h/base.h
+++ b/h/base.h
@@ -8,7 +8,7 @@
 #define SP_OK 1
 #define SP_NOT_OK 0
 
-#define SP_RANDMAX 2147483648
+#define SP_RANDMAX 2147483648U
 
 typedef unsigned long sp_frame;
 
--- a/lib/dr_wav/dr_wav.h
+++ b/lib/dr_wav/dr_wav.h
@@ -762,7 +762,7 @@
 
 
 
-static DRWAV_INLINE int drwav__is_little_endian()
+static DRWAV_INLINE int drwav__is_little_endian(void)
 {
     int n = 1;
     return (*(char*)&n) == 1;
@@ -865,7 +865,7 @@
 
         pHeaderOut->sizeInBytes = drwav__bytes_to_u64(sizeInBytes) - 24;    // <-- Subtract 24 because w64 includes the size of the header.
         pHeaderOut->paddingSize = (unsigned int)(pHeaderOut->sizeInBytes % 8);
-        pRunningBytesReadOut += 24;
+        *pRunningBytesReadOut += 24;
     }
 
     return DRWAV_TRUE;
@@ -1625,7 +1625,7 @@
     //   - Set the size of the "data" chunk.
     if (pWav->onWrite != NULL) {
         // Padding. Do not adjust pWav->dataChunkDataSize - this should not include the padding.
-        drwav_uint32 paddingSize = 0;
+        drwav_uint32 paddingSize;
         if (pWav->container == drwav_container_riff) {
             paddingSize = (drwav_uint32)(pWav->dataChunkDataSize % 2);
         } else {
@@ -2294,7 +2294,7 @@
                 pWav->ima.cachedSampleCount = 8 * pWav->channels;
                 for (iChannel = 0; iChannel < pWav->channels; ++iChannel) {
                     drwav_uint8 nibbles[4];
-                    if (pWav->onRead(pWav->pUserData, &nibbles, 4) != 4) {
+                    if (pWav->onRead(pWav->pUserData, nibbles, 4) != 4) {
                         return totalSamplesRead;
                     }
                     pWav->ima.bytesRemainingInBlock -= 4;
@@ -2474,6 +2474,7 @@
 
 void drwav_f32_to_s16(drwav_int16* pOut, const float* pIn, size_t sampleCount)
 {
+    USED(pOut, pIn, sampleCount);
 /*
     int r;
     for (size_t i = 0; i < sampleCount; ++i) {
@@ -2492,6 +2493,7 @@
 
 void drwav_f64_to_s16(drwav_int16* pOut, const double* pIn, size_t sampleCount)
 {
+    USED(pOut, pIn, sampleCount);
 /*
     int r;
     for (size_t i = 0; i < sampleCount; ++i) {
--- /dev/null
+++ b/lib/dr_wav/mkfile
@@ -1,0 +1,13 @@
+<../../mkfile.common
+
+LIB=libdr_wav.a$O
+CFLAGS=$CFLAGS -I../../h
+
+HFILES=\
+	dr_wav.h\
+	sp_dr_wav.h\
+
+OFILES=\
+	dr_wav.$O\
+
+</sys/src/cmd/mklib
--- /dev/null
+++ b/lib/inih/mkfile
@@ -1,0 +1,11 @@
+<../../mkfile.common
+
+LIB=libinih.a$O
+
+HFILES=\
+	ini.h\
+
+OFILES=\
+	ini.$O\
+
+</sys/src/cmd/mklib
--- /dev/null
+++ b/lib/kissfft/mkfile
@@ -1,0 +1,14 @@
+<../../mkfile.common
+
+LIB=libkissfft.a$O
+
+HFILES=\
+	_kiss_fft_guts.h\
+	kiss_fft.h\
+	kiss_fftr.h\
+
+OFILES=\
+	kiss_fft.$O\
+	kiss_fftr.$O\
+
+</sys/src/cmd/mklib
--- /dev/null
+++ b/lib/openlpc/mkfile
@@ -1,0 +1,12 @@
+<../../mkfile.common
+
+LIB=libopenlpc.a$O
+CFLAGS=$CFLAGS -I../../h
+
+HFILES=\
+	openlpc.h\
+
+OFILES=\
+	openlpc.$O\
+
+</sys/src/cmd/mklib
--- a/lib/openlpc/openlpc.c
+++ b/lib/openlpc/openlpc.c
@@ -91,7 +91,9 @@
 
 #include "soundpipe.h"
 #include "openlpc.h"
+#ifndef __plan9__
 #include "ftol.h"
+#endif
 
 #define PREEMPH
 
@@ -128,8 +130,8 @@
 #define MINPIT		40.0	/* Minimum pitch (observed: 74) */
 #define MAXPIT		320.0	/* Maximum pitch (observed: 250) */
 
-#define MINPER		(int)(FS/(DOWN*MAXPIT)+.5)	/* Minimum period  */
-#define MAXPER		(int)(FS/(DOWN*MINPIT)+.5)	/* Maximum period  */
+#define MINPER		7 //(int)(FS/(DOWN*MAXPIT)+.5)	/* Minimum period  */
+#define MAXPER		55 //(int)(FS/(DOWN*MINPIT)+.5)	/* Maximum period  */
 
 #define REAL_MINPER	 (DOWN*MINPER) /* converted to samples units */
 
@@ -211,8 +213,9 @@
 static void calc_pitch(float *w, int len, float *per)
 {
     int i, j, rpos;
-    float d[MAXWINDOW/DOWN], r[MAXPER+1], rmax;
-    float rval, rm, rp;
+    float d[MAXWINDOW/DOWN];
+    float r[MAXPER+1];
+    float rval, rm, rp, rmax;
     float x, y;
     float vthresh;
 
@@ -226,12 +229,7 @@
     x = 1;
     rpos = 0;
     rmax = 0.0;
-    y = 0;
-    rm = 0;
-    rp = 0;
 
-    vthresh = 0.;
-
     for (i = 1; i < MAXPER; i++) {
         rm = r[i-1];
         rp = r[i+1];
@@ -330,11 +328,7 @@
 
 void destroy_openlpc_encoder_state(openlpc_encoder_state *st)
 {
-    if(st != NULL)
-    {
-        free(st);
-        st = NULL;
-    }
+    free(st);
 }
 
 /* LPC Analysis (compression) */
@@ -743,11 +737,7 @@
 
 void destroy_openlpc_decoder_state(openlpc_decoder_state *st)
 {
-    if(st != NULL)
-    {
-        free(st);
-        st = NULL;
-    }
+    free(st);
 }
 
 void openlpc_sr(float sr)
--- /dev/null
+++ b/lib/spa/mkfile
@@ -1,0 +1,12 @@
+<../../mkfile.common
+
+LIB=libspa.a$O
+CFLAGS=$CFLAGS -I../../h
+
+HFILES=\
+	spa.h\
+
+OFILES=\
+	spa.$O\
+
+</sys/src/cmd/mklib
--- a/lib/spa/spa.c
+++ b/lib/spa/spa.c
@@ -35,6 +35,8 @@
 
 size_t spa_write_buf(sp_data *sp, sp_audio *spa, SPFLOAT *buf, uint32_t size)
 {
+	USED(sp);
+
     if(spa->mode != SPA_WRITE) {
         return 0;
     }
@@ -43,6 +45,8 @@
 
 size_t spa_read_buf(sp_data *sp, sp_audio *spa, SPFLOAT *buf, uint32_t size)
 {
+	USED(sp);
+
     if(spa->mode != SPA_READ) {
         return 0;
     }
--- /dev/null
+++ b/mkfile
@@ -1,0 +1,36 @@
+<mkfile.common
+
+HEADER=h/soundpipe.h
+PWD=`{pwd}
+
+CLEANFILES=$HEADER
+
+DIRS=modules lib/dr_wav lib/inih lib/kissfft lib/openlpc lib/spa
+
+default:V: all
+
+all:VQ: $HEADER
+	for(d in $DIRS){ cd $d && mk; cd $PWD }
+
+clean:VQ:
+	rm -f $HEADER
+	for(d in $DIRS){ cd $d && mk clean; cd $PWD }
+
+$HEADER: $HFILES
+	{
+		echo '#ifndef _soundpipe_h_'
+		echo '#define _soundpipe_h_'
+		echo
+		echo '#pragma lib' "^$PWD^/modules/libspmodules.a^$O^"
+		echo '#pragma lib' "^$PWD^/lib/dr_wav/libdr_wav.a^$O^"
+		echo '#pragma lib' "^$PWD^/lib/inih/libinih.a^$O^"
+		echo '#pragma lib' "^$PWD^/lib/kissfft/libkissfft.a^$O^"
+		echo '#pragma lib' "^$PWD^/lib/openlpc/libopenlpc.a^$O^"
+		echo '#pragma lib' "^$PWD^/lib/spa/libspa.a^$O^"
+		echo
+		for(f in $HFILES){
+			echo '#include' "^`{basename $f}^"
+		}
+		echo
+		echo '#endif'
+	} >$target
--- /dev/null
+++ b/mkfile.common
@@ -1,0 +1,99 @@
+</$objtype/mkfile
+
+CFLAGS=$CFLAGS -p -I/sys/include/npe -I.. -I../h -I../lib/faust -I../lib/kissfft -I../lib/openlpc -I../lib/inih -D__plan9__ -DNO_LIBSNDFILE
+
+HFILES=\
+	h/base.h\
+	h/ftbl.h\
+	h/spa.h\
+	\
+	h/adsr.h\
+	h/autowah.h\
+	h/bigverb.h\
+	h/biscale.h\
+	h/bitcrush.h\
+	h/blsaw.h\
+	h/blsquare.h\
+	h/bltriangle.h\
+	h/brown.h\
+	h/butbp.h\
+	h/butbr.h\
+	h/buthp.h\
+	h/butlp.h\
+	h/clamp.h\
+	h/clock.h\
+	h/compressor.h\
+	h/count.h\
+	h/crossfade.h\
+	h/dcblocker.h\
+	h/delay.h\
+	h/diode.h\
+	h/dmetro.h\
+	h/dtrig.h\
+	h/expon.h\
+	h/fftwrapper.h\
+	h/fmpair.h\
+	h/foo.h\
+	h/in.h\
+	h/incr.h\
+	h/jack.h\
+	h/jcrev.h\
+	h/line.h\
+	h/loadwav.h\
+	h/lpc.h\
+	h/maygate.h\
+	h/metro.h\
+	h/modalres.h\
+	h/noise.h\
+	h/nsmp.h\
+	h/osc.h\
+	h/oscmorph.h\
+	h/padsynth.h\
+	h/paulstretch.h\
+	h/peakeq.h\
+	h/peaklim.h\
+	h/phaser.h\
+	h/phasewarp.h\
+	h/phasor.h\
+	h/pinknoise.h\
+	h/prop.h\
+	h/pshift.h\
+	h/randh.h\
+	h/randmt.h\
+	h/random.h\
+	h/reverse.h\
+	h/rline.h\
+	h/rpi.h\
+	h/rpt.h\
+	h/samphold.h\
+	h/saturator.h\
+	h/scale.h\
+	h/scrambler.h\
+	h/sdelay.h\
+	h/slice.h\
+	h/smoothdelay.h\
+	h/smoother.h\
+	h/sparec.h\
+	h/switch.h\
+	h/tadsr.h\
+	h/talkbox.h\
+	h/tblrec.h\
+	h/tdiv.h\
+	h/tenv.h\
+	h/tenv2.h\
+	h/tenvx.h\
+	h/tgate.h\
+	h/thresh.h\
+	h/timer.h\
+	h/tin.h\
+	h/trand.h\
+	h/tread.h\
+	h/tseg.h\
+	h/tseq.h\
+	h/vardelay.h\
+	h/verbity.h\
+	h/voc.h\
+	h/wavin.h\
+	h/wavout.h\
+	h/wpkorg35.h\
+	h/zitarev.h\
--- a/modules/adsr.c
+++ b/modules/adsr.c
@@ -37,11 +37,15 @@
 
 static SPFLOAT tau2pole(sp_data *sp, sp_adsr *p, SPFLOAT tau)
 {
+    USED(p);
+
     return exp(-1.0 / (tau * sp->sr));
 }
 
 static SPFLOAT adsr_filter(sp_data *sp, sp_adsr *p)
 {
+    USED(sp);
+
     p->y = p->b * p->x  + p->a * p->y;
     return p->y;
 }
--- a/modules/autowah.c
+++ b/modules/autowah.c
@@ -37,7 +37,7 @@
 
 } autowah;
 
-autowah* newautowah() {
+autowah* newautowah(void) {
 	autowah* dsp = (autowah*)malloc(sizeof(autowah));
 	return dsp;
 }
@@ -163,6 +163,8 @@
 
 static void addVerticalSlider(void* ui_interface, const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step)
 {
+    USED(label, init, min, max, step);
+
     sp_autowah *p = ui_interface;
     p->args[p->argpos] = zone;
     p->argpos++;
@@ -203,6 +205,8 @@
 
 int sp_autowah_compute(sp_data *sp, sp_autowah *p, SPFLOAT *in, SPFLOAT *out)
 {
+    USED(sp);
+
     autowah *dsp = p->faust;
     SPFLOAT *faust_out[] = {out};
     SPFLOAT *faust_in[] = {in};
--- a/modules/bigverb.c
+++ b/modules/bigverb.c
@@ -37,6 +37,8 @@
                        SPFLOAT *out1,
                        SPFLOAT *out2)
 {
+    USED(sp);
+
     sk_bigverb_size(p->bv, p->feedback);
     sk_bigverb_cutoff(p->bv, p->lpfreq);
     sk_bigverb_tick(p->bv, *in1, *in2, out1, out2);
--- a/modules/biscale.c
+++ b/modules/biscale.c
@@ -18,6 +18,8 @@
 
 int sp_biscale_init(sp_data *sp, sp_biscale *p)
 {
+    USED(sp);
+
     p->min = 0;
     p->max = 1;
     return SP_OK;
@@ -25,6 +27,8 @@
 
 int sp_biscale_compute(sp_data *sp, sp_biscale *p, SPFLOAT *in, SPFLOAT *out)
 {
+    USED(sp);
+
     *out = sk_biscale(*in, p->min, p->max);
     return SP_OK;
 }
--- a/modules/bitcrush.c
+++ b/modules/bitcrush.c
@@ -18,6 +18,8 @@
 
 int sp_bitcrush_init(sp_data *sp, sp_bitcrush *p)
 {
+    USED(sp);
+
     p->bitdepth = 8;
     p->srate = 10000;
 
--- a/modules/blsaw.c
+++ b/modules/blsaw.c
@@ -36,7 +36,7 @@
 	float fConst2;
 } blsaw;
 
-blsaw* newblsaw() {
+blsaw* newblsaw(void) {
 	blsaw* dsp = (blsaw*)malloc(sizeof(blsaw));
 	return dsp;
 }
@@ -92,6 +92,8 @@
 }
 
 void computeblsaw(blsaw* dsp, int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) {
+    USED(inputs);
+
 	FAUSTFLOAT* output0 = outputs[0];
 	float fSlow0 = (float)dsp->fHslider1;
 	float fSlow1 = ((float)dsp->iConst0 * ((float)dsp->fHslider0 / fSlow0));
@@ -119,6 +121,8 @@
 
 static void addHorizontalSlider(void* ui_interface, const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step)
 {
+    USED(label, init, min, max, step);
+
     sp_blsaw *p = ui_interface;
     p->args[p->argpos] = zone;
     p->argpos++;
@@ -159,6 +163,7 @@
 
 int sp_blsaw_compute(sp_data *sp, sp_blsaw *p, SPFLOAT *in, SPFLOAT *out)
 {
+    USED(sp);
 
     blsaw *dsp = p->ud;
     SPFLOAT out1 = 0;
--- a/modules/blsquare.c
+++ b/modules/blsquare.c
@@ -10,7 +10,6 @@
 #define FAUSTFLOAT float
 #endif
 
-float fmodf(float dummy0, float dummy1);
 static float faustpower2_f(float value) {
 	return (value * value);
 }
@@ -30,7 +29,7 @@
 	int IOTA;
 } blsquare;
 
-blsquare* newblsquare() {
+blsquare* newblsquare(void) {
 	blsquare* dsp = (blsquare*)malloc(sizeof(blsquare));
 	return dsp;
 }
@@ -99,6 +98,8 @@
 }
 
 void computeblsquare(blsquare* dsp, int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) {
+    USED(inputs);
+
 	FAUSTFLOAT* output0 = outputs[0];
 	float fSlow0 = (float)dsp->fHslider0;
 	float fSlow1 = max((float)dsp->fHslider2, 23.4489f);
@@ -133,6 +134,8 @@
 
 static void addHorizontalSlider(void* ui_interface, const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step)
 {
+    USED(label, init, min, max, step);
+
     sp_blsquare *p = ui_interface;
     p->args[p->argpos] = zone;
     p->argpos++;
@@ -173,6 +176,7 @@
 
 int sp_blsquare_compute(sp_data *sp, sp_blsquare *p, SPFLOAT *in, SPFLOAT *out)
 {
+    USED(sp);
 
     blsquare *dsp = p->ud;
     SPFLOAT out1 = 0;
--- a/modules/bltriangle.c
+++ b/modules/bltriangle.c
@@ -10,7 +10,6 @@
 #define FAUSTFLOAT float
 #endif
 
-float fmodf(float dummy0, float dummy1);
 static float faustpower2_f(float value) {
 	return (value * value);
 
@@ -36,7 +35,7 @@
 
 } bltriangle;
 
-bltriangle* newbltriangle() {
+bltriangle* newbltriangle(void) {
 	bltriangle* dsp = (bltriangle*)malloc(sizeof(bltriangle));
 	return dsp;
 }
@@ -114,6 +113,8 @@
 }
 
 void computebltriangle(bltriangle* dsp, int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) {
+    USED(inputs);
+
 	FAUSTFLOAT* output0 = outputs[0];
 	float fSlow0 = (float)dsp->fHslider0;
 	float fSlow1 = (dsp->fConst1 * (fSlow0 * (float)dsp->fHslider1));
@@ -151,6 +152,8 @@
 
 static void addHorizontalSlider(void* ui_interface, const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step)
 {
+    USED(label, init, min, max, step);
+
     sp_bltriangle *p = ui_interface;
     p->args[p->argpos] = zone;
     p->argpos++;
@@ -190,6 +193,7 @@
 
 int sp_bltriangle_compute(sp_data *sp, sp_bltriangle *p, SPFLOAT *in, SPFLOAT *out)
 {
+    USED(sp);
 
     bltriangle *dsp = p->ud;
     SPFLOAT out1 = 0;
--- a/modules/brown.c
+++ b/modules/brown.c
@@ -24,6 +24,8 @@
 
 int sp_brown_init(sp_data *sp, sp_brown *p)
 {
+    USED(sp);
+
     p->brown = 0.0;
     return SP_OK;
 }
@@ -30,6 +32,8 @@
 
 int sp_brown_compute(sp_data *sp, sp_brown *p, SPFLOAT *in, SPFLOAT *out)
 {
+    USED(in);
+
     SPFLOAT r;
     while (1) {
         r = (sp_rand(sp) % SP_RANDMAX) / (SPFLOAT)(SP_RANDMAX);
--- a/modules/butbp.c
+++ b/modules/butbp.c
@@ -47,6 +47,8 @@
 
 int sp_butbp_compute(sp_data *sp, sp_butbp *p, SPFLOAT *in, SPFLOAT *out)
 {
+    USED(sp);
+
     SPFLOAT *a;
     SPFLOAT t, y;
     SPFLOAT bw, fr;
--- a/modules/butbr.c
+++ b/modules/butbr.c
@@ -44,6 +44,8 @@
 
 int sp_butbr_compute(sp_data *sp, sp_butbr *p, SPFLOAT *in, SPFLOAT *out)
 {
+    USED(sp);
+
     SPFLOAT *a;
     SPFLOAT t, y;
     SPFLOAT bw, freq;
--- a/modules/buthp.c
+++ b/modules/buthp.c
@@ -58,6 +58,8 @@
 
 int sp_buthp_compute(sp_data *sp, sp_buthp *p, SPFLOAT *in, SPFLOAT *out)
 {
+    USED(sp);
+
     if (p->freq <= 0.0) {
         *out = 0;
         return SP_OK;
--- a/modules/butlp.c
+++ b/modules/butlp.c
@@ -56,6 +56,8 @@
 
 int sp_butlp_compute(sp_data *sp, sp_butlp *p, SPFLOAT *in, SPFLOAT *out)
 {
+    USED(sp);
+
     if (p->freq <= 0.0) {
         *out = 0;
         return SP_NOT_OK;
--- a/modules/clamp.c
+++ b/modules/clamp.c
@@ -17,6 +17,8 @@
 
 int sp_clamp_init(sp_data *sp, sp_clamp *p)
 {
+    USED(sp);
+
     p->min = 0;
     p->max = 1;
     return SP_OK;
@@ -24,6 +26,8 @@
 
 int sp_clamp_compute(sp_data *sp, sp_clamp *p, SPFLOAT *in, SPFLOAT *out)
 {
+    USED(sp);
+
     if (*in < p->min) *out = p->min;
     else if (*in > p->max) *out = p->max;
     else *out = *in;
--- a/modules/clock.c
+++ b/modules/clock.c
@@ -17,6 +17,8 @@
 
 int sp_clock_init(sp_data *sp, sp_clock *p)
 {
+    USED(sp);
+
     p->subdiv = 1.0;
     p->bpm = 120;
     p->counter = 0;
--- a/modules/compressor.c
+++ b/modules/compressor.c
@@ -25,7 +25,7 @@
 	FAUSTFLOAT fHslider3;
 } compressor;
 
-static compressor* newcompressor() {
+static compressor* newcompressor(void) {
 	compressor* dsp = (compressor*)malloc(sizeof(compressor));
 	return dsp;
 }
@@ -116,6 +116,8 @@
 
 static void addHorizontalSlider(void* ui_interface, const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step)
 {
+    USED(label, init, min, max, step);
+
     sp_compressor *p = ui_interface;
     p->args[p->argpos] = zone;
     p->argpos++;
@@ -158,6 +160,7 @@
 
 int sp_compressor_compute(sp_data *sp, sp_compressor *p, SPFLOAT *in, SPFLOAT *out)
 {
+    USED(sp);
 
     compressor *dsp = p->faust;
     SPFLOAT *faust_out[] = {out};
--- a/modules/count.c
+++ b/modules/count.c
@@ -17,6 +17,8 @@
 
 int sp_count_init(sp_data *sp, sp_count *p)
 {
+    USED(sp);
+
     p->count = 4;
     p->curcount = -1;
     p->mode = 0;
@@ -25,6 +27,8 @@
 
 int sp_count_compute(sp_data *sp, sp_count *p, SPFLOAT *in, SPFLOAT *out)
 {
+    USED(sp);
+
     if (*in){
         if (p->mode == 0) {
             p->curcount = (p->curcount + 1) % p->count;
--- a/modules/crossfade.c
+++ b/modules/crossfade.c
@@ -17,6 +17,8 @@
 
 int sp_crossfade_init(sp_data *sp, sp_crossfade *p)
 {
+    USED(sp);
+
     p->pos = 0.5;
     return SP_OK;
 }
@@ -23,6 +25,8 @@
 
 int sp_crossfade_compute(sp_data *sp, sp_crossfade *p, SPFLOAT *in1, SPFLOAT *in2, SPFLOAT *out)
 {
+    USED(sp);
+
     *out = *in2 * p->pos + *in1 * (1 - p->pos);
     return SP_OK;
 }
--- a/modules/dcblocker.c
+++ b/modules/dcblocker.c
@@ -24,6 +24,8 @@
 
 int sp_dcblocker_init(sp_data *sp, sp_dcblocker *p)
 {
+    USED(sp);
+
     p->dcblocker = malloc(sizeof(sk_dcblocker));
     sk_dcblocker_init(p->dcblocker);
     return SP_OK;
@@ -32,6 +34,8 @@
 int sp_dcblocker_compute(sp_data *sp, sp_dcblocker *p,
                          SPFLOAT *in, SPFLOAT *out)
 {
+    USED(sp);
+
     *out = sk_dcblocker_tick(p->dcblocker, *in);
     return SP_OK;
 }
--- a/modules/delay.c
+++ b/modules/delay.c
@@ -30,7 +30,9 @@
 
 int sp_delay_compute(sp_data *sp, sp_delay *p, SPFLOAT *in, SPFLOAT *out)
 {
-    SPFLOAT delay = 0, sig = 0;
+    USED(sp);
+
+    SPFLOAT delay, sig;
     SPFLOAT *buf = p->buf;
     delay = buf[p->bufpos];
     sig = (delay * p->feedback) + *in;
--- a/modules/diode.c
+++ b/modules/diode.c
@@ -28,6 +28,8 @@
 
 static SPFLOAT sp_diode_opva_fdbk_out(sp_data *sp, sp_diode *p, int filt)
 {
+    USED(sp);
+
     return p->opva_beta[filt] *
         (p->opva_z1[filt] + p->opva_fdbk[filt] * p->opva_delta[filt]);
 }
@@ -151,7 +153,7 @@
     int i;
     SPFLOAT sigma;
     SPFLOAT un;
-    SPFLOAT tmp = 0.0;
+    SPFLOAT tmp;
 
     /* update filter coefficients */
     p->K = p->res * 17;
--- a/modules/dmetro.c
+++ b/modules/dmetro.c
@@ -17,6 +17,8 @@
 
 int sp_dmetro_init(sp_data *sp, sp_dmetro *p)
 {
+    USED(sp);
+
     p->counter = 0;
     p->time = 1.0;
     return SP_OK;
@@ -24,6 +26,8 @@
 
 int sp_dmetro_compute(sp_data *sp, sp_dmetro *p, SPFLOAT *in, SPFLOAT *out)
 {
+    USED(in);
+
     *out = 0;
 
     if (p->counter == 0) {
--- a/modules/dtrig.c
+++ b/modules/dtrig.c
@@ -17,6 +17,8 @@
 
 int sp_dtrig_init(sp_data *sp, sp_dtrig *p, sp_ftbl *ft)
 {
+    USED(sp);
+
     p->ft = ft;
     p->counter = 0;
     p->pos = 0;
--- a/modules/fmpair.c
+++ b/modules/fmpair.c
@@ -45,6 +45,8 @@
 int sp_fmpair_compute(sp_data *sp, sp_fmpair *p,
                       SPFLOAT *in, SPFLOAT *out)
 {
+    USED(sp, in);
+
     sk_fmpair_freq(p->fmpair, p->freq);
     sk_fmpair_modulator(p->fmpair, p->mod);
     sk_fmpair_carrier(p->fmpair, p->car);
--- a/modules/foo.c
+++ b/modules/foo.c
@@ -23,6 +23,8 @@
 
 int sp_foo_init(sp_data *sp, sp_foo *p)
 {
+    USED(sp);
+
     /* Initalize variables here. */
     p->bar = 123;
     return SP_OK;
@@ -30,6 +32,8 @@
 
 int sp_foo_compute(sp_data *sp, sp_foo *p, SPFLOAT *in, SPFLOAT *out)
 {
+    USED(p, sp);
+
     /* Send the signal's input to the output */
     *out = *in;
     return SP_OK;
--- a/modules/ftbl.c
+++ b/modules/ftbl.c
@@ -16,6 +16,8 @@
 
 int sp_ftbl_create(sp_data *sp, sp_ftbl **ft, size_t size)
 {
+    USED(sp);
+
     sp_ftbl *ftp;
     *ft = malloc(sizeof(sp_ftbl));
     ftp = *ft;
@@ -29,6 +31,8 @@
 
 int sp_ftbl_bind(sp_data *sp, sp_ftbl **ft, SPFLOAT *tbl, size_t size)
 {
+    USED(sp);
+
     sp_ftbl *ftp;
     *ft = malloc(sizeof(sp_ftbl));
     ftp = *ft;
@@ -46,7 +50,7 @@
     return SP_OK;
 }
 
-static char * tokenize(char **next, int *size)
+static char * tokenize_(char **next, int *size)
 {
     char *token;
     char *str;
@@ -72,6 +76,8 @@
 
 int sp_gen_vals(sp_data *sp, sp_ftbl *ft, const char *string)
 {
+    USED(sp);
+
     int size;
     char *str;
     char *out;
@@ -85,7 +91,7 @@
     j = 0;
 
     while (size > 0) {
-        out = tokenize(&str, &size);
+        out = tokenize_(&str, &size);
         if (ft->size < j + 1) {
             ft->tbl = realloc(ft->tbl, sizeof(SPFLOAT) * (ft->size + 2));
             /* zero out new tables */
@@ -102,6 +108,8 @@
 
 int sp_gen_sine(sp_data *sp, sp_ftbl *ft)
 {
+    USED(sp);
+
     unsigned long i;
     SPFLOAT step = 2 * M_PI / ft->size;
     for (i = 0; i < ft->size; i++) {
@@ -112,6 +120,8 @@
 
 void sp_gen_triangle(sp_data *sp, sp_ftbl *ft)
 {
+    USED(sp);
+
     unsigned int i;
     unsigned int counter;
     SPFLOAT incr;
--- a/modules/in.c
+++ b/modules/in.c
@@ -19,6 +19,8 @@
 
 int sp_in_init(sp_data *sp, sp_in *p)
 {
+    USED(sp);
+
     p->fp = stdin;
     return SP_OK;
 }
@@ -25,6 +27,8 @@
 
 int sp_in_compute(sp_data *sp, sp_in *p, SPFLOAT *in, SPFLOAT *out)
 {
+    USED(sp, in);
+
     *out = 0;
     fread(out, sizeof(SPFLOAT), 1, p->fp);
     return SP_OK;
--- a/modules/incr.c
+++ b/modules/incr.c
@@ -26,6 +26,8 @@
 
 int sp_incr_init(sp_data *sp, sp_incr *p, SPFLOAT val)
 {
+    USED(sp);
+
     p->min = 0;
     p->max = 1;
     p->step = 0.1;
@@ -35,6 +37,8 @@
 
 int sp_incr_compute(sp_data *sp, sp_incr *p, SPFLOAT *in, SPFLOAT *out)
 {
+    USED(sp);
+
     if (*in > 0 ) {
         p->val += p->step;
         p->val = max(min(p->val, p->max), p->min);
--- a/modules/jcrev.c
+++ b/modules/jcrev.c
@@ -43,7 +43,7 @@
 
 } jcrev;
 
-jcrev* newjcrev() {
+jcrev* newjcrev(void) {
 	jcrev* dsp = (jcrev*)malloc(sizeof(jcrev));
 	return dsp;
 }
@@ -315,6 +315,7 @@
 
 int sp_jcrev_compute(sp_data *sp, sp_jcrev *p, SPFLOAT *in, SPFLOAT *out)
 {
+    USED(sp);
 
     jcrev *dsp = p->ud;
     SPFLOAT out1 = 0, out2 = 0, out3 = 0, out4 = 0;
--- a/modules/maygate.c
+++ b/modules/maygate.c
@@ -17,6 +17,8 @@
 
 int sp_maygate_init(sp_data *sp, sp_maygate *p)
 {
+    USED(sp);
+
     p->prob = 0.0;
     p->gate = 0;
     p->mode = 0;
--- a/modules/metro.c
+++ b/modules/metro.c
@@ -38,6 +38,8 @@
 
 int sp_metro_compute(sp_data *sp, sp_metro *p, SPFLOAT *in, SPFLOAT *out)
 {
+    USED(sp, in);
+
     SPFLOAT phs;
 
     phs = p->phs;
--- /dev/null
+++ b/modules/mkfile
@@ -1,0 +1,97 @@
+<../mkfile.common
+
+LIB=libspmodules.a$O
+
+OFILES=\
+	adsr.$O\
+	autowah.$O\
+	base.$O\
+	bigverb.$O\
+	biscale.$O\
+	bitcrush.$O\
+	blsaw.$O\
+	blsquare.$O\
+	bltriangle.$O\
+	brown.$O\
+	butbp.$O\
+	butbr.$O\
+	buthp.$O\
+	butlp.$O\
+	clamp.$O\
+	clock.$O\
+	compressor.$O\
+	count.$O\
+	crossfade.$O\
+	dcblocker.$O\
+	delay.$O\
+	diode.$O\
+	dmetro.$O\
+	dtrig.$O\
+	expon.$O\
+	fftwrapper.$O\
+	fmpair.$O\
+	ftbl.$O\
+	in.$O\
+	incr.$O\
+	jcrev.$O\
+	line.$O\
+	loadwav.$O\
+	lpc.$O\
+	maygate.$O\
+	metro.$O\
+	modalres.$O\
+	noise.$O\
+	nsmp.$O\
+	osc.$O\
+	oscmorph.$O\
+	padsynth.$O\
+	paulstretch.$O\
+	peakeq.$O\
+	peaklim.$O\
+	phaser.$O\
+	phasewarp.$O\
+	phasor.$O\
+	pinknoise.$O\
+	prop.$O\
+	pshift.$O\
+	randh.$O\
+	randmt.$O\
+	random.$O\
+	reverse.$O\
+	rline.$O\
+	rpt.$O\
+	samphold.$O\
+	saturator.$O\
+	scale.$O\
+	scrambler.$O\
+	sdelay.$O\
+	slice.$O\
+	smoothdelay.$O\
+	smoother.$O\
+	spa.$O\
+	sparec.$O\
+	switch.$O\
+	tadsr.$O\
+	talkbox.$O\
+	tblrec.$O\
+	tdiv.$O\
+	tenv.$O\
+	tenv2.$O\
+	tenvx.$O\
+	tgate.$O\
+	thresh.$O\
+	timer.$O\
+	tin.$O\
+	trand.$O\
+	tread.$O\
+	tseg.$O\
+	tseq.$O\
+	vardelay.$O\
+	verbity.$O\
+	voc.$O\
+	wavin.$O\
+	wavout.$O\
+	wpkorg35.$O\
+	zitarev.$O\
+
+</sys/src/cmd/mklib
--- a/modules/modalres.c
+++ b/modules/modalres.c
@@ -37,6 +37,8 @@
 int sp_modalres_compute(sp_data *sp, sp_modalres *p,
                          SPFLOAT *in, SPFLOAT *out)
 {
+    USED(sp);
+
     sk_modalres_freq(p->modalres, p->freq);
     sk_modalres_q(p->modalres, p->q);
     *out = sk_modalres_tick(p->modalres, *in);
--- a/modules/noise.c
+++ b/modules/noise.c
@@ -12,6 +12,8 @@
 
 int sp_noise_init(sp_data *sp, sp_noise *ns)
 {
+    USED(sp);
+
     ns->amp = 1.0;
     return SP_OK;
 }
@@ -18,6 +20,8 @@
 
 int sp_noise_compute(sp_data *sp, sp_noise *ns, SPFLOAT *in, SPFLOAT *out)
 {
+    USED(sp, in);
+
     *out = ((sp_rand(sp) % SP_RANDMAX) / (SP_RANDMAX * 1.0));
     *out = (*out * 2) - 1;
     *out *= ns->amp;
--- a/modules/nsmp.c
+++ b/modules/nsmp.c
@@ -114,6 +114,8 @@
 
 int nano_compute(sp_data *sp, nanosamp *smp, SPFLOAT *out)
 {
+    USED(sp);
+
     if (!smp->selected) {
         *out = 0;
         return SP_NOT_OK;
@@ -120,8 +122,8 @@
     }
 
     if (smp->curpos < (SPFLOAT)smp->sample->size) {
-        SPFLOAT x1 = 0 , x2 = 0, frac = 0, tmp = 0;
-        uint32_t index = 0;
+        SPFLOAT x1 , x2, frac, tmp;
+        uint32_t index;
         SPFLOAT *tbl = smp->ft->tbl;
 
         tmp = (smp->curpos + smp->sample->pos);
@@ -206,6 +208,8 @@
 
 int sp_nsmp_init(sp_data *sp, sp_nsmp *p, sp_ftbl *ft, int sr, const char *ini)
 {
+    USED(sp);
+
     if (nano_create(&p->smp, ini, sr) == SP_NOT_OK) {
         nano_destroy(&p->smp);
         return SP_NOT_OK;
@@ -236,6 +240,8 @@
 
 int sp_nsmp_print_index(sp_data *sp, sp_nsmp *p)
 {
+    USED(sp);
+
     uint32_t i;
     for (i = 0; i < p->smp->dict.nval; i++) {
         printf("%d: key = %s\n", i, p->smp->index[i]->name);
--- a/modules/osc.c
+++ b/modules/osc.c
@@ -33,6 +33,8 @@
 
 int sp_osc_compute(sp_data *sp, sp_osc *osc, SPFLOAT *in, SPFLOAT *out)
 {
+    USED(sp, in);
+
     sk_osc_freq(osc->osc, osc->freq);
     sk_osc_amp(osc->osc, osc->amp);
     *out = sk_osc_tick(osc->osc);
--- a/modules/oscmorph.c
+++ b/modules/oscmorph.c
@@ -65,6 +65,8 @@
                         SPFLOAT *in,
                         SPFLOAT *out)
 {
+    USED(sp, in);
+
     sp_ftbl *ftp1;
     SPFLOAT amp, cps, fract, v1, v2;
     SPFLOAT *ft1, *ft2;
--- a/modules/padsynth.c
+++ b/modules/padsynth.c
@@ -24,14 +24,12 @@
 {
 
     int i, nh;
-    int N = (int) ps->size;
-    int number_harmonics = (int) amps->size;
-    SPFLOAT *A = amps->tbl;
-    SPFLOAT *smp = ps->tbl;
-
-    SPFLOAT *freq_amp = malloc((N / 2) * sizeof(SPFLOAT));
-    SPFLOAT *freq_phase = malloc((N / 2) * sizeof(SPFLOAT));
-
+    int N;
+    int number_harmonics;
+    SPFLOAT *A;
+    SPFLOAT *smp;
+    SPFLOAT *freq_amp;
+    SPFLOAT *freq_phase;
 
     N = (int) ps->size;
     number_harmonics = (int) amps->size;
--- a/modules/paulstretch.c
+++ b/modules/paulstretch.c
@@ -157,6 +157,8 @@
 
 int sp_paulstretch_compute(sp_data *sp, sp_paulstretch *p, SPFLOAT *in, SPFLOAT *out)
 {
+    USED(in);
+
     if (p->counter == 0) compute_block(sp, p, NULL);
 
     *out = p->output[p->counter];
--- a/modules/peakeq.c
+++ b/modules/peakeq.c
@@ -39,6 +39,8 @@
 int sp_peakeq_compute(sp_data *sp, sp_peakeq *p,
                          SPFLOAT *in, SPFLOAT *out)
 {
+    USED(sp);
+
     sk_peakeq_freq(p->peakeq, p->freq);
     sk_peakeq_bandwidth(p->peakeq, p->bw);
     sk_peakeq_gain(p->peakeq, p->gain);
--- a/modules/peaklim.c
+++ b/modules/peaklim.c
@@ -33,6 +33,8 @@
 
 int sp_peaklim_init(sp_data *sp, sp_peaklim *p)
 {
+    USED(sp);
+
     p->a1_r = 0;
     p->b0_r = 1;
     p->a1_a = 0;
@@ -47,9 +49,8 @@
 
 int sp_peaklim_compute(sp_data *sp, sp_peaklim *p, SPFLOAT *in, SPFLOAT *out)
 {
-
-    SPFLOAT db_gain = 0;
-    SPFLOAT gain = 0;
+    SPFLOAT db_gain;
+    SPFLOAT gain;
 
     /* change coefficients, if needed */
 
--- a/modules/phaser.c
+++ b/modules/phaser.c
@@ -55,7 +55,7 @@
 
 } phaser;
 
-phaser* newphaser() {
+phaser* newphaser(void) {
 	phaser* dsp = (phaser*)malloc(sizeof(phaser));
 	return dsp;
 }
@@ -302,6 +302,8 @@
 
 static void addHorizontalSlider(void* ui_interface, const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step)
 {
+    USED(label, init, min, max, step);
+
     sp_phaser *p = ui_interface;
     p->args[p->argpos] = zone;
     p->argpos++;
@@ -309,6 +311,8 @@
 
 static void addCheckButton (void* ui_interface, const char* label, FAUSTFLOAT* zone)
 {
+    USED(label);
+
     sp_phaser *p = ui_interface;
     p->args[p->argpos] = zone;
     p->argpos++;
@@ -359,6 +363,8 @@
 int sp_phaser_compute(sp_data *sp, sp_phaser *p,
 	SPFLOAT *in1, SPFLOAT *in2, SPFLOAT *out1, SPFLOAT *out2)
 {
+    USED(sp);
+
     phaser *dsp = p->faust;
     SPFLOAT *faust_out[] = {out1, out2};
     SPFLOAT *faust_in[] = {in1, in2};
--- a/modules/phasewarp.c
+++ b/modules/phasewarp.c
@@ -20,6 +20,8 @@
 
 int sp_phasewarp_init(sp_data *sp, sp_phasewarp *p)
 {
+    USED(sp, p);
+
     return SP_OK;
 }
 
@@ -26,6 +28,8 @@
 int sp_phasewarp_compute(sp_data *sp, sp_phasewarp *p,
                          SPFLOAT *in, SPFLOAT *out)
 {
+    USED(sp);
+
     *out = sk_phasewarp_tick(*in, p->amount);
     return SP_OK;
 }
--- a/modules/phasor.c
+++ b/modules/phasor.c
@@ -39,6 +39,8 @@
 
 int sp_phasor_compute(sp_data *sp, sp_phasor *p, SPFLOAT *in, SPFLOAT *out)
 {
+    USED(sp, in);
+
     sk_phasor_freq(p->phasor, p->freq);
     *out = sk_phasor_tick(p->phasor);
     return SP_OK;
@@ -46,6 +48,8 @@
 
 int sp_phasor_reset(sp_data *sp, sp_phasor *p, SPFLOAT iphs)
 {
+    USED(sp);
+
     sk_phasor_reset(p->phasor, iphs);
     return SP_OK;
 }
--- a/modules/pinknoise.c
+++ b/modules/pinknoise.c
@@ -53,6 +53,8 @@
 
 int sp_pinknoise_compute(sp_data *sp, sp_pinknoise *p, SPFLOAT *in, SPFLOAT *out)
 {
+    USED(sp, in);
+
     short tmp;
     uint32_t k;
     k = ctz[p->counter & 63];
--- a/modules/prop.c
+++ b/modules/prop.c
@@ -70,6 +70,8 @@
 
 int sp_prop_init(sp_data *sp, sp_prop *p, const char *str)
 {
+    USED(sp);
+
     p->count = 0;
 
     prop_create(&p->prp);
@@ -86,6 +88,8 @@
 
 int sp_prop_compute(sp_data *sp, sp_prop *p, SPFLOAT *in, SPFLOAT *out)
 {
+    USED(in);
+
     if (p->count == 0) {
         if (p->bpm != p->lbpm) {
             p->prp->scale = (SPFLOAT) 60.0 / p->bpm;
@@ -339,7 +343,7 @@
     }
 }
 
-prop_event prop_next(sp_data *sp, prop_data *pd)
+static prop_event prop_next(sp_data *sp, prop_data *pd)
 {
 /*
     prop_list *lst = pd->main;
@@ -567,6 +571,8 @@
 
 int sp_prop_reset(sp_data *sp, sp_prop *p)
 {
+    USED(sp);
+
     back_to_top(p->prp);
     p->count = 0;
     return SP_OK;
--- a/modules/pshift.c
+++ b/modules/pshift.c
@@ -10,10 +10,6 @@
 #define FAUSTFLOAT SPFLOAT
 #endif
 
-
-float powf(float dummy0, float dummy1);
-float fmodf(float dummy0, float dummy1);
-
 typedef struct {
 	float fVec0[65536];
 	float fRec0[2];
@@ -24,7 +20,7 @@
 	int fSamplingFreq;
 } pshift;
 
-static pshift* newpshift() {
+static pshift* newpshift(void) {
 	pshift* dsp = (pshift*)malloc(sizeof(pshift));
 	return dsp;
 }
@@ -100,6 +96,8 @@
 
 static void addHorizontalSlider(void* ui_interface, const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step)
 {
+    USED(label, init, min, max, step);
+
     sp_pshift *p = ui_interface;
     p->args[p->argpos] = zone;
     p->argpos++;
@@ -141,6 +139,7 @@
 
 int sp_pshift_compute(sp_data *sp, sp_pshift *p, SPFLOAT *in, SPFLOAT *out)
 {
+    USED(sp);
 
     pshift *dsp = p->faust;
     SPFLOAT out1 = 0;
--- a/modules/randh.c
+++ b/modules/randh.c
@@ -28,6 +28,8 @@
 
 int sp_randh_compute(sp_data *sp, sp_randh *p, SPFLOAT *in, SPFLOAT *out)
 {
+    USED(in);
+
     if (p->counter == 0) {
         p->val = p->min + ((SPFLOAT) sp_rand(sp) / SP_RANDMAX) * (p->max - p->min);
 
--- a/modules/random.c
+++ b/modules/random.c
@@ -17,6 +17,8 @@
 
 int sp_random_init(sp_data *sp, sp_random *p)
 {
+    USED(sp);
+
     p->min = -1;
     p->max = 1;
     return SP_OK;
@@ -24,6 +26,8 @@
 
 int sp_random_compute(sp_data *sp, sp_random *p, SPFLOAT *in, SPFLOAT *out)
 {
+    USED(sp, in);
+
     /* Send the signal's input to the output */
     SPFLOAT rnd = ((sp_rand(sp) % RAND_MAX) / (RAND_MAX * 1.0));
     rnd *= (p->max - p->min);
--- a/modules/reverse.c
+++ b/modules/reverse.c
@@ -28,6 +28,8 @@
 
 int sp_reverse_compute(sp_data *sp, sp_reverse *p, SPFLOAT *in, SPFLOAT *out)
 {
+    USED(sp);
+
     SPFLOAT *buf = p->buf;
     *out = buf[p->bufpos];
     buf[(p->bufsize - 1) - p->bufpos] = *in;
--- a/modules/rline.c
+++ b/modules/rline.c
@@ -39,6 +39,8 @@
 int sp_rline_compute(sp_data *sp, sp_rline *p,
                          SPFLOAT *in, SPFLOAT *out)
 {
+    USED(sp, in);
+
     sk_rline_min(p->rline, p->min);
     sk_rline_max(p->rline, p->max);
     sk_rline_rate(p->rline, p->cps);
--- a/modules/rpt.c
+++ b/modules/rpt.c
@@ -41,6 +41,8 @@
 int sp_rpt_compute(sp_data *sp, sp_rpt *p, SPFLOAT *trig,
         SPFLOAT *in, SPFLOAT *out)
 {
+    USED(sp);
+
     SPFLOAT *buf = p->buf;
 
     if (p->rc == SP_NOT_OK) {
--- a/modules/samphold.c
+++ b/modules/samphold.c
@@ -17,6 +17,8 @@
 
 int sp_samphold_init(sp_data *sp, sp_samphold *p)
 {
+    USED(sp);
+
     p->val = 0;
     return SP_OK;
 }
@@ -23,6 +25,8 @@
 
 int sp_samphold_compute(sp_data *sp, sp_samphold *p, SPFLOAT *trig, SPFLOAT *in, SPFLOAT *out)
 {
+    USED(sp);
+
     if(*trig != 0) {
         p->val = *in;
     }
--- a/modules/saturator.c
+++ b/modules/saturator.c
@@ -14,9 +14,6 @@
     b0 = acoefs[0]; b1 = acoefs[1]; b2 = acoefs[2];
     a0 = acoefs[3]; a1 = acoefs[4]; a2 = acoefs[5];
 
-    bz0 = 1.0; bz1 = 0.0; bz2 = 0.0;
-    az0 = 1.0; az1 = 0.0; az2 = 0.0;
-
     az0 = a2*4*fs*fs + a1*2*fs + a0;
 
     bz2 = (b2*4*fs*fs - b1*2*fs + b0) / az0;
@@ -88,6 +85,8 @@
 
 int sp_saturator_compute(sp_data *sp, sp_saturator *p, SPFLOAT *in, SPFLOAT *out)
 {
+    USED(sp);
+
     int i, j;
     SPFLOAT fsignal, usignal, dsignal;
 
--- a/modules/scale.c
+++ b/modules/scale.c
@@ -18,6 +18,8 @@
 
 int sp_scale_init(sp_data *sp, sp_scale *p)
 {
+    USED(sp);
+
     p->min = -1;
     p->max = 1;
     return SP_OK;
@@ -25,6 +27,8 @@
 
 int sp_scale_compute(sp_data *sp, sp_scale *p, SPFLOAT *in, SPFLOAT *out)
 {
+    USED(sp);
+
     *out = sk_scale(*in, p->min, p->max);
     return SP_OK;
 }
--- a/modules/scrambler.c
+++ b/modules/scrambler.c
@@ -44,7 +44,6 @@
 
     kiss_fftri(ifft, tmp, dst->tbl);
     max = -1;
-    val = 0;
     for(i = 0; i < size; i++) {
         val = fabs(dst->tbl[i]);
         if(val > max) {
--- a/modules/sdelay.c
+++ b/modules/sdelay.c
@@ -26,6 +26,8 @@
 
 int sp_sdelay_init(sp_data *sp, sp_sdelay *p, int size)
 {
+    USED(sp);
+
     int n;
     p->size = size;
     p->buf = malloc(size * sizeof(SPFLOAT));
@@ -36,6 +38,8 @@
 
 int sp_sdelay_compute(sp_data *sp, sp_sdelay *p, SPFLOAT *in, SPFLOAT *out)
 {
+    USED(sp);
+
     *out = p->buf[p->pos];
     p->buf[p->pos] = *in;
     p->pos = (p->pos + 1) % p->size;
--- a/modules/slice.c
+++ b/modules/slice.c
@@ -17,6 +17,8 @@
 
 int sp_slice_init(sp_data *sp, sp_slice *p, sp_ftbl *vals, sp_ftbl *buf)
 {
+    USED(sp);
+
     p->vals = vals;
     p->buf = buf;
     p->pos = 0;
@@ -27,6 +29,8 @@
 
 int sp_slice_compute(sp_data *sp, sp_slice *p, SPFLOAT *in, SPFLOAT *out)
 {
+    USED(sp);
+
     *out = 0;
     if(*in != 0) {
         if(p->id < p->vals->size) {
--- a/modules/smoother.c
+++ b/modules/smoother.c
@@ -48,6 +48,8 @@
 
 int sp_smoother_compute(sp_data *sp, sp_smoother *p, SPFLOAT *in, SPFLOAT *out)
 {
+    USED(sp);
+
     if (p->psmooth != p->smooth) {
         p->a1 = pow(0.5, p->onedsr/p->smooth);
         p->b0 = 1.0 - p->a1;
@@ -61,6 +63,8 @@
 
 int sp_smoother_reset(sp_data *sp, sp_smoother *p, SPFLOAT *in)
 {
+    USED(sp);
+
     p->y0 = *in;
     return SP_OK;
 }
--- a/modules/spa.c
+++ b/modules/spa.c
@@ -2,6 +2,7 @@
 
 #include <stdlib.h>
 #include "soundpipe.h"
+#include "../lib/spa/spa.h"
 
 #define SPA_BUFSIZE 4096
 
@@ -36,6 +37,8 @@
 
 int sp_spa_compute(sp_data *sp, sp_spa *p, SPFLOAT *in, SPFLOAT *out)
 {
+    USED(in);
+
     if (p->bufsize == 0) {
         *out = 0.0;
         return SP_OK;
--- a/modules/sparec.c
+++ b/modules/sparec.c
@@ -2,6 +2,7 @@
 
 #include <stdlib.h>
 #include "soundpipe.h"
+#include "../lib/spa/spa.h"
 
 #define SPA_BUFSIZE 4096
 
--- a/modules/switch.c
+++ b/modules/switch.c
@@ -17,6 +17,8 @@
 
 int sp_switch_init(sp_data *sp, sp_switch *p)
 {
+    USED(sp);
+
     p->mode = 0;
     return SP_OK;
 }
@@ -24,6 +26,8 @@
 int sp_switch_compute(sp_data *sp, sp_switch *p, SPFLOAT *trig,
     SPFLOAT *in1, SPFLOAT *in2, SPFLOAT *out)
 {
+    USED(sp);
+
     if (*trig) {
         p->mode = p->mode == 0 ? 1 : 0;
     }
--- a/modules/tadsr.c
+++ b/modules/tadsr.c
@@ -47,6 +47,8 @@
 
 static void ADSR_setSustainLevel(sp_data *sp, sp_tadsr *a, SPFLOAT aLevel)
 {
+    USED(sp);
+
    a->sustainLevel = aLevel;
 }
 
@@ -122,6 +124,8 @@
 
 int sp_tadsr_init(sp_data *sp, sp_tadsr *p)
 {
+    USED(sp);
+
     make_ADSR(p);
     p->atk = 0.5;
     p->dec = 0.5;
--- a/modules/talkbox.c
+++ b/modules/talkbox.c
@@ -172,7 +172,7 @@
         if(++p0 >= t->N) { lpc(t->buf0, t->car0, t->N, t->O);  p0 = 0; }
 
         w = 1.0f - w;  fx += t->buf1[p1] * w;  t->buf1[p1] = x * w;
-        if(++p1 >= t->N) { lpc(t->buf1, t->car1, t->N, t->O);  p1 = 0; }
+        if(++p1 >= t->N) { lpc(t->buf1, t->car1, t->N, t->O); }
     }
 
     p = t->u0 + h0 * fx;
--- a/modules/tblrec.c
+++ b/modules/tblrec.c
@@ -18,6 +18,8 @@
 
 int sp_tblrec_init(sp_data *sp, sp_tblrec *p, sp_ftbl *ft)
 {
+    USED(sp);
+
     p->index = 0;
     p->record = 0;
     p->ft = ft;
@@ -26,6 +28,8 @@
 
 int sp_tblrec_compute(sp_data *sp, sp_tblrec *p, SPFLOAT *in, SPFLOAT *trig, SPFLOAT *out)
 {
+    USED(sp);
+
     if(*trig != 0) {
         if(p->record == 1) {
             p->record = 0;
--- a/modules/tdiv.c
+++ b/modules/tdiv.c
@@ -17,6 +17,8 @@
 
 int sp_tdiv_init(sp_data *sp, sp_tdiv *p)
 {
+    USED(sp);
+
     p->num = 2;
     p->counter = 0;
     p->offset = 0;
@@ -25,6 +27,8 @@
 
 int sp_tdiv_compute(sp_data *sp, sp_tdiv *p, SPFLOAT *in, SPFLOAT *out)
 {
+    USED(sp);
+
     *out = 0.0;
     if(*in != 0) {
         if(p->counter == p->offset) *out = 1.0;
--- a/modules/tenv.c
+++ b/modules/tenv.c
@@ -29,7 +29,7 @@
 static void sp_tenv_comp(void *ud, SPFLOAT *out)
 {
     sp_tenv *env = ud;
-    SPFLOAT sig = 0;
+    SPFLOAT sig;
     uint32_t pos = env->pos;
     *out = 0.0;
 
@@ -80,6 +80,8 @@
 
 int sp_tenv_compute(sp_data *sp, sp_tenv *p, SPFLOAT *in, SPFLOAT *out)
 {
+    USED(sp);
+
     if (*in) {
         sp_tenv_reinit(p);
         p->started = 1;
--- a/modules/tenv2.c
+++ b/modules/tenv2.c
@@ -23,6 +23,8 @@
 
 int sp_tenv2_init(sp_data *sp, sp_tenv2 *p)
 {
+    USED(sp);
+
     p->state = T_INIT;
     p->atk = 0.1;
     p->rel = 0.1;
@@ -49,7 +51,6 @@
     if(p->timer == 0) {
         if(p->state == T_ON) *out = 1;
         else *out = 0;
-        return SP_OK;
     } else {
         p->timer--;
         if(p->state == T_ON)  {
@@ -62,8 +63,6 @@
         if(*out < 0) *out = 0;
 
         p->last = *out;
-
-        return SP_OK;
     }
     return SP_OK;
 }
--- a/modules/tgate.c
+++ b/modules/tgate.c
@@ -17,6 +17,8 @@
 
 int sp_tgate_init(sp_data *sp, sp_tgate *p)
 {
+    USED(sp);
+
     p->time = 0;
     p->timer = 0;
     return SP_OK;
--- a/modules/thresh.c
+++ b/modules/thresh.c
@@ -17,6 +17,8 @@
 
 int sp_thresh_init(sp_data *sp, sp_thresh *p)
 {
+    USED(sp);
+
     /* Initalize variables here. */
     p->init = 1;
     p->mode = 0;
@@ -27,6 +29,8 @@
 
 int sp_thresh_compute(sp_data *sp, sp_thresh *p, SPFLOAT *in, SPFLOAT *out)
 {
+    USED(sp);
+
     if(p->init) {
         *out = 0;
         p->prev = *in;
--- a/modules/timer.c
+++ b/modules/timer.c
@@ -17,6 +17,8 @@
 
 int sp_timer_init(sp_data *sp, sp_timer *p)
 {
+    USED(sp);
+
     p->mode = 0;
     p->pos = 0;
     p->time = 0;
--- a/modules/tin.c
+++ b/modules/tin.c
@@ -17,6 +17,8 @@
 
 int sp_tin_init(sp_data *sp, sp_tin *p)
 {
+    USED(sp);
+
     p->fp = stdin;
     p->val = 0;
     return SP_OK;
@@ -24,6 +26,8 @@
 
 int sp_tin_compute(sp_data *sp, sp_tin *p, SPFLOAT *in, SPFLOAT *out)
 {
+    USED(sp);
+
     if(*in) {
         fread(&p->val, sizeof(SPFLOAT), 1, p->fp);
     }
--- a/modules/trand.c
+++ b/modules/trand.c
@@ -17,6 +17,8 @@
 
 int sp_trand_init(sp_data *sp, sp_trand *p)
 {
+    USED(sp);
+
     p->min = 0;
     p->max = 1;
     p->val = 0;
--- a/modules/tread.c
+++ b/modules/tread.c
@@ -16,6 +16,8 @@
 
 int sp_tread_init(sp_data *sp, sp_tread *p, sp_ftbl *ft, int mode)
 {
+    USED(sp);
+
     p->ft = ft;
     p->mode = mode;
     p->offset = 0;
@@ -25,6 +27,8 @@
 
 int sp_tread_compute(sp_data *sp, sp_tread *p, SPFLOAT *in, SPFLOAT *out)
 {
+    USED(sp, in);
+
     int ipos;
     SPFLOAT *tbl = p->ft->tbl;
     SPFLOAT mul, tmp, fpos;
--- a/modules/tseq.c
+++ b/modules/tseq.c
@@ -17,6 +17,8 @@
 
 int sp_tseq_init(sp_data *sp, sp_tseq *p, sp_ftbl *ft)
 {
+    USED(sp);
+
     p->ft = ft;
     p->pos = -1;
     p->val = 0;
--- a/modules/vardelay.c
+++ b/modules/vardelay.c
@@ -44,6 +44,8 @@
                        SPFLOAT *in,
                        SPFLOAT *out)
 {
+    USED(sp);
+
     sk_vardelay_delay(p->v, p->del);
     sk_vardelay_feedback(p->v, p->feedback);
     *out = sk_vardelay_tick(p->v, *in);
--- a/modules/verbity.c
+++ b/modules/verbity.c
@@ -166,6 +166,8 @@
                        SPFLOAT *inL, SPFLOAT *inR,
                        SPFLOAT *outL, SPFLOAT *outR)
 {
+    USED(sp);
+
 	SPFLOAT overallscale;
 	int cycleEnd;
 	SPFLOAT size;
--- a/modules/voc.c
+++ b/modules/voc.c
@@ -132,6 +132,7 @@
 
 static void glottis_setup_waveform(glottis *glot, SPFLOAT lambda)
 {
+    USED(lambda);
 
     SPFLOAT Rd;
     SPFLOAT Ra;
@@ -228,7 +229,6 @@
     SPFLOAT t;
     SPFLOAT intensity;
 
-    out = 0;
     intensity = 1.0;
     glot->time_in_waveform += glot->T;
 
@@ -379,11 +379,9 @@
     if(current < target) {
         tmp = current + amt_up;
         return MIN(tmp, target);
-    } else {
-        tmp = current - amt_down;
-        return MAX(tmp, target);
     }
-    return 0.0;
+    tmp = current - amt_down;
+    return MAX(tmp, target);
 }
 
 static void tract_reshape(tract *tr)
@@ -399,7 +397,6 @@
     amount = tr->block_time * tr->movement_speed;
 
     for(i = 0; i < tr->n; i++) {
-        slow_return = 0;
         diameter = tr->diameter[i];
         target_diameter = tr->target_diameter[i];
 
@@ -474,7 +471,6 @@
 
 
     for(i = 0; i < tr->n; i++) {
-        diameter = 0;
         if(i < 7 * (SPFLOAT)tr->n / 44 - 0.5) {
             diameter = 0.6;
         } else if( i < 12 * (SPFLOAT)tr->n / 44) {
@@ -527,7 +523,9 @@
     SPFLOAT  in,
     SPFLOAT  lambda)
 {
-     SPFLOAT  r, w;
+    USED(sp);
+
+    SPFLOAT  r, w;
     int i;
     SPFLOAT  amp;
     int current_size;
@@ -730,6 +728,7 @@
     SPFLOAT tongue_index,
     SPFLOAT tongue_diameter,
     SPFLOAT *diameters) {
+    USED(voc);
 
     int i;
     SPFLOAT t;
--- a/modules/wavin.c
+++ b/modules/wavin.c
@@ -32,6 +32,8 @@
 
 int sp_wavin_init(sp_data *sp, sp_wavin *p, const char *filename)
 {
+    USED(sp);
+
     p->count = 0;
     p->pos = 0;
     p->buf_start = 0;
@@ -52,6 +54,8 @@
 
 int sp_wavin_compute(sp_data *sp, sp_wavin *p, SPFLOAT *in, SPFLOAT *out)
 {
+    USED(in);
+
     if (p->pos > sp_drwav_sampcount(p->wav)) {
         *out = 0;
         return SP_OK;
@@ -100,6 +104,8 @@
 
 int sp_wavin_seek(sp_data *sp, sp_wavin *p, unsigned long sample)
 {
+    USED(sp);
+
     sp_drwav_seek_to_sample(p->wav, sample);
     return SP_OK;
 }
--- a/modules/wavout.c
+++ b/modules/wavout.c
@@ -38,6 +38,8 @@
 
 int sp_wavout_compute(sp_data *sp, sp_wavout *p, SPFLOAT *in, SPFLOAT *out)
 {
+    USED(sp);
+
     *out = *in;
     if(p->count == WAVOUT_BUFSIZE) {
         sp_drwav_write(p->wav, WAVOUT_BUFSIZE, p->buf);
--- a/modules/wpkorg35.c
+++ b/modules/wpkorg35.c
@@ -39,6 +39,8 @@
 
 SPFLOAT wpk_doFilter(sp_wpkorg35 *wpk)
 {
+    USED(wpk);
+
     return 0.0;
 }
 
@@ -95,12 +97,6 @@
     SPFLOAT vn;
 
     if(p->pcutoff != p->cutoff || p->pres != p->res) update(sp, p);
-
-    y1 = 0.0;
-    S35 = 0.0;
-    u = 0.0;
-    y = 0.0;
-    vn = 0.0;
 
     /* process input through LPF1 */
     vn = (*in - p->lpf1_z) * p->lpf1_a;
--- a/modules/zitarev.c
+++ b/modules/zitarev.c
@@ -22,18 +22,11 @@
 #define FAUSTFLOAT float
 #endif
 
-float powf(float dummy0, float dummy1);
-float sqrtf(float dummy0);
-float cosf(float dummy0);
-float floorf(float dummy0);
-float expf(float dummy0);
 static float faustpower2_f(float value) {
 	return (value * value);
 
 }
-float tanf(float dummy0);
 
-
 typedef struct {
 
 	float fVec1[32768];
@@ -153,7 +146,7 @@
 
 } zitarev;
 
-static zitarev* newzitarev() {
+static zitarev* newzitarev(void) {
 	zitarev* dsp = (zitarev*)malloc(sizeof(zitarev));
 	return dsp;
 }
@@ -1005,6 +998,8 @@
 
 static void addHorizontalSlider(void* ui_interface, const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step)
 {
+    USED(label, init, min, max, step);
+
     sp_zitarev *p = ui_interface;
     p->args[p->argpos] = zone;
     p->argpos++;
@@ -1053,6 +1048,7 @@
 
 int sp_zitarev_compute(sp_data *sp, sp_zitarev *p, SPFLOAT *in1, SPFLOAT *in2, SPFLOAT *out1, SPFLOAT *out2)
 {
+    USED(sp);
 
     zitarev *dsp = p->faust;
     SPFLOAT *faust_out[] = {out1, out2};
--- a/util/data2html.lua
+++ b/util/data2html.lua
@@ -1,4 +1,4 @@
-#!/usr/bin/env lua
+#!/bin/lu9
 
 -- Parse a lua table in modules/data and write text
 -- to run: lua sp.lua "foo"
--- a/util/data2txt.lua
+++ b/util/data2txt.lua
@@ -1,4 +1,4 @@
-#!/usr/local/bin/lua
+#!/bin/lu9
 
 -- Parse a lua table in modules/data and write text
 -- to run: lua sp.lua "foo"
@@ -46,14 +46,16 @@
     
     io.write(string.format("%s(sp_data *sp, sp_%s *%s", 
         tbl.func.init, self.name, self.name))
-    
-    for _, v in pairs(tbl.params.mandatory) do
-        if(string.byte(v.type, string.len(v.type)) == 42) then
-        arg = string.format(", %s%s", v.type, v.name)
-        else
-        arg = string.format(", %s %s", v.type, v.name)
+    tbl = tbl.params.mandatory
+    if tbl then
+        for _, v in pairs(tbl) do
+            if(string.byte(v.type, string.len(v.type)) == 42) then
+            arg = string.format(", %s%s", v.type, v.name)
+            else
+            arg = string.format(", %s %s", v.type, v.name)
+            end
+            io.write(arg)
         end
-        io.write(arg)
     end
 
     io.write(")\n")
@@ -78,67 +80,73 @@
 	self:initf(sp)   
 	self:computef(sp)
 	self:destroyf(sp)   
-	io.write("\n")
+    io.write("\n")
 end
 
 function PG.man_params(self,sp)
-    self:printheader("Mandatory Parameters")
     local tbl = sp[self.name].params.mandatory
-    for _, v in pairs(tbl) do
-        io.write(string.format("%s: ", v.name))
-        io.write(v.description)
-        io.write(string.format("\n(Recommended value: %s)\n\n", v.default))
+    if tbl then
+        self:printheader("Mandatory Parameters")
+        for _, v in pairs(tbl) do
+            io.write(string.format("%s: ", v.name))
+            io.write(v.description)
+            io.write(string.format("\n(Recommended value: %s)\n\n", v.default))
+        end
     end
- end
+end
 
 function PG.opt_params(self,sp)
-    self:printheader("Optional Parameters:")
     local tbl = sp[self.name].params.optional
-    for _, v in pairs(tbl) do
-        io.write(string.format("*%s*: ", v.name))
-        io.write(v.description)
-        io.write(string.format("\n(Default value: %s)\n\n", v.default))
+    if tbl then
+        self:printheader("Optional Parameters:")
+        for _, v in pairs(tbl) do
+            io.write(string.format("*%s*: ", v.name))
+            io.write(v.description)
+            io.write(string.format("\n(Default value: %s)\n\n", v.default))
+        end
     end
 end
 
 function PG.inputs(self, sp)
-    self:printheader("Inputs:")
     local tbl = sp[self.name].inputs
-    for _, v in pairs(tbl) do
-        io.write(string.format("*%s*: ", v.name))
-        io.write(v.description .. "\n\n")
-    end
-	io.write("\n")
+    if tbl then
+        self:printheader("Inputs:")
+        for _, v in pairs(tbl) do
+            io.write(string.format("*%s*: ", v.name))
+            io.write(v.description .. "\n\n")
+        end
+	end
 end
 	
 function PG.outputs(self, sp)
-    self:printheader("Outputs:")
     local tbl = sp[self.name].outputs
-    for _, v in pairs(tbl) do
-        io.write(string.format("*%s*: ", v.name))
-        io.write(v.description .. "\n\n")
-    end
-	io.write("\n")
+    if tbl then
+        self:printheader("Outputs:")
+        for _, v in pairs(tbl) do
+            io.write(string.format("*%s*: ", v.name))
+            io.write(v.description .. "\n\n")
+        end
+	end
 end
 
 function PG.other(self, sp)
-    self:printheader("Other Functions:")
     local tbl = sp[self.name].func.other
-    
-    for func,params in pairs(tbl) do
-        io.write(string.format("%s(sp_%s %s", func, self.name, self.name))
-        for _,p in pairs(params) do
-            io.write(string.format(", %s %s", p.type, p.name))
+    if tbl then
+        self:printheader("Other Functions:")
+        for func,params in pairs(tbl) do
+            io.write(string.format("%s(sp_%s %s", func, self.name, self.name))
+            for _,p in pairs(params) do
+                io.write(string.format(", %s %s", p.type, p.name))
+            end
+            io.write(")\n\n")
+            for _,p in pairs(params) do
+                io.write("*" .. p.name .. ":* ")
+                io.write(p.description.. "\n")
+                io.write("(Suggested default: " .. p.default .. ")\n\n")
+                
+            end
         end
-        io.write(")\n\n")
-        for _,p in pairs(params) do
-            io.write("*" .. p.name .. ":* ")
-            io.write(p.description.. "\n")
-            io.write("(Suggested default: " .. p.default .. ")\n\n")
-            
-        end
     end
-    io.write("\n")
 end
 	
 function PG.params(self, sp)
@@ -157,4 +165,4 @@
 	PG:other(sptbl)
 end
 
-PG:makepage(sptbl)
\ No newline at end of file
+PG:makepage(sptbl)
--- a/util/gen_index.lua
+++ b/util/gen_index.lua
@@ -1,4 +1,4 @@
-#!/usr/bin/env lua
+#!/bin/lu9
 
 
 file = io.open(arg[1])