How to use Muse signals for control in Android Studio?



We are working on a project that uses the Muse headband to control a wheelchair. Currently, we have an app on Android Studio that is able to connect to the Muse headband and can stream the data. We want to be able to analyze the raw EEG signals in real time such that it can detect specific peaks that will act as a stimulus for a control. (e.g. blinks and eye movements)
We are relatively new to Android Studio and we are stuck on figuring out how to pick out the peaks we are looking for in the data stream in order to trigger a stimulus for the wheelchair movement. To do this, we were thinking of taking averages of the raw EEG data for each sensor (t10, t9, fp1, and fp2) over a 1 second time interval. In order to do this, we were thinking of having a list that refreshes with each new segment of data coming from the muse headband.
Can someone please explain the proper way to utilize the apk’s provided to do this?

Thank you


One simple way to do this would be to continually read incoming EEG data into a circular buffer (basically a list that fills up and then overwrites itself with new data) and then perform a calculation to test the variance of the data in that buffer. If it’s high then you can conclude that you’ve got a lot of ‘peaks’ in your signal.

Take a look at the CircularBuffer and NoiseDetector classes in EEG 101 to see how a circular buffer and variance testing can be implemented in Java. Then take a look at the run method of the FilterDataSource class here to see how you could combine