Haskell port of the Emokit EEG project https://github.com/nh2/hemokit
|Latest on Hackage:||0.6.6|
This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow stackage.org to host generated Haddocks.
It currently only works on Linux and Windows - patches for other platforms are welcome, they should be trivial.
- device discovery via hidapi
- decryption of the raw data (one-to-one port from from Emokit)
- convenient access to sensor values, gyro, qualities, battery, and raw data
Hemokit comes with example programs to
hemokit-dumpprint out the current EEG data
hemokit-mousemove the cursor using the gyro
Note that we have to use
sudo in most of the cases because the HIDAP-hidraw implementation reads directly from a device file.
hemokit-dump - Examples
hemokit-dump can print EEG data, format it as JSON, serve it via TCP or Websockets, and read from real devices and dump files.
Output EEG cumulative state for an automatically found device:
Select one of many connected EEGs by serial number:
sudo hemokit-dump --serial SN...GM
Output only the data the device sends (no cumulative state), and format the output as JSON:
sudo hemokit-dump --mode packets --format json
--formatflag allows you to change the way the output is printed. The output of
--mode state --format spacedis especially easy to work with.
Instead of from a real device, read data recorded to a file, and serve it via JSON over a TCP server on port
sudo cat /dev/hidraw1 > encrypted.dump # Dump data to a file sudo hemokit-dump --from-file encrypted.dump --serial SN...GM --serve 0.0.0.0:1234 --format json
Here you have to specify the serial since HIDAPI is not used to obtain it automatically.
If you prefer a Websockets server over a raw TCP server, use
Output decrypted raw data to stdout:
sudo hemokit-dump --mode raw
Both print the data from the EEG and store the original data for later use:
sudo cat /dev/hidraw1 | tee >(hemokit-dump --from-file - --serial SN...GM --format json) > encrypted.dump
teeand shell process substitution to duplicate the data stream, and tell hemokit-dump to read from
Connecting with other Programs
- To use Hemokit as a data source from OpenVibe, check out the corresponding entry in the Wiki
- To read Hemokit data from Matlab, I recommend publishing the data on a local socket in text format using
hemokit-dump --format spaced --serve 127.0.0.1:1234. Then you can read it with code like:
t = tcpip('127.0.0.1', 1234); fopen(t) data = fscanf(t, '%d');