1.1.2 • Published 8 months ago

lsl.js v1.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

lsl.js

Lab stream layer (LSL) bindings for node.js.

This library is owned by urish node-lsl.

I have adapted it so that it can be used with the current version of Node (v16.14) and with machines with M1 chip.

Usage examples:

Sending data

const lsl = require('lsl.js');
const numChannels = 3;
const info = lsl.create_streaminfo("Dummy", "EEG", numChannels, 100, lsl.channel_format_t.cft_float32, "Dummy EEG Device");
const desc = lsl.get_desc(info);
lsl.append_child_value(desc, "manufacturer", "Random Inc.");
const channels = lsl.append_child(desc, "channels");
for (let i = 0; i < numChannels; i++) {
    const channel = lsl.append_child(channels, "channel");
    lsl.append_child_value(channel, "label", "Channel " + i);
    lsl.append_child_value(channel, "unit", "microvolts");
    lsl.append_child_value(channel, "type", "EEG");
}

const outlet = lsl.create_outlet(info, 0, 360);
setInterval(function() {
    const samples = [];
    for (i = 0; i < numChannels; i++) {
        samples.push(Math.random());
    }
    lsl.push_sample_ft(outlet, new lsl.FloatArray(samples), lsl.local_clock());
}, 10);

Receiving data

const lsl = require('lsl.js');
const streams = lsl.resolve_byprop('type', 'EEG');

streamInlet = new lsl.StreamInlet(streams[0]);
streamInlet.streamChunks(12, 1000);
streamInlet.on('chunk', console.log);
streamInlet.on('closed', () => console.log('LSL inlet closed'));
1.1.1

8 months ago

1.0.9

8 months ago

1.1.2

8 months ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago