Re: [buildcheapeeg] Filter bank

From: Jim Peters (jim_at_uazu.net)
Date: 2002-01-22 14:21:20


Rob Sacks wrote:
> Users will expect and need to define (at run time) a
> number of bands that they want to boost, reduce, or
> phase-shift.

It should be possible to use the same algorithm to set up a single
filter-chain with arbitrary width and centre frequency.

The only limitation with my current algorithm is that it is designed
for bin-widths of less than an octave (probably less than half an
octave, really).

> And they will want to nudge these parameters up
> and down dynamically, on the fly, while wearing
> the electrodes and actually doing neurofeedback
> (in other words, they will want to change the
> parameters without interrupting the session).

Well, we can do this, but filters take a while to settle, especially
on the lower frequencies. Maybe on changing parameters, you could
quickly put through the last 10 seconds' worth of data to initialise
the new filter, which means the user sees the new filter working
immediately as if it had been on the whole time. That way you can get
your instant changes.

> > This is all coded in integer maths, and I've tested the filter code
> > with impulses of various magnitudes to check the response, and it
> > looks good so far. Input is 16-bit data, which should be good enough
> > for our purposes, I hope.
>
> Good enough? Maybe, I don't know, but why
> not take advantage of the additional accuracy provided
> by floating point?

Because my target is to get this working on my P133 laptop *with*
sound-generation code to go with it (remember this was for a
pitch-shifter). Also, remember that the times multiply up with the
number of channels. And also remember I've got 120 filter chains
running, not just the odd FFT.

Someone can do a floating-point version later easily enough if that is
necessary. That is what open-source is about! If you don't like it,
you can change it!

> Suppose the signal suddenly changes so a new frequency is present.
> How much time passes before the filter bank tells us that the
> frequency is present? Can we measure this time in cycles? Is this
> time the same for all frequencies (when measured in cycles)?

It depends on the width of your bin. Narrow bins give a slower
response than big wide bins. This should all come clear when I've got
this testing application working.

If we're using a log-frequency scale (as I am), then the bin-width is
proportional to the centre-frequency, and so the delay is proportional
to the cycle-length. So the time would be roughly the same when
measured in cycles.

However, if all your bins are the same width (e.g. 4-5Hz, 5-6Hz,
6-7Hz, 7-8Hz, etc), then they should all have the same delay.

I've just done an estimation of the delays for my filter-bank running
at 256Hz:

Centre Delay (secs) Number of cycles
114 14 0.05 6
64 21 0.08 5
32 45 0.18 6
16 95 0.37 6
8 192 0.75 6
4 377 1.47 6

So it looks like roughly 6 cycles at the moment. Using less bins per
octave would give shorter delays, but it would risk there being more
than one frequency in a band, which would stop the accurate
measurement feature working properly.

Also note that this is just an estimate until I get all this properly
tested.

> What is the correct term for this delay that I'm asking about?
> This subject is constantly mentioned in advertising for
> neurofeedback systems... manufacturers brag about their
> "fast filters."

I've no idea what the correct term is.

> By the way, however, from my own experience wearing
> electrodes, it seems to me to be a completely irrelevant
> factor, because I've found that results have to be integrated
> over at least a second in order to be useful for training.

I'd like to avoid long delays as much as possible. For my
pitch-shifter I'd like a quick response. If there is some sudden
activity in the brain, I'd like to hear it as it happens, if possible.

> Does this mean we can extract information for any
> arbitrary frequency band by interpolating the results?

Not by interpolation -- but yes, you could add up the magnitudes over
a number of bins.

Jim

-- 
Jim Peters (_)/=\~/_(_) Uazú
(_) /=\ ~/_ (_)
jim@ (_) /=\ ~/_ (_) www.
uazu.net (_) ____ /=\ ____ ~/_ ____ (_) uazu.net


This archive was generated by hypermail 2.1.4 : 2002-07-27 12:28:36 BST