BrainFlow User API has three main modules:
- BoardShim to read data from a board, it calls methods from underlying BoardController library
- DataFilter to perform signal processing, it calls methods from underlying DataHandler library
- MLModel to calculate derivative metrics, it calls methods from underlying MLModule library
These classes are independent, so if you want, you can use BrainFlow API only for data streaming and perform signal processing by yourself and vice versa.
BrainFlow data acqusition API is board agnostic, so to select a specific board you need to pass BrainFlow's board id to BoardShim's constructor and an instance of BrainFlowInputParams structure which should hold information for your specific board, check supported-boards-label
. for details. This abstraction allows you to switch boards without any changes in code.
In BoardShim, all board data is returned as a 2d array. Rows in this array may contain timestamps, EEG and EMG data and so on. To see instructions how to query specific kind of data check data-format-label
and code-samples-label
.
brainflow.board_shim
brainflow.exit_codes
brainflow.data_filter
brainflow.ml_model
BoardShim
DataFilter
MLModel
../src/utils/inc/brainflow_constants.h
Content of Brainflow Package:
brainflow
Content of brainflow namespace:
brainflow
R binding is a wrapper on top of Python binding. It is implemented using reticulate.
Check R samples to see how to use it.
Full code for R binding:
../r_package/brainflow/R/package.R
Matlab binding calls C/C++ code as any other binding, it's not compatible with Octave.
A few general rules to keep in mind:
- Use char arrays instead strings to work with BrainFlow API, it means
'my_string'
instead"my_string"
, otherwise you will get calllib error - Use int32 values intead enums, it means
int32 (BoardIDs.SYNTHETIC_BOARD)
insteadBoardIDs.SYNTHETIC_BOARD
, the same is true for all enums in BrainFlow API
Julia binding calls C/C++ code as any other binding. Use Julia examples and API reference for other languaes as a starting point.
Since Julia is not Object-Oriented language, there is no DataFilter class. BoardShim class exists but all BoardShim class methods were moved to BrainFlow package and you need to pass BoardShim object to them.
Example:
../julia_package/brainflow/test/serialization.jl
Rust binding calls C/C++ code as any other binding. Use Rust examples and API reference for other languaes as a starting point.
Example:
../rust_package/brainflow/examples/get_data.rs
Typescript binding calls C/C++ code as any other binding. Use Typescript examples and API reference for other languaes as a starting point.
Example:
../nodejs_package/tests/brainflow_get_data.ts