Skip to content

Latest commit

 

History

History
54 lines (39 loc) · 1.96 KB

readme.md

File metadata and controls

54 lines (39 loc) · 1.96 KB

Guideline for Python to work with EMOTIV LSL Interface

The following guide describes how Psychopy send marker to EMOTIV LSL Interface.

Prerequisites

  • Install python3 (version 3.7 or later)
  • Install pylsl (the Python interface of LSL)
   pip install pylsl

How to send marker from Python to EMOTIV LSL Inlet

  1. Open SendMarker.py file and run

  2. Open Emotiv Pro app then connect to 'PyMarker' stream on EmotivPro Inlet setting as below:

The example will create a LSL Outlet stream have 3 channels. Each event is array containing MarkerTime, MarkerValue, CurrentTime. The markertime of marker will be loaded from sending_marker.csv randomly. A marker is sent to LSL every 1000ms. In the example, a marker value is a random number from 1-99.

# Set up LabStreamingLayer stream.
info = StreamInfo(name='PsychoPyMarker', type='Markers', channel_count=3,
                  channel_format='double64', source_id='unique012345')
chns = info.desc().append_child("channels")
#MarkerTime is the time you want to add a marker. It is an epoch time.
#MarkerValue is value of marker.
#CurrentTime is current time at epoch time
for label in ["MarkerTime", "MarkerValue", "CurrentTime"]:
    ch = chns.append_child("channel")
    ch.append_child_value("label", label)
    ch.append_child_value("type", "Marker")
info.desc().append_child_value("manufacturer", "PsychoPy")

outlet = StreamOutlet(info)  # Broadcast the stream.

How to receive data from EMOTIV LSL Outlet

  1. Go to Lab Streaming Layer page, Outlet tab in EmotivPRO, choose the desire Data stream type and Data format Click Start button to start streaming.

  2. Open ReceiveData.py file and run

Reference