DataSequencer:
Filter:
OpenBCI-SuperCollider/Classes (extension) | External Control

DataSequencer
ExtensionExtension

distribute data and accelerometer values over time

Description

Collects data from any OpenBCI board and spread out over time. Mainly useful with wifi shield where packages arrives in chunks. Can also act like a buffer and increase timing accuracy when sending OpenBCI data from sclang to scserver.

Internally it has two Routines, one for data and one for accelerometer, and they both run on the SystemClock. The samplerate for the data routine is the board's sample rate, and the accelerometer routine run at 25Hz. These samplerates can be tuned to run slightly slower with the -factor method (default 0.99).

Class Methods

.new

create a new instance

Arguments:

board

an instance of a OpenBCI subclass (for example a CytonWifi or GanglionWifi).

maxSize

the number of slots in both data and accelerometer buffers. If the data is not read fast enough, the buffers will fill up to this size and then start dropping values (fifo).

dataActive

a Boolean flag indicating if data should be buffered or not. If only using the accelerometer set this flag to false to save some CPU and memory.

accelActive

a Boolean flag indicating if accelerometer data should be buffered or not. If not using the accelerometer set this flag to false to save some CPU and memory.

Instance Methods

.board

get the board instance

.start

start sequencing

.stop

stop sequencing

.dataAction

set the OpenBCI: -dataAction

.accelAction

set the OpenBCI: -accelAction

.data

last brain wave data readings as an Array.

.accel

last accelerometer readings as an Array.

.dataActive

a Boolean flag indicating if data should be buffered or not.

.accelActive

a Boolean flag indicating if accelerometer data should be buffered or not.

.dataFull

a Boolean flag indicating if the data buffer filled up to its maximum.

.accelFull

a Boolean flag indicating if the accel buffer filled up to its maximum.

.size

get or set the maxSize.

.dataBuffer

current data buffer.

.accelBuffer

current accel buffer.

.clear

clear buffers and flags

.factor

get or set the time scaling factor. For safety keep this slightly under 1.0.

Examples