Streaming Eeg From Emotiv

EEG from an Emotiv headset can be streamed over LSL using the EmotivePro tool. This can be done with a real or simulated headset, but only if the logged in user has an EmotivPro license. The free license won’t allow LSL streaming.

{:toc}

Setup and installation

Streaming EEG

Emotiv Launcher must be running to detect headsets (or to simulate a headset). Start Emotiv Pro and click “Connect headset” at the top of the screen.

Screenshot of Emotiv Pro connect headset view.

EmotivPro will display the available headsets. In this case, a real EPOC+ and a simulated EPOC-X (ie: a “virtual brainwear device” simulated by Emotiv Launcher).

Screenshot of available devices screen in Emotiv Pro.

Choose your device and press connect. A screen will appear showing the device fit and contact quality. Use this screen to set up the headset (as needed). Press X in the top left to close.

Screenshot of headset fitting in Emotiv Pro.

From the main EmotivPro screen, select settings and then choose Lab Streaming Layer.

Screenshot of where to find settings in Emotiv Pro.

Check the EEG data stream.

Screenshot of initial LSL configuration in Emotiv Pro

Scroll the screen to the bottom and press Start. At this point, you should be able to detect the LSL source on the network. The stream type is “EEG” and the name will appear as “EmotivDataStream-EEG”.

Screenshot of LSL outlet configuration in Emotiv Pro

Using Emotiv EEG with Bessy

The default LslEegSource in bci-essentials-python 0.1.0 pulls doesn’t correctly resolve the channel labels from Emotiv. To fix, a custom EEG source can be created by overriding the channel_labels property:

from pylsl import StreamInfo, FOREVER

from bci_essentials.io.lsl_sources import LslEegSource


class EmotivEegSource(LslEegSource):
    def __init__(self, stream: StreamInfo = None, timeout: float = FOREVER):
        super().__init__(stream, timeout)

    @property
    def channel_labels(self) -> list[str]:
        return self.get_channel_properties("label")

Using EmotivEegSource, we can now read EEG from Emotiv over LSL:

2024-01-15 14:11:08 - INFO - bci_essentials.classification.generic_classifier : Initializing the classifier
2024-01-15 14:11:08 - INFO - bci_essentials.eeg_data : EmotivDataStream-EEG
2024-01-15 14:11:08 - INFO - bci_essentials.eeg_data : ['Timestamp', 'Counter', 'Interpolate', 'AF3', 'F7', 'F3', 'FC5', 'T7', 'P7', 'O1', 'O2', 'P8', 'T8', 'FC6', 'F4', 'F8', 'AF4', 'HardwareMarker', 'Markers']
2024-01-15 14:11:12 - INFO - bci_essentials.eeg_data : Marker: Trial Started

Note that the EEG stream contains some channels that we may want to ignore inside Bessy: ‘Timestamp’, ‘Counter’, ‘Interpolate’,‘HardwareMarker’, ‘Markers’. This should be done by filtering out the channels in the EEG source, rather than hard-coding into the init of EegData (like DSI-7 and DSI-24).

Further reading

Details on Emotiv’s LSL: https://github.com/Emotiv/labstreaminglayer

EmotivPro documentation: https://emotiv.gitbook.io/emotivpro-v3/