Library to apply BandPass filter for EEG signals in Processing

actually a low pass filter might do it,
but filter 50 but get 30 [Hz] is not so easy
( you have to live with loss in amplitude and phase shift ( late ) )

but you not answer much questions,
so still not know if you have batch data to analyze, or stream?

you also possibly can not afford to use cpu demanding calculations.

so why not just try the most easy filter ever!

fil = inval * A + fil * B;

ok, there are some small things about that:
-a- tuning:
A + B = 1;

-b- init:
a startup is difficult for any filter, so
fist line could be
fil = inval;
to avoid big error at beginning.

// low pass filter
// numeric recursiv filter first order

float inval, fil;
float A=0.1, B = 1.0 - A;
int xpos=0;

void setup() {
  size(600, 200);
  inval = height - mouseY;
  fil = inval;
  frameRate(10);
  background(200, 200, 0);
  println("reading mouseY");
}

void draw() {
  inval = height - mouseY;
  fil = inval * A + fil * B;
  strokeWeight(2);
  stroke(200, 0, 0);
  point(xpos, height-inval);
  stroke(0, 200, 0);
  point(xpos, height-fil);
  strokeWeight(1);
  stroke(200, 200, 0);   // clean line in front:
  line(xpos+1, 0, xpos+1, height);
  xpos++;
  if (xpos > width ) xpos = 0;
}

2019-01-22_19-37-51_snap

2 Likes