Measuring AF7/AF8 asymmetry


Hi all,

novice Unity/C# developer here. I’ve started building an Android game (aimed at GearVR, developed through Unity) aimed at emotional regulation training which includes Muse as a neurofeedback component. I do not intend using the muse preset algorithms as my design is based on emotional valence estimated through pre-frontal hemispherical asymmetry.

My question is, according to you, what is the most efficient way of measuring the AF7/AF8 asymmetry?

Reading the muselib documentation I saw that the libmuse.MuseDataPacket class has a getEegChannelValue member. Being a beginner I’m not sure if using this method would give me a raw data output which I would need to FFT myself or I would be able to directly calculate the relative difference between the AF7/AF8 outputs called this way.

Also, can I take input only from two channels or should I, in some way, reference the others?

If I do not use the presets, would I need to make my own noise-filtering?

Thank you in advance,



Tl;DR update on project; still stuck on getting AF7/AF8 alpha values; difficulty with cross-platform script architecture(/syntax)?; help.

Hi all,

my headband has finally arrived last week and I’ve been actively studying the documentation + the provided android/unity example projects.

I now have a better understanding of the API and the architecture (sorry for the messy and somewhat uninformed first post) but I’m still unable to get the specific data I need.

(Correction: by *presets in the first post, I meant the mellow/concentration algorithms; I now realize that I don’t need the raw EEG values but rather the absolute band values)

Objective: I’m trying to get the alpha_absolute values from the AF7/AF8 channels (eeg.EEG2/3).

Problem: Given that this functionality is not included in the example Unity project, I’m having trouble calling the additional method from the API through the multiple wrappers.

If I understand correctly the code flow goes like so: Android Api -> ->LibMuseBridgeAndroid.cs -> LibMuseBride.cs -> App.cs.

The SampleApp.cs contains this (including only relevant parts):

void registerListeners() {
muse.registerDataListener(, "receiveDataPackets");

void registerAllData(){

void receiveDataPackets(string data) { 
(a 'dataBuffer' variable which updates the UI)

I tried limiting the data to the AF7 channel through:

 void receiveDataPackets(string data) { 
    (a 'dataBuffer' variable which updates the UI)

(or also by declaring ‘getEegChannelValues’ as a standalone method)

But the script couldn’t reference the Eeg enum in that stores the channels.

I then tried to convert the file (+ some other .jar files as mentioned in the above link) in a .jar file but still nothing.

I then tried specifically referencing the relevant API classes and calling the getEegChannelValues() method in LibMuseBridgeAndroid.cs, like so:


(declaring vars)

 public LibmuseBridgeAndroid() {

        unityJavaClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
        unityJavaClass2 = new AndroidJavaClass("com.choosemuse.libmuse.Eeg;");
        unityJavaClass3 = new AndroidJavaClass("com.choosemuse.libmuse.MuseDataPacket;");
        unityJavaClass4 = new AndroidJavaClass("com.choosemuse.libmuse.MuseDataListener;");  

        unityMainActivity = unityJavaClass.GetStatic<AndroidJavaObject>("currentActivity");

        libmuseObj = new AndroidJavaObject("com.choosemuse.example.unity.LibmuseUnityAndroid", unityMainActivity); 

override public void getEegChannelValues(int channelNum)
        libmuseObj2.Call("getEegChannelValues", channelNum);


abstract public void getEegChannelValues(int channelNum);

But it still didn’t show the (Eeg.EEG2) parameter as valid (or maybe I got the .jar file/positioning wrong). Do you have any tips on how to correctly implement/reference a .jar file in this context?

In another project, I saw the following snippet:

(vars declared)

    private final class DataListener extends MuseDataListener {
    public double[] newData;
    newData = new double[4];

    public void receiveMuseDataPacket(final MuseDataPacket p, final Muse muse) {
    getEegChannelValues(newData, p);

    private void getEegChannelValues(double[] newData, MuseDataPacket p) {
                newData[0] = p.getEegChannelValue(Eeg.EEG1);
                newData[1] = p.getEegChannelValue(Eeg.EEG2);
                newData[2] = p.getEegChannelValue(Eeg.EEG3);
                newData[3] = p.getEegChannelValue(Eeg.EEG4);

(update UI)

But being new I’m not sure how to translate it in c# and even if this is what I should be doing (e.g mapping the Eeg channel enum to an empty array first?) and how to properly organize it across the wrappers.

(Unfortunately, the libmuse API documentation is somewhat beginner unfriendly (no examples…) and I fear I may be getting the syntax wrong.)

I would greatly appreciate any help and suggestions on how I could get the alpha_absolute values from the AF7/AF8 only in Unity/c#.

Thank you in advance.




I’m not sure about C#, but in Android Java you would want the below.
I think the mistake you made above was in registerDataListener passing the string "receiveDataPackets", where you should have MuseDataPacketType.ALPHA_ABSOLUTE.

Never use static strings if you’ve got an ENUM option to use.

Also, always check your packet type before you go to process it, otherwise you could get the wrong data type and then it’ll crash.

private void registerDataListeners(){
	//also you'll need a: muse.registerConnectionListener(connectionListener);

class DataListener extends MuseDataListener {
	public void receiveMuseDataPacket(MuseDataPacket p) {
		switch (p.packetType()) {


Thanks for the great advice and for taking the time! That was something I was wondering about. Will try it and will let you know if it works :slight_smile:

Offtopic question: I’ve been using Muse Monitor in the meanwhile (and it’s really a big help and very well done), especially the option which allows me to record alpha absolute from single channels. I noticed however that in the output csv file the values are not expressed in dBs. I was wondering if the program can output the dB values? Or what is an easy way to convert the results?

(In the literature I found this formula: absolute power = 10^10(power in dB/10). Is this the one that is generally used?)

Thanks again for the help.


Bels is just a unit for any value derrived from a log formula. No conversation necessary.