I'm working on a project that takes touch input from Piezo-electric sensors and turns those gestures into MIDI commands that are sent to an external device. I've worked through all of the nuances of our ADC and have managed to build it out from front to back using a simple "tap" as a command. A "tap" would look something like this
(source: evolver.fm)
And here's what the tap "profile" I built looks like for detection on our DSP chip (in C)
/* Tap Detection Function */
short tap_detect(float *x, int len){
int threshold = 200; //calibration
int taplen = 500;
int i,j;
float y[len];
float avg = 0.0;
for(i = 0; i < len; i++){
if(x[i] < 0)
y[i] = x[i] * -1000;
else
y[i] = x[i] * 1000;
if(y[i] >= threshold && i < len-taplen-20){
for(j = i+taplen-20; j <= i+taplen+20; j++)
avg += y[j];
avg /= 41.0;
if(avg <= 0.2*y[i])
return 1;
}
}
return 0;
}
So my question is, where would I start for writing a similar "profile" for something like a circle? or a swipe? I'm just not sure where to start with this.