connecting BrainBay and OpenEEG to TouchDesigner

BrainBay [url]http://www.shifz.org/brainbay/[/url] is an application that processes data from any OpenEEG-compatible EEG device, such as [url]https://www.olimex.com/Products/EEG/OpenEEG/EEG-SMT/[/url]

Installing BrainBay also installs Neuroserver, [url]http://openeeg.sourceforge.net/neuroserver_doku/[/url] a separate program that routes data via TCP that’s what both BrainBay and Touch need to communicate with.

Attached is a sample .toe and a .con file for BrainBay. You can run this without any EEG machine attached as Brainbay can read data from a file and pretend to be an EEG for testing (as I’m doing while I’m waiting for a little package from Bulgaria!).

[vimeo]http://www.vimeo.com/49529227[/vimeo]

I don’t have the gui fully done but I’ll put the final version in the shared .tox gallery.
I’d also like to figure out ways to automatically detect and recover lost connections etc. (especially in a gig!).

Anyway, here it is in its raw state with some partly-built GUI elements should you feel like messing with them. The connect toggle button is the only thing wired in.

The basic steps to go through are as follows…

  • open both files in their respective programs (assuming you have brainbay already intalled)

  • make sure the /project1/tcpip1 DAT in touch has its enable flag off (the gui connect button will toggle this - off is grey, on is colored)

  • in the BrainBay Network menu, launch Neuroserver

  • in BrainBay’s Design window, right-click the TCP-Sender object

  • in the dialog window that pops up, click ‘Connect’ button

  • the neuroserver window should say “Got connection on client 0”

  • in TouchDesigner, toggle the connect button in the project gui to on (or check the ‘active’ flag in tcpip1)

  • Neuroserver should now say “Got connection on client 1.”

  • run chopexec5 by right-clicking and selecting ‘Run Script’ from the menu
    [*]this should clear tcpip1 then give you the following message:

    [list]message
    200 OK
    200 OK
    2 clients connected
    0:EEG
    1:Display[/:m]
    [
    ]This means that BrainBay is connected as client0 and TouchDesigner is client1
    In Brainbay’s Design window click the ‘play’ button down the bottom to start playing through the data file[/:m]
    [
    ]In TouchDesigner, run the chopexec2 DAT (which uses the ‘send’ command to send the string, “watch 0” (meaning get whatever client 0 is streaming) to neuroserver) and you should see the data coming in from Neuroserver.[/:m]
    [
    ]chopexec3 will stop with the ‘unwatch 0’ command to neuroserver.[/*:m][/list:u]

Some things to note:

  • ‘send’ commands from touch need the -n flag to append the expected \n to the end of messages
  • if touch connects to neuroserver before BrainBay does, the client numbers will be reversed. to avoid this, connect brainbay first, then touch (or be ready to change the client numbers in your commands).
  • I still have yet to read the BrainBay manual properly so there may be better ways to do this - for example, I am only getting two channels out so there’s obviously something else to set up that I’m as yet unaware of (or a show-stopping bug in Brainbay, but I’m assuming it’s my iggerance at this point)

Rod.
t077_neuroserver_client.9.toe (11.9 KB)
test send to touchvia neuroserver.zip (1.42 KB)

1 Like