Muse + LSL: More detailed information and MuseIO Options


#1

Hey there,

I’ve been playing around with connecting Muse to different kinds of BCI Software (mainly BCILAB) via an acquisition programm I’ve written in Java. It basically gets the OSC /muse/eeg messages and pushes the values to the Lab Streaming Layer, from which it can be read into BCILAB or OpenViBE. I’m trying to connect Muse to a P300 Speller that way, and it feels like I’m getting close.

Today I saw that MuseIO now supports Output to LSL directly, which is great!
What would be even better is if someone could update the LSL options at
https://sites.google.com/a/interaxon…d-line-options
with information regarding, for example, the Channel Labels ( are they sent as meta data or at all?), the “send mode” (sample by sample vs. chunks), source id etc.
One problem that I personally have with streaming from MuseIO via LSL, is missing an option to turn off the accelerometer LSL stream off entirely ( I don’t need it for my experiments).

Is it possible for the dev team to add such an option to MuseIO in the near future?
I would be more than thankful!

Cheers,

curiousHybrid


#2

Hi curiousHybrid,

Glad to know someone out there is working with Muse and LSL+BCILAB. Have you used the LabRecorder program that works with LSL? I’m trying to use it to record offline data to see if I can use the Muse for my experiment.
https://code.google.com/p/labstreaminglayer/wiki/LabRecorder

I’m curious if you’ve used it because when I connect Muse-io to LabRecorder to record the LSL stream the timestamps for the EEG and accelerometer streams (and marker streams from SNAP, if using) are not synchronized. https://code.google.com/p/labstreaminglayer/issues/detail?id=35

I determined with LSL people that the issue lies with muse-io or LabRecorder. Have you run into any similar problems?


#3

Hey homhomhom,

actually I have been using LabRecorder to record the EEG and Marker Streams and imported the resulting xdf files into EEGLAB / BCILAB.
I didn’t come across your issue until now because my setup is as follows:

  1. Receive EEG data from Muse via OSC messages in Java program and push them to LSL EEG Outlet
  2. Send stimulus markers from my experiment to LSL marker outlet (also in Java)
  3. Record in LabRecorder and Import to BCILAB / EEGLAB

As far as I can tell, the timestamps match okay for this.

I did also record the data sent from Muse to LSL and my experiment markers simultaneously and ran into a problem that I didn’t investigate further until I read your post:
I couldn’t see my markers in the “Plot -> channel data (scroll)” output window in EEGLAB.

I have now set up a LSL Stream Inlet in my Java Program to receive samples directly sent by Muse and logged some of the info:

Pull timestamp: 775.864104
samplef 0: 404.66516 ts: 883125.5383791
samplef 1: 894.8693 ts: 883125.538398772
samplef 2: 398.08524 ts: 883125.538422293
samplef 3: 1075.8171 ts: 883125.538443248
samplef 4: 7.787166E-38 ts: 883125.538480026
samplef 5: 7.181873E25 ts: 883125.538503547
Pull timestamp: 775.864104
samplef 0: 430.98486 ts: 883125.53861602
samplef 1: 868.5496 ts: 883125.538635264
samplef 2: 371.76556 ts: 883125.538654936
samplef 3: 1207.4155 ts: 883125.538675036
samplef 4: 7.787166E-38 ts: 883125.538704971
samplef 5: 7.181873E25 ts: 883125.538738756

samplef 0-5: values of EEG channels
ts: Timestamp as returned by LSL.local_clock() call
Pull timestamp: timestamp returned by LSL.StreamInlet.pull_sample(), which represents the “capture time of the sample on the remote machine, or 0.0 if no new sample was available” (see also: https://labstreaminglayer.googlecode.com/hg/LSL/liblsl-Java/javadoc/index.html)
=> This is where the problem is I guess

I guess this is not an issue with LabRecorder.


#4

Wow, interesting that the problem is not confined to LabRecorder.
I have colleagues that have used LSL with EEGLAB with other hardware successfully.
I wonder if the problem could be with how muse-io calls the LSL push sample function.


#5

This is another method description in LSL.StreamOutlet:
public void push_sample(float[] data, double timestamp, boolean pushthrough) Push an array of values as a sample into the outlet. Each entry in the vector corresponds to one channel.
Parameters: data - An array of values to push (one for each channel). timestamp - Optionally the capture time of the sample, in agreement with local_clock(); if omitted, the current time is used. pushthrough - Optionally whether to push the sample through to the receivers instead of buffering it with subsequent samples. Note that the chunk_size, if specified at outlet construction, takes precedence over the pushthrough flag.

   I think that you're right, there must be something odd happening with Muse's local timestamps when the samples are pushed to LSL.

Judging by the sign being negative at times, maybe it is some kind of offset from Muse’s local time, event though I don’t believe it’s in seconds :wink:

I think I also remember getting some weird numbers in the CSV files i created with museplayer when I started out, but didnt investigate further. I will have a look into this in a bit.


#6

Hi CuriousHybrid,

I have a favor to ask-- would you mind sharing the code you used to forward OSC messages from Muse-io to an LSL stream? My Python implementation of this patch isn’t working and I’d like to just get a confirmation that this workaround can solve the timestamps issue.


#7

Here you go: https://github.com/StefanieStoppel/Muse-OSC-to-LSL
Hope that helps :slight_smile:


#8

This thread is rather old, but I one of the developers of LSL and I have just now had a chance to use the Muse headset with the muse-io --lsl-eeg program. This is not at all a satisfactory LSL plugin. Indeed, as curiousHybrid points out, there is no way to avoid recording accelerometer data. Furthermore, and much worse, the timestamping of the accelerometer data is somehow being done improperly. I can’t determine how this is happening, but it is. Once LibMuse is available for desktop use, I can add a muse-LSL data streaming application.


#9

Hi,
I know this thread is old, but may I ask if anyone here knows how to use muse EEG data as an input for BCILAB? I am not a programmer and don’t know how to write a code in JAVA or Python. Is there any simple way to do that?

Thanks!


#10

muse-io --lsl is still not timestamping properly as of 2015.11.13. Muse should at least post a notice of this bug somewhere prominent. It’s just going to keep wasting more people’s time and efforts otherwise.


#11

Hey guys,

I wrote an Android “LSL-sender” app forking LibMuseTest. While I get constant drift of around 1.5-4ms here’s the code. Hope it helps you:

At the moment it sends EEG data only but fully customizable.


#12

Hey everyone,

@bratwurzt: Nice one, I’m sure your app will be helpful to a lot of people!

I kind of ran into a wall with my idea of using the Muse for doing P300 experiments, after testing it on myself using OpenVIBE. Instead I developed a visual Neurofeedback system that gives the user feedback about their brain activity in different frequency bands by changes in the colour and movement speed of a flock of triangles (so-called boids). The system is the result of my part practical, part experimental bachelor thesis. The code and instructions + info on Neurofeedback are available on GitHub at https://github.com/StefanieStoppel/brain2boid.
The software was developed using Node.js and frontend Javascript, especially the visualisation library d3.js. I included a recording of my own brain activity, so that people who dont own a Muse can also test it :slight_smile:
I had loads of fun implementing it and hope that some of you find the time to test it and maybe even fork it!

Have a good one!