Butterworth Filter Demo in Shiny

less than 1 minute read

Published:

I use EEGLAB to process my electroencephalographic data (that is, the brain’s electrical activity), but I wanted an interactive visualisation to show how different filter settings change the signal. I prefer R to MATLAB, so I built a Shiny app to do exactly that.

The idea was to filter brainstem activity recorded during several speech conditions using a Butterworth band-pass filter, to strip out the artefacts.

I wrote a butterHz function, based on butter_filtfilt.m from the EEGLAB MATLAB package, which in turn uses the butter function from the signal R package.

To demonstrate the filter in action, I used a time-domain waveform of speech-evoked auditory brainstem responses.

The code is available on GitHub.