Frequency Transformed Data

As the sensor data from the interactive costume is likely to contain noise a Fourier Transform might help to reduce noise in the frequency domain. To prototype and see if this data shaping is advantageous I implemented a FFT on the 6 sensors. I am using the minim library for processing as this allows to visualize the data from the analog sensors. Moreover within the electronic textile community processing and arduino are the most known tools which is why other creators might be interested in this approach for their own projects. In future iterations of the prototype the FFT could be already implemented in the hardware.

FFT

 

 

//////////////////////////////////////////////////////////////////////////////FFT CLASS/////////////////////////////////////////////////////////////////////////////
import ddf.minim.analysis.*;
import ddf.minim.*;
class myFFT {

  myFFT (int Port) {  
    APort = Port;
  } 
  Minim minim;
  FFT thisFFT;

  int lastData, minData, maxData = 0;
  int APort; 
  int bufferSize=128;
  float[] sample;
  ArrayList<Float> FFTarray = new ArrayList();
  void setup() {
    minim = new Minim(this);
  thisFFT = new FFT( bufferSize,50000); //  FFT(int timeSize,float sampleRate)

  }
  void update() {

    //fft fill buffer
    sample = new float[FFTarray.size()];
    for (int i=0; i<FFTarray.size(); i++) {
      sample[i] = (float) FFTarray.get(i);
    }
    if (FFTarray.size()< bufferSize) {
      float t = map(lastData, minData, maxData, 0, bufferSize);
      FFTarray.add(t);
    } else FFTarray.remove(0);

    if (sample.length==bufferSize) {
      noStroke();
      fill(30);
      int yHeight = (height/6)*(APort+1);
      rect(width/2, yHeight-height/6, width, yHeight);
      stroke(APort*42, 255-APort*42, 150+APort*20);
      thisFFT.window(FFT.HAMMING);
      thisFFT.forward(sample);
      
      for (int i = 0; i < thisFFT.specSize(); i++)
      {
        float x = map(i, 0, thisFFT.specSize(), width/2, width);
        line( x, yHeight, x, yHeight - thisFFT.getBand(i)/120.0);
      }
      fill(APort*42, 255-APort*42, 150+APort*20);
      switch(APort) {
      case 0:
        text("Bein R: "+ APort, width/2 + 10, yHeight- 5);
        break;
      case 1:
        text("Bwin L: "+ APort, width/2 + 10, yHeight- 5);
        break;
      case 2:
        text("Hand R: "+ APort, width/2 + 10, yHeight- 5);
        break;
      case 3:
        text("Hand L: "+ APort, width/2 + 10, yHeight- 5);
        break;
      case 4:
        text("Ellenbogen R: "+ APort, width/2 + 10, yHeight- 5);
        break;
      case 5:
        text("Ellenbogen L: "+ APort, width/2 + 10, yHeight- 5);
        break;
      }
    }  
  }
  void updateData(int last, int min, int max) {
    lastData = last;
    minData = min;
    maxData = max;
  }
}


Accelerometer Based Gesture Recognition Using Fusion Features and SVM: http://www.jsoftware.us/vol6/jsw0606-12.pdf