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

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

#include "/musr/H/ugens.h"
#define RESIDAMP     0
#define RMSAMP       1
#define THRESH       2
#define PITCH	     3
#define MAXPOLES 32
float deviation(frame1,frame2,weight,throsh)
float frame1,frame2,throsh,weight;
{
	float c[MAXPOLES+4];
	int i,j;
	float diff,xweight,sum;
	xweight = sum = 0;
	for(j=0,diff=0,i=(int)frame1; i<(int)frame2; i++) {
		getfr((float)i,c);
		if((c[THRESH] <= throsh) || (throsh < 0.)) {
		sum += ((ABS((c[PITCH] - weight))) * c[RMSAMP]);
		xweight +=  c[RMSAMP];
/*printf("%f %f %d %f %f\n",sum,xweight,j,weight,c[PITCH]);*/
		}
	}
	return(sum/xweight);
}

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