processingsignal-processingbandpass-filter

How can I apply BandPass filter to EEG data being plotted in Processing 3?


I am trying to apply a 4-35Hz BandPass filter in processing. I explored the Sound library but I think it is strictly limited to audio files.

Is there any library for fast implementation of signal filtering in Processing? I found this-- https://github.com/berndporr/iirj -- but since this is an external library for Java -- importing steps are not very clear. Please share your insights.

Appreciate your time. Many thanks.


Solution

  • I'm surprised the Sound library doesn't expose the data arrays easily.

    I recommend using the Minim library in Processing. It should be simpler and come with plenty of examples. What you're after is Minim's BandPass filter and there's already a BandPass example.

    You can access it via Processing > Examples > Contributed Libraries > Minim > Synthesis > BandPassFilter once you install the library (if it's not already there).

    The demo is audio focus, but you should be able to pass a float[] signal to one of the available UGens and pass that to the BandPass filter.

    Regarding the IIRJ library, as you can see in the readme, there's a link to the MavenCentral repo where you can download the compiled jar library

    Drag and drop that .jar file into your Processing Java sketch and you should be able to test importing the library:

    import uk.me.berndporr.iirj.*;
    Butterworth butterworth = new Butterworth();
    

    Next up you'll need to download an unzip the javadocs and see how this library expects the 1D signal coming in