urish / muse-js

Muse 2016 EEG Headset JavaScript Library (using Web Bluetooth)
https://medium.com/@urish/reactive-brain-waves-af07864bb7d4
MIT License
280 stars 78 forks source link

PPG #52

Closed CaydenPierce closed 2 years ago

CaydenPierce commented 2 years ago

PPG on Muse

PPG data from Muse 2/Muse S is now streaming when enablePpg muse attribute if true.

This is solving https://github.com/urish/muse-js/issues/51

Testing

Tested on Muse S. A number of unit tests were written to test the new functionalities. All jest tests are passing.

Demo

The demo has not been updated to show PPG in action, as turning on enablePpg will fail on Muse 2016 device (untested). However I have a local demo running streaming PPG. Perhaps we could add a "Muse version" parameter so users don't accidentally try to use PPG on Muse 1.

kylemath commented 2 years ago

This is great @urish, thanks @CaydenPierce

kylemath commented 2 years ago

@CaydenPierce I think this needs something like: https://github.com/urish/muse-js/blob/master/src/lib/zip-samples.ts ? I believe this takes the 5 eeg channels that come in one after another and zips them up together into an object, however I am not sure what it does to the time information, here is the incoming eeg data stream before

Screen Shot 2021-11-17 at 7 04 55 PM

and after zip samples is applied to the observable (but without any other processing)

Screen Shot 2021-11-17 at 7 05 46 PM

kylemath commented 2 years ago

I think I have added this feature here (but no test yet) https://github.com/kylemath/muse-js/tree/zipSamples

CaydenPierce commented 2 years ago

You're right @kylemath , I overlooked it as it wasn't called by core muse.ts

Thanks for adding that code. I pulled in your commits, added tests, fixed a timing bug, and added to the branch under PR here.

@urish please give this a try.