Synchronized recording and analysis of physiological signals from multiple devices
Features β’ Screenshots β’ Quick Start β’ Documentation β’ Architecture
StreamSense is a professional multi-device physiological recording platform designed for social neuroscience research. It enables synchronized data acquisition from multiple participants and devices simultaneously, with microsecond-precision timestamps for accurate cross-device correlation analysis.
- π Multi-Device Synchronization - Record from multiple people simultaneously with LSL timestamps
- π― Multi-Vendor Support - Muse (EEG), Empatica E4 (wrist), BITalino (multi-sensor)
- π» Professional UI - Beautiful PyQt5 dashboard for easy device management
- π Real-Time Streaming - Live LSL stream monitoring and visualization
- π Robust Architecture - Process-based isolation, automatic reconnection, crash recovery
- π Analysis-Ready Output - MNE format for EEG, pandas DataFrames for other signals
- π₯ Social Neuroscience - Measure physiological synchrony between people (couples, teams, groups)
- π§ Meditation Research - Multi-person brain synchronization during meditation
- π΅ Music Studies - Physiological coordination in musical ensembles
- π Relationship Research - Heart rate and brain wave synchronization in couples
- π₯ Clinical Applications - Multi-modal physiological monitoring
| Device | Sensors | Sampling Rates | Connection |
|---|---|---|---|
| Muse 2/S | EEG (4ch), PPG, ACC, GYRO | 256Hz EEG, 64Hz PPG | Bluetooth LE |
| Empatica E4 | BVP, GSR, TEMP, ACC | 64Hz BVP, 4Hz GSR | WiFi/BLE Server |
| BITalino | ECG, EDA, EMG, EEG, ACC | Up to 1000Hz | Bluetooth/Serial |
β Professional UI Dashboard
- Device discovery and management
- One-click connect/disconnect
- Real-time status monitoring
- Signal quality indicators
- Recording controls with live timer
β Multi-Device Recording
- Synchronized timestamps across all devices (LSL)
- Individual device processes for crash isolation
- Automatic reconnection with exponential backoff
- Intelligent data interpolation for brief disconnections
β Lab Streaming Layer (LSL) Integration
- Industry-standard protocol for physiological data
- Network time protocol synchronization (microsecond precision)
- Compatible with all major analysis tools (MNE, EEGLAB, etc.)
- XDF format for multi-stream recordings
β Extensible Architecture
- BaseStreamer abstract class for easy device addition
- Process-based isolation for reliability
- Clean MVC pattern (UI β Controller β Core)
- Comprehensive documentation and guides
Beautiful dark-themed interface for device management and recording
Clean initial state ready for device discovery
Multiple devices discovered and ready to connect
Muse headband connected with signal quality indicator
Multiple devices streaming simultaneously
Live LSL streams from all connected devices
Recording session in progress with live duration timer
Complete UI showing all features in action
-
Clone the repository
git clone https://github.com/siddhant61/StreamSense.git cd StreamSense -
Create Python environment (Python 3.8+ required)
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
python ui/streamsense_ui.py- Discover Devices - Click "π Discover Devices"
- Connect - Click "Connect" on any device card
- Monitor Streams - Watch live streams appear in the right panel
- Record - Click "β Start Recording" to begin
- Stop - Click "β Stop Recording" when finished
Output Location: Documents/StreamSense/[timestamp]/
RawData/- HDF5 files with raw sensor dataDataset/- Processed data (MNE format for EEG, pandas for others)
Comprehensive guides are available in the docs/ directory:
- UI Quick Start Guide - Step-by-step UI usage with job demo script
- Multi-Device Synchronization Guide - Analysis techniques for synchrony studies
- Device Support Roadmap - Planned device expansions
- Concurrency Guidelines - Architecture decisions and patterns
- BaseStreamer API - Adding new devices
- Dependency Management - Installation troubleshooting
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β StreamSense UI (PyQt5) β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β Device β β Recording β β Stream β β
β β Controls β β Controls β β Monitor β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
βββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββ
β Qt Signals/Slots
βββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββ
β StreamSenseController (Business Logic) β
β β’ Device Discovery β’ Connection Management β’ Recording β
βββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββ
β Direct API Calls
βββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββ
β Core Components β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β FindDevices β β BaseStreamer β βStreamRecorderβ β
β β (Scanner) β β (Abstract) β β (LSLβHDF5) β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β β β β
β β βββββββββββΌββββββββββ β β
β β β Streamers β β β
β β βββββββββββββββββββββ€ β β
β β β StreamMuse β β β
β β β StreamE4 β β β
β β β StreamBioTalino β β β
β β βββββββββββ¬ββββββββββ β β
βββββββββββΌβββββββββββββββββββΌββββββββββββββββββββΌββββββββββββ
β β β
β βΌ β
β Lab Streaming Layer (LSL) β
β Network Time Synchronization β
β β β
β βΌ βΌ
βΌ ββββββββββββββββββ ββββββββββββββββββ
ββββββββββββββββ β Muse Devices β β XDF Recordings β
β Empatica β β E4 Devices β β HDF5 Raw Data β
β BLE Server β β BITalino β β Pickle Datasetsβ
ββββββββββββββββ ββββββββββββββββββ ββββββββββββββββββ
1. BaseStreamer Architecture
- Abstract base class for all device streamers
- Process-based isolation (multiprocessing.Process)
- Standardized lifecycle: start β stream β stop
- Event-based synchronization (multiprocessing.Event)
2. MVC Pattern
- View: PyQt5 UI (
streamsense_ui.py) - Controller: Business logic (
streamsense_controller.py) - Model: Core components (streamers, recorder, finder)
3. Thread Safety
- Qt signals for cross-thread communication
- Background threads for blocking operations (discovery, connection)
- Main thread reserved for UI updates
4. Process Isolation
- Each device runs in separate Process
- Crash in one device doesn't affect others
- True parallelism for CPU-intensive operations
For advanced users, StreamSense also provides a powerful CLI:
python main.py> menu # Interactive menu mode
> stream --dev muse # Stream from Muse devices
> stream --dev e4 # Stream from E4 devices
> view --data eeg # View EEG streams
> record # Start recording
> stop # Stop all streamsMenu Options:
- Connect and stream Muse devices
- View all active LSL streams
- Connect and stream E4 devices
- Start recording all streams
- Run visual oddball paradigm
- Start event logger console
- Stop all active LSL streams
import pyxdf
import numpy as np
from scipy import signal
# Load synchronized recording
streams, header = pyxdf.load_xdf('recording.xdf')
# Extract PPG for both participants
participant_a = [s for s in streams if 'Muse-A_PPG' in s['info']['name'][0]][0]
participant_b = [s for s in streams if 'Muse-B_PPG' in s['info']['name'][0]][0]
# Compute cross-correlation
correlation = signal.correlate(ppg_a, ppg_b, mode='full')
lags = signal.correlation_lags(len(ppg_a), len(ppg_b), mode='full')
# Find peak synchrony
peak_lag = lags[np.argmax(correlation)]
print(f"Peak synchrony at lag: {peak_lag} samples ({peak_lag/64:.2f} seconds)")See docs/MULTI_DEVICE_SYNCHRONIZATION_GUIDE.md for complete examples.
| Platform | Status | Notes |
|---|---|---|
| Windows 10/11 | β Full Support | All features available |
| macOS | UI works, some device drivers limited | |
| Linux | UI works, E4 server not available |
Windows:
- Empatica BLE Server (for E4 devices)
- BLED112 dongle drivers (for Muse devices)
macOS/Linux:
- Core UI and recording features work
- Muse support via native Bluetooth LE
- E4 requires Windows or virtual machine
StreamSense/
βββ ui/ # Professional UI dashboard
β βββ streamsense_ui.py # PyQt5 interface
β βββ streamsense_controller.py # Backend controller
βββ streamer/ # Device streamers
β βββ base_streamer.py # Abstract base class
β βββ stream_muse.py # Muse headband streamer
β βββ stream_e4.py # Empatica E4 streamer
β βββ stream_bitalino.py # BITalino streamer
βββ recorder/ # Recording logic
β βββ stream_recorder.py # LSL β HDF5 recorder
βββ helper/ # Utilities
β βββ find_devices.py # Device discovery
β βββ e4_helper.py # E4-specific helpers
βββ viewer/ # Stream visualization
β βββ view_streams.py # Vispy-based viewer
βββ experiments/ # Experimental protocols
β βββ visual_oddball.py # Visual oddball paradigm
βββ docs/ # Documentation
β βββ UI_QUICK_START.md # UI usage guide
β βββ MULTI_DEVICE_SYNCHRONIZATION_GUIDE.md
β βββ DEVICE_SUPPORT_ROADMAP.md
β βββ screenshots/ # UI screenshots
βββ tests/ # Test suite
βββ audit/ # Architecture analysis
βββ main.py # CLI entry point
βββ requirements.txt # Dependencies
pytestCurrent test coverage:
- β BaseStreamer lifecycle (21 tests)
- β Muse streaming (8 tests)
- β E4 streaming (19 tests)
- β Data processing utilities
StreamSense makes it easy to add new devices:
-
Inherit from BaseStreamer
from streamer.base_streamer import BaseStreamer class StreamMyDevice(BaseStreamer): def __init__(self, device_id, synchronized_start_time, root_output_folder): super().__init__( device_name=f"MyDevice_{device_id}", synchronized_start_time=synchronized_start_time, root_output_folder=root_output_folder ) def _stream_wrapper(self): # Main streaming logic pass def _setup_lsl_outlets(self): # Create LSL outlets pass
-
Implement streaming logic - Connect to device, read samples, push to LSL
-
Add to controller - Update
streamsense_controller.pydiscovery and connection -
Write tests - Ensure reliability
See streamer/README.md for detailed guide.
Contributions are welcome! Areas of interest:
- π New device support (Polar H10, Emotiv, OpenBCI, etc.)
- π Real-time visualization (signal plots, synchrony graphs)
- π§ͺ Additional tests (integration tests, UI tests)
- π Documentation (tutorials, examples, translations)
- π Bug fixes (especially cross-platform issues)
How to contribute:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
If you use StreamSense in your research, please cite:
@software{streamsense2025,
title = {StreamSense: Multi-Device Physiological Recording Platform},
author = {StreamSense Team},
year = {2025},
url = {https://github.com/siddhant61/StreamSense}
}This project is licensed under the MIT License - see the LICENSE file for details.
- Lab Streaming Layer (LSL) - Foundation for synchronized streaming
- MNE-Python - EEG analysis tools
- PyQt5 - Professional UI framework
- Muse LSL - Muse device integration
- Empatica - E4 device support
- BITalino - Open-source biosignal platform
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation:
docs/
Built with β€οΈ for social neuroscience research
β Star this repository if you find it useful! β