Skip to content

Commit

Permalink
add change
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandrebarachant committed Jan 27, 2017
1 parent 19d47fc commit a25f478
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 7 deletions.
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
# Muse LSL

This is a collection of script to use the muse 2016 BLE headset with LSL.
This is a collection of python script to use the muse 2016 BLE headset with LSL.

![Blinks](blinks.png)

## Requirements

The code rely on [pygatt](https://github.com/peplin/pygatt) for the BLE communication.
pygatt works on linux and OSX, and should work on window provided that you have a BLED112 dongle.

You will also need to find the mad address of you Muse headset

## Usage

to stream data with lsl

`python muse-lsl.py --address YOUR_DEVICE_ADDRESS`

Once the stream is up and running, you can visualize stream with

`python lsl-viewer.py`
Binary file added blinks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 9 additions & 3 deletions muse-lsl.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
from muse import Muse
from time import sleep
from pylsl import StreamInfo, StreamOutlet
from optparse import OptionParser

YOUR_DEVICE_ADDRESS = "00:55:DA:B0:06:D6"
parser = OptionParser()
parser.add_option("-a", "--address",
dest="address", type='string', default="00:55:DA:B0:06:D6",
help="device mac adress.")

(options, args) = parser.parse_args()

info = info = StreamInfo('Muse', 'EEG', 5, 256, 'float32',
'Muse%s' % YOUR_DEVICE_ADDRESS)
'Muse%s' % options.address)

info.desc().append_child_value("manufacturer", "Muse")
channels = info.desc().append_child("channels")
Expand All @@ -22,7 +28,7 @@ def process(data, timestamps):
for ii in range(12):
outlet.push_sample(data[:, ii], timestamps[ii])

muse = Muse(address=YOUR_DEVICE_ADDRESS, callback=process)
muse = Muse(address=options.address, callback=process)

muse.connect()
print('Connected')
Expand Down
14 changes: 11 additions & 3 deletions muse-record.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
from muse import Muse
from time import time, sleep
from time import sleep
import numpy as np
import pandas as pd
YOUR_DEVICE_ADDRESS = "00:55:DA:B0:06:D6"
from optparse import OptionParser

parser = OptionParser()
parser.add_option("-a", "--address",
dest="address", type='string', default="00:55:DA:B0:06:D6",
help="device mac adress.")

(options, args) = parser.parse_args()

full_time = []
full_data = []


def process(data, timestamps):
full_time.append(timestamps)
full_data.append(data)

muse = Muse(YOUR_DEVICE_ADDRESS, process)
muse = Muse(options.address, process)

muse.connect()
muse.start()
Expand Down

0 comments on commit a25f478

Please sign in to comment.