1.0.1 • Published 6 years ago

openbci-rx v1.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

OpenBCI Rx

Reactive Extensions for OpenBCI in Node

Dependencies Prerequisites

Make sure you have Node version >= 7.8 installed for development purpose.

Getting started

This library works with the following OpenBCI hardware:

Get started by importing the module:

npm install --save openbci-rx
const { Cyton, Ganglion } = require('openbci-rx');

// Or with an alias...

const BrainObservable  = require('openbci-rx').Ganglion;

Examples

Basic usage

const { Cyton } = require('openbci-rx');

async function init () {
    // Same options accepted by 'openbci'
    const cyton = new Cyton({
        verbose: true,
        simulate: true
    });

    await cyton.connect();
    await cyton.start();

    cyton.stream.subscribe(sample =>
        console.log('sample', sample)
    );
}

init();

Adding operators

All operators from this library have been migrated to the eeg-pipes project. Now these can be used as "lettable" RxJS operators.

// npm install --save eeg-pipes
import { voltsToMicrovolts, bufferFFT, alphaRange } from 'eeg-pipes';

cyton.stream.pipe(
    voltsToMicrovolts(),
    bufferFFT({ bins: 256 })
    alphaRange()
).subscribe(buffer =>
    console.log(buffer)
);

And now we have an FFT buffer of Alpha waves!

License

MIT © Alex Castillo