Bandpass Filters on EEG
I wonder whether I could get some help concerning the use of bandpass filters on a complex EEG raw data signal. Earlier, I received some help from Mudang (http://www.cycling74.com/forums/index.php?t=rview&goto=181702#msg_181702) and now I am comparing his patch with an other approach (ffb~).
The results (amplitudes of bands) I get, are not similar and when looking at the spectrum get with an external fft object [IbvaGet~] the result differs again.
I attach the project file(s) with saved EEG data (1 min) in order to demonstrate the above. If anyone is interested in helping me with some hints, I will appreciate it.
Thank you in advance,
Great to hear, that you’re still active in this interesting eeg thingie.
Just wanted to say, that the patch isn’t originally by me, but taken from the classic-vocoder example, that comes with max.
And your post is missing a patch (freq_analyzer_1.maxpat).
I’ve been taking a look at your bandpass filter patches. To test these more fully, you might want to consider generating a sine wave reference signal so you can compare the methods at a single fixed frequency. I did this with a cycle~ object.
I found that the settings on the fftb~ object needed to be adjusted. If you change the third parameter to an H, you should get equally spaced frequency bins. This is the way most EEG fft data is displayed.
The fftb~ seemed to have attenuated response below 4Hz (assuming the amplitude cycle~ object is constant at low frequencies). I’m not sure why. Perhaps someone closer the the actual code could comment on the algorithm. It was probably not intended for such low frequencies.
I have not had a chance to try the bandpass filters yet, but the change in the ratio parameter to H may produce closer results between the two methods.
Thank you for the replies. I am adding the missing file (freq_analyser_1.maxpat).
Mudang, oh yes, brainwaves will be used sooner or later in many devices, so why not? :)
Using the 'reference cycle' on its own or adding it to the EEG data suggests, that both analysis tool works (attached picture). I also changed the third parameter to H, though now I am not sure how the harmonic series assigns frequencies to the banks. However, maybe with my low frequencies the H gives me more or less the same ratios than the argument 2:
fffb~ 15 2 2 30
fffb~ 15 2 H 30
Hopefully, by tweaking on the Q factor and having the [slide] object for smoother data, I will be able to receive similar results.
I think to solve the problem I will have to understand the differences between the signal and float. As far as I understand, the EEG I receive is a float, which I have to convert into a signal with [sig~] in order to be used with both analysis spectrums (vocoder vs ffb).
But, when using the [ffb~ ] the subpatch first saves the EEG data/float into a buffer, 120 sample rate and it is this buffer that gets read by using [phasor~ 1.] into [ffb~]. So in my understanding the EEG data transforms from being a float into a signal.
To use the 'reference cycle' to test the ffb part, I need to transform the the signal into a float, and this is the part where I go really confused:
If I have a signal for instance [cycle 10] and use a [number~] to make it into a float, will this number represent the same data? When I use a [sig~] object on this float to make a signal again… I don't think I get the original back data back. At least this is what the spectrums suggest in the patch and what I get on a simpler spectroscope~ :
----------begin_max5_patcher---------- 697.3oc2VsrbaBCEcM9qPCqcxnWfgtqeGc5zACJNpCHw.xsNMS72d0CHFGiC xXWunavQJ2Gm6Q2WutHHbsbGqMD7Ev2.AAutHHvdk4hftyAgUY6xKyZshE1V yxUMx1bYMae3RmD0MrVlPko3RwOZzB3rHgfeDtDfSSL+.69.9dmVhsUbQISY MLt6xBYUFW3z2pABBGpDuvBC45e9.M7fgjaU8VB1CpLU9ybwlA.BEQr.JhZs L0hKJ0XdiNusXg4yROoBsaWyZlhDPIwVeho9SBCBRx3AI9SBxibHBsxdZnOq jErgF4IoPIxpr2E90FdVYuS4BEq4W5yFoMX2csCHpWpYNWF1x2HLZABepTlo ARuqz+C6ax6pZ7UK+OVEQnGiRiPIqlA4q8ilQBGiEQmxh34xhnHjiEomvhmm 0NgdbjhlcVmI1DdjEdmKzkJyIGj8ac706XEamxUkx2r2WtAMN2fllaRroVDx 0PMcYN2RNIWVUoKDOgT1VWjoXf9bZ8enQMnhWVxaY48hWxErb4VgZXBxjbH7 xaFggqb82RM+jZyyHTuXwaQhywMulpMTZ7EWAkj3pbP+O2F5b4ZM5BcF.Bdv L9x2JQJ5xmngsYOIvACz7rT7FjDM5x.W6Xcb5bYAB7lLVe7Vp4ujWx1qwsuk Lj3KtwJwVqDCO78eRa0qHe201v2DZxku8hiBv1mvts0HyiB3hQF4ZdNykkxl tDmA6jEQhShRVZtabZiNqZj5LAqzWBKYFc.hb6o3J.rwBAQ9PtuMfri19vx9 VCZt+3HnUtsIumH6VR.bfVJXsJtvto6.YnGIyy7hBlXH3q3E0R8qRGDNSw4s DQj6JhvdfHzcEQlo1.zDPBeWgDg3y6V78ESwdfIyXoQwDZbLQ0cT5WqCgfG1 wq6PjqtkjXDyb3dDDoWCwpO71h+BCKasYB -----------end_max5_patcher-----------
I assume this (making a float from a signal) will effect the outcome.
I am sorry if I could not be clearer, thank you for you help so far.
All the best
I am adding files (ha, too many post, sorry) :