ftp.nice.ch/pub/next/unix/audio/cmix.s.tar.gz#/cmix/lpc/dcbias.c

This is dcbias.c in view mode; [Download] [Up]

#include "../H/ugens.h"
dcbias(p,n_args)
/* A cmix routine to remove dcbias from a given channel in a soundfile.
 * p0 and p1 are start and dur to test for dcbias.  p2 is relevant channel
 * p3 and p4 are start and dur to remove dcbias. */
 
float *p;

{
long i,nsamps,nchin;
float out[4],average;
	nsamps = setnot(p[0],p[1],0);
	nchin = (int)p[2];
	average = 0;
	for(i = 0; i < nsamps; i++) {
		getin(out,0);
		average + =  out[nchin];
		}
	printf(" average,i = %f %D\n",average,i);
	average /= (float)(nsamps-1); 
	printf(" average = %f %D\n",average,nsamps);
	nsamps = setnot(p[3],p[4]);
	for(i = 0; i < nsamps; i++) {
		out[nchin] = - average;
		putout(out,0);
		}
	endnot(0);
}

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.