Guide for Data Acquisition and Development of Muse EEG Head Band Unity OSC

Muse It is a headworn EEG sensor developed by InteraXon. It uses several dry electrodes to collect EEG data, and can output real-time EEG information after filtering and related algorithm processing. When it comes to the secondary development of this product recently, there is basically no ready-made information on the Internet. After a period of research, I found a method to obtain data in Unity.

1、 Proper noun

Note: According to the idea of this article, you can OSC The protocol implements the function of acquiring Muse channel data in Unity. As it involves development content, this article only introduces ideas and processes, and does not include program code.

Here are some special terms involved in this article.

  1. UDP
    A connectionless Internet transport protocol, called User Datagram Protocol in Chinese. UDP can send packets without establishing a connection, but it does not guarantee that the receiver can receive packets.
  2. OSC protocol
    OSC protocol Open Sound Control Protocol, which is an open, transmission independent, message based protocol, aims to communicate between computers, voice synthesizers and other multimedia devices.
    For the OSC 1.0 protocol and message format, see: http://opensoundcontrol.org/spec-1_0
  3. brain waves
    Brain waves are brain waves. We mainly care about these types of brain waves: Delta Theta、Alpha、Beta、Gamma。
  4. Unity
    A game development engine. In most cases, C # is used to write scripts.
  5. Wireshark
    A network packet analysis software.

2、 Prepare mobile APP

Download the MuseDirect application in the AppStore. The current version is three This version has a hole, which will be explained later.

 MuseDirect

Open MuseDirect, connect the Muse headband in the side menu, and then you can see various data collected by the Muse brain band in the application.

3、 Set Forwarding

In the MuseDirect sidebar menu, select Streaming , to be filled in later OSC PREFIX , this field is used in the path prefix of the OSC protocol, and then filled in as required IP , Port , check last Enable OSC Streaming

 MuseStreaming1

The device numbers of each Muse are different, which results in different prefixes of the OSC message paths generated by the program OSC PREFIX After that, the program will use OSC PREFIX Replace the previous device number, so that even if the Muse device is replaced, the OSC message path remains the same.

According to MuseDirect, OSC PREFIX It is not necessary to add / After filling in PREFIX, the current OSC prefix and path will be displayed at the bottom of the page( The prefix filled in this figure is muse )。

 MuseStreaming02

It seems that everything is normal? Don't worry, the hole is coming. use Wireshark Grab the UDP The data package is as follows:

 MuseStreaming03

In front of the agreed path / What about? Why not? The data path sent is inconsistent with the path prompted in the program, and this inconsistency is exactly the most important separator for parsing messages, wtf?

Therefore, modify PREFIX As follows:

 MuseStreaming2

At this time, there are two paths displayed in MuseDirect / , leave it alone.

 MuseStreaming00f

Grab the data packet again, and the data and path are normal:

 MuseStreaming04

4. Unity development

At present, we can get Muse's OSC Data, the next work is simple, according to OSC protocol analysis UDP packet OK.

The specific parsing code varies from person to person. In short, it is not too complicated. In addition, the data is passed through UDP packet It's not like TCP It is very convenient to handle subcontracting.

Finally, you will receive a bunch of OSC data packets with different paths. They represent different data channels or data types. Select the data processing you want.

The final test effect is shown in the figure:

 Muse EEG data

Zimiao haunting blog (azimiao. com) All rights reserved. Please note the link when reprinting: https://www.azimiao.com/5589.html
Welcome to the Zimiao haunting blog exchange group: three hundred and thirteen million seven hundred and thirty-two thousand

Comment

*

*

Comment area

  1. Could I ask if the 2nd generation Muse head ring is OK? The 1st generation seems to be out of production

    • hare 03-25 23:04 reply

      It's OK to use the APP software.