2 Neurofeedback

Simple alpha neurofeedback

This second design shows a simple neurofeedback data flow. The input channel is measured for it's amplitude in both alpha and beta bands. Then audio feedback (a reward) is given in the form of the volume level of a "flowing water" continuous audio mp3 track. The louder the volume, the more alpha is being produced. The beta amplitude is also taken into account and will cause reduction in the volume level. Thus the technical description of this would be that the neurofeedback is "rewarding" alpha and "inhibiting" beta.

Right click to download on your desktop the .con file from this link. Do the same for the audio track here. The design file is named "alpha-stream.con". It rewards (uptrains) 8 to 12 Hz alpha and inhibits (downtrains) beta at 15 to 30 hz. Alpha band is traditionally at 8-12. Beta at 15-20. Hibeta from 20 to 30 Hz. So we're inhibiting beta and hibeta together. Hibeta is more associated with muscle tension, anxiety or hyper-vigilance. 15-20 beta corresponds with active mental thought processes, concentration, or motor activity. So the overall intent of this neurofeedback training is to relax and enter a more meditative state with less active thoughts. If you already are familiar with meditation or placing gentle mindful attention on your breath, those processes will synergize with the training effects.

Note that in all neurofeedback, the object is not to mentally 'strive' to produce a result or get more rewards. Instead neurofeedback and biofeedback encourages us to simply relax and allow the CNS (central nervous system) to listen to the sounds or feedback at an unconscious / subconscious level. The cellular intelligence in that system knows how to interpret the feedback and make the adjustments it needs to come into better self regulation and homeostasis. It's really out of your conscious control, so you can "get out of your own way" and just relax listening to the feedback. In this case with your eyes closed of course because that produces more alpha.

Start Brainbay and Load the .con file. The main window looks like this, click to expand:


Starting at the top of the window, the 1st scope pane shows three live EEG related signals, each horizontal time division is one second. The top graph in that pane is the raw EEG, scaled so that 80 uV corresponds to the plus and minus maximum graph lines.

The scaling of each input pin of a Brainbay element block (such as Oscilloscope), can be adjusted independently. This is what we did with these three input pins. We adjusted the scale by right clicking separately on each input pin, then adjusting the full scale values in the pin dialog box. This has already been done for a number of elements in this con file. For this top scope with 3 graphs, their full scale values were set to 80, 20 and 20 uV respectively. The 'Gain' inside the scope block was left at 100%.

The next graph down is the same live EEG, but filtered to only show the alpha band. Scale on this graph is 20 uV full scale. The last graph in this pane is the Magnitude (or Amplitude) of the microvolts in the alpha band (what we are rewarding) MINUS the beta inhibit band magnitude.  So that you can see on this graph that it peaks up corresponding to when the alpha portion is increasing. But also can go below the 0 uV line if beta amplitude is strong. There is also a small amount of averaging / smoothing going on between the 2nd and 3rd graphs, so that explains the slight time lag you see.

The second scope pane shows what are called Trend lines for a much longer period of time. In this case about 19 minutes time period, full scale to the right. Trend lines are used in neurofeedback to estimate how much learning or training has happened in the course of the session. Or over a series of sessions.

The first graph shown in this pane is plotting the alpha band average amplitude. Only a few minutes is shown of this session, but you can see that the amplitude is slowly trending upward. Until the last few seconds when I opened my eyes. It's not that much of an upward trend, perhaps just a microvolt or two, but does show the effect of the neurofeedback training. Even at small timescales. 

In a neurofeedback training environment, sessions are run say a few times per week. Window snapshots of the Trend line graphs for these sessions are kept for reference in a file folder for that user & protocol being trained. This way you can scroll back and forth through the series of training sessions to see what degree of training and progress has been achieved. Another way to track this is to simply record the start and end values in uV each session, of the magnitudes that are being trained.

The second graph in the second scope pane shows another trend line for the beta-hibeta activity. The last pane shown is a spectrogram at the bottom of the window, setup like the spectrogram in the first example. Bottom right is the Design pane. Which we will zoom into, in the next section.

Signal flow

A closeup of the Design pane looks like:


The signal flow is similar to the first example, in that EEG samples flow from the EEG block through various filtering and processing stages -- as the samples move towards the final output blocks.

The first block after EEG channel 1 is the same .5 to 40 Hz bandpass filter we used before. This is needed always for the reasons explained in the first section (removal of DC and mains line frequency). After the initial Filter, the stream branches out to five blocks. Here is where each of those streams go, starting at the wire at the lower left and going around counter clockwise:
  1. drives the FFT / spectrogram, as we saw before.
  2. gets filtered to 8-12 hz only, and drives the 2nd trace on scope #1.
  3. drives the 1st trace on scope #1.
  4. computes the magnitude of the beta band, 15-30 hz.
  5. computes the magnitude of the alpha band, 8-12 hz.
Here's the dialog box for the alpha magnitude block, which shows a center frequency of 10 hz, and "half-width" of 2 hz, so 10 +- 2, 8-12 hz:


After the alpha and beta magnitudes are computed, the signals each go through separate averaging blocks. These are running averages that are set at ~ 300 milliseconds each. Generally neurofeedback programs time average the raw values for a small amount of time such as this. This is in order to smooth out some of the jaggedness of the raw signals before being presented as feedback.

After the Averagers, alpha and beta magnitudes are plotted on the Trend scope. This scope is like other scopes you've seen, except the "Drawing Interval" inside the dialog box has been changed from a small value such as 1 or 2 samples, to 250 samples. This means that on the Trend graph, points will only be plotted every second. Accomplishing the long term view we are looking for.

The output from the alpha Averager goes to an Expression Evaluator block, to the A input. This block can compute any arbitrary symbolic arithmetic expression, which is entered in it's dialog box. In this case it is computing "A - B": the magnitude of the alpha MINUS the magnitude of the beta (scaled). As you can see the beta does not go to the evaluator directly, but is first scaled by the block labeled "beta weight", which is a Mixer block.

The Mixer takes it's channel 1 input (averaged beta magnitude), and multiplies it by a scale factor. In this case 65% or .65. This is an arbitrary value we are using, but is intended to compensate for the relative sizes of the two bands we are comparing. The beta range we are measuring includes 15 Hz of bandwidth, whereas the alpha range is only 4 Hz. Without some reduction in the beta "weighting", it would tend to swamp out the alpha effects.

So the Mixer control can be set wherever it feels comfortable for you. When set at 0%, then no beta inhibition is being used.

After the "A - B" expression evaluation, the output of that expression can go negative if the beta outweighs the alpha. We want to limit that output to positive values. Particularly since this value is going to control the audio volume control. So the Limiter stage following the expression, prevents the value from dropping below the value of 2 microvolts.

This low limit will also be the "background" level of the "flowing water" creek sound, when no reward is being given. In other words, we don't want the feedback sound to simply disappear when no reward is preset, but to always have a background sound / 'soothing' effect. If the sound abruptly disappeared, this would be jarring.

Output of the Limiter goes to another Expression, where the microvolt value is multiplied by a constant of 40. This gets us into a reasonable range for the volume control on the MediaPlayer block.

Designs based on the Threshold object

The design example here uses a direct live feedback based on audio volume. This is actually quite intuitive and readily understood by the CNS. It's more aligned with those forms of feedback that are not "pushing" the system in one way or another. But rather have a more "reflective" approach to just "mirror" back to the CNS what is going on. And let the system itself adapt and make the changes it desires.

Another approach that is perhaps more widely used in the neurofeedback field is to use what is called a "Threshold". BrainBay has an object like this. A threshold measures a certain magnitude being trained, and dynamically adjusts a threshold level. So that the output of that block (what is called the reward signal, a binary value) -- is always rewarding at say a 70% rate. If the magnitude slowly increases over time, the threshold will track it automatically and still only reward at the 70% rate.

You can read more about the Brainbay threshold object in the manual. Brainbay's version of threshold is somewhat more complex and hard to understand than that you would find in Bioexplorer for example. But is capable of similar functions.

A downside of thresholds is that their output is generally an on/off type of trigger signal. This is fine, and can be used with a sound such as a bell. Or to control the brightness level of a video playing.


Running the design:

If the bottom window button / status area ever becomes hidden, you can re-expose it with F6 function key.

As before with the previous design, you need to ensure that your COM port is set in the EEG block. Open it with a right click and use the pulldown to set that to the correct port. Click the Connect button, and that should result in the checkbox coming on.

Your channel 1 sensor / electrode should be as before, for example at O2 or Pz, etc. Reference and Bias at left / right ears or mastoids. Dongle inserted, blue light showing on. Then OpenBCI powered up with it's blue light on.

The MediaPlayer block needs to be setup with the audio file you downloaded at the start of this page. Right click on the MediaPlayer and press the "Select MCI File" button. Point it to the Serene Water mp3 file.

You may want to keep your Brainbay media and con files in a constant fixed location rather than your desktop. That way the "C:\xxx" path will not change and need to be updated in the con file. So you could setup such a folder, for example in C:\BrainBay" or wherever is convenient. And place all these con and mp3 files there.

BrainBay installation does create a set of folders in %LocalAppData%\BrainBay . But this is sometimes hard to navigate to. That '%' environment variable corresponds to:

Windows XP: C:\Documents and Settings\<username>\Local Settings\Application Data
Windows 7+: C:\Users\<username>\AppData\Local

After setting your COM port and media file in the design, you will want to save the con file as a new file name to preserve your changes. Otherwise you would have to make these changes each time you load your design.

Once you are ready to start the training, just press your Play button at the lower left and close your eyes. Relax as much as possible. There is no trying, just 'being'. Another approach used by Les Fehmi's Open Focus training, is to imagine the quality of 'space'. This spaceousness produces abundant alpha.