neuromore / Max Neurofeedback dataflow example

edited December 2015 in Software
There is no neurofeedback software for OpenBCI other than Brainbay and BioEra. Both are quite old Windows apps and I have been a staunch Mac user for 10 years now so in the absence of a proper app some coding and visual programming will be necessary. It's to be expected with an open hardware project anyway. My board hasn't arrived yet but that didn't stop me from getting started with software programming, starting with a single channel alpha protocol and binaural feedback.

I am using Neuromore studio to process the EEG data and provide OSC streams of numbers. The two I need for this protocol are Alpha gain, and Alpha dominant frequency.

image

With these two streams of data I can generate the feedback I need, tracking both the frequency and magnitude of my alpha activity. Max/MSP is used to turn this information into an audio signal.

image


My base binaural frequency is 264 Hz which is entered in a box near the top on the right hand side. The incoming alpha frequency (osc-route /output/1) gets divided by two, and either added or subtracted from 264 depending on the side. This is so that the pitch is changing equally on each side and the one channel drifting up and down is less distracting. The result of these two signals when played left and right is that the frequency of the binaural beat they create is being dynamically altered by the domains frequency signal from Neuromore.

At first the frequency data was coming from Neuromore as integers and the changes in frequency were very obvious as steps. I smoothed the signal and multiplied it by 200 before sending it to Max. When it got there it's divided again by 200. The result is a very big resolution of 6 decimal places for the dominant frequency, and so the frequencies drift rather than step making it feel much more natural.

The magnitude data (osc-route /output/2) controls the volume of the binaural signal, and there is a 'handicap' makeup gain slider which adds to the magnitude of the alpha signal and would get lowered as training progresses and alpha magnitude increases.

Whilst this is a very simple protocol it's also going to be extremely effective at training alpha as it gives direct information on the frequency we are trying to train and the current magnitude of that frequency. The brain then uses this magnitude data as a reward and the binaural beat guides the brain toward the state we want

The neurofeedback software chain involves capture, DSP, threshold control, feedback and data logging - all but the latter are present in this example. (the data logging can be as simple as noting the value of the handicap amount at the beginning and end of a session). If you understand how a protocol needs to be wired, it's just as easy to make it in Max as it would be to make it in BioExplorer but with much greater flexibility for nesting designs and a fantastic tool for creating touchable control interfaces.

I know very little about neurofeedback protocols, but a lot about building audiovisual software and would be very keen to work with anyone who can help me to understand more about techniques and training conventions.


Comments

  • edited December 2015
    Neuromore is going to be awesome for performance training, and it's a beautiful piece of software that easily talks to the available dry electrode headsets however I do not like Neuromore per se. It's unnecessarily graphics intensive, still buggy, you can't save your work locally and it's future availabity and pricing is currently uncertain. Whilst it can display data it kills the CPU It's just convenient because it runs on OSX and has the OpenBCI driver built in. 

    I think that OpenVIBE is a better bet for this part of the process. It's just as powerful, and supports OSC but could be run on a tiny Linux headless linux machine which just forwards smoothed and quantified data of all types over LAN to the protocols and media rendering. I am about to pick up a small Intel NUC mini PC to test this out.


  • wjcroftwjcroft Mount Shasta, CA
    edited December 2015
    @spektrolyte, cool post thanks.

    What is the UDP packet rate coming out of neuromore in this situation? Sometimes VPL element blocks run at the same sample rate as the EEG amp, in this case 250 samples/sec. Do the FFT or smoothing blocks reduce that to a more reasonable rate? 500 packets per second might be a lot.

    A consideration in feedback applications is the latency between the signal processing and the actual feedback changes presented to the client. Do you have any idea what that latency is, in this case? It would involve processing and digital filter / FFT delays in neuromore, Max, and network delay components. Ideally many neurofeedback applications aim for latencies less than 300 milliseconds. Since FFT induces longer delays than digital filters, many applications opt for designs based on filters for the mainline data flow. Although FFTs and spectrograms might be utilized for monitoring purposes.

    I assume you've seen the BrainBay neurofeedback tutorial at,

    https://sites.google.com/site/biofeedbackpages/brainbay-openbci

    Most alpha reward protocols just reward on amplitude in the 8-12 hz band. Individuals vary in their alpha peak frequency, but it's generally at 10hz. Another common component is to inhibit or alert the client if he is producing too much beta, say 15-20 (beta2) and 20-30 (beta3). If the user 'tries' too hard or becomes hypervigilant, it can 'look' like increased alpha, when in fact the beta increase will have a negative impact.

    Neurofeedback and protocols are a huge area, some references here,

    http://openbci.com/forum/index.php?p=/discussion/402/free-neurofeedback-applications

    The Intel NUCs are great, let us know how that goes.

    William

  • wjcroftwjcroft Mount Shasta, CA
    edited December 2015
    > There is no neurofeedback software for OpenBCI other than Brainbay and
    BioEra. Both are quite old Windows apps and I have been a staunch Mac
    user for 10 years now...

    I wanted comment on the 'old' label on BioEra. You're correct on BrainBay, it has not seen much development in recent years, although the source is completely open; which can be an advantage for extensions.

    BioEra on the other hand is maintained by Jarek Foltynski, and is contantly updated. Almost new releases and revisions / additions each week. Rapid response to questions and queries. I'm using it right now for an OpenBCI design, works great. BioEra is also the basis of a number of up to date commercial packages such as LENS (Len Ochs), Cygnet (Othmer protocols), etc. One of our OpenBCI users and neurofeedback practitioners George Martin, uses it as well. BioEra can also run under Parallels or VirtualBox, when used with the included license dongle.

    William


  • wjcroftwjcroft Mount Shasta, CA
    edited December 2015
    Here's a related thread by @AdamM and Isa @brain, on their blog, Autodidacts,

    http://www.autodidacts.io/binaural-beat-openbci-eeg-experiment/

    One other aspect that LENS, HPN, Flexyx, etc. emphasize: (These are all protocols based on measuring EEG dominant frequency, and then reflecting it back via light, sound, microcurrents, etc.)

    Is that there is a slight chance that driving the EEG through external frequencies at the EEG dominant frequency, could potentially induce or amplify seizures. More so in the case of individuals with this tendency.

    So to be safe, they always add an adjustable offset to the measured dominant frequency before reflecting it back in some ways. (LED goggles were used for the early Flexyx. Later LENS switched to a nano tesla PEMF scheme. HPN is using is using nano current pulses delivered to the scalp at the sensor locations; with some simliarities to tACS.)

    The reflected dominant frequency is not attempting to "guide the brain toward the state we want" (as you considered in your 1st post.) Rather the dominant frequency plus offset is attempting to inform the central nervous system (CNS) what kind of frequency band it is hanging out in, and give it the chance to breakup or go away from those habitual patterns. We basically trust the intelligence of the CNS to see this mirror reflection and make adjustments that will increase the resilience and adaptability of the system as whole. Releasing old patterns. We're not trying to force or drive the EEG to a particular desired frequency.

    This of course differs from alpha amplitude training, where we reward for the whole band. Although protocols do exist where it is attempted to raise the alpha peak frequency if it is in the low range.



  • The dominant alpha binaural approach was taken directly from one of Hardt's alpha training papers, so that I had a focus for programming a Max patch to be used for feedback generation. i.e. turning brain data into useful noise. In this case it guides the brain (sticks up a sign), pointing toward the alpha state we are looking to increase, from what I understood that was the point of using the dom. alpha frequency.

    The seizure thing is interested but I would expect that to be more related to SMR as raising amplitude there has been noted to improve epilepsy.

    Oh and by "old" I meant in terms of the use of framework (.net etc.), not as in abandoned. Something written in C++ or another cross-platform language would probably be more appropriate nowadays.
  • wjcroftwjcroft Mount Shasta, CA
    Hardt has many patents. This dominant frequency idea is an old one and used in MANY older related patents, especially those from Len Ochs and Carter. All of these use the offset idea. With the offset, the dominant frequency feedback is in fact a DIS entrainment idea, not entrainment. It encourages the brain to leave old entrenched patterns and try to move into new territory. As far as I can see from all the Hardt documents I've read, he does not use binaural beats at all in his initial training levels. Perhaps this is just some patent territory he wanted to stake out, since he is well aware of Carter, Ochs, etc.


  • wjcroftwjcroft Mount Shasta, CA
    edited December 2015
    Take a look at this first photo, it's the chamber setup he uses,


    If he was indeed using binaural beats, it would be sound isolating headphones or in-ear phones with tight fitting plugs. Instead he uses 4 speakers.

  • The reason that i created a binaural beat patch is because I read about that technique in a Hardt paper. Therefore at some point he used binaural beats but obviously not in the article above. What are you trying to prove? That I don't know much about neurofeedback? I said that in my initial post :)


Sign In or Register to comment.