Skip to main content

What is Synheart Emotion?

Synheart Emotion is a multi-platform SDK for inferring momentary emotions from biosignals (heart rate and RR intervals) directly on device, ensuring privacy and real-time performance. Supported Emotions:
  • 😌 Baseline: Relaxed, peaceful emotional state
  • 😰 Stress: Anxious, tense emotional state

Key Features

On-Device Processing

  • All inference happens locally on your device
  • No network calls required
  • No raw biometric data leaves the device
  • Privacy-first by design

Real-Time Performance

  • < 1s inference latency per inference (ONNX models)
  • ~0.8-7.24 MB model size per model

Research-Based

  • Trained on WESAD dataset (wearable stress and affect detection)
  • 78.4% accuracy on binary classification (Baseline vs Stress)
  • 72.6% F1 score on WESAD validation set (LOSO CV)
  • ExtraTrees classifiers with 14 HRV features
  • ONNX format optimized for on-device inference
  • Reproducible with published model card

Multi-Platform

PlatformSDKInstallationVersionStatus
Pythonsynheart-emotionpip install synheart-emotion0.1.0✅ Ready
Dart/Fluttersynheart_emotionflutter pub add synheart_emotion0.2.1✅ Ready
Kotlinai.synheart:emotionJitPack0.1.0✅ Ready
SwiftSynheartEmotionSwift Package Manager0.1.0✅ Ready

Architecture

All SDKs implement the same architecture:
Wearable / Sensor
   └─(HR bpm, RR ms)──► Your App


                   Synheart Emotion SDK
            [Ring Buffer] → [Feature Extraction] → [Normalization]

                                  [Model]

                              EmotionResult
Components:
  • Ring Buffer: Holds last 120s of HR/RR data (configurable, default: 120s window, 60s step)
  • Feature Extractor: Computes 14 HRV features (time-domain, frequency-domain, non-linear)
  • Scaler: Standardizes features using training μ/σ (built into ONNX model)
  • Model: ExtraTrees (Extremely Randomized Trees) classifier
  • Emitter: Throttles outputs (default: every 60s)

Quick Start Examples

from datetime import datetime
from synheart_emotion import EmotionEngine, EmotionConfig

# Initialize engine
config = EmotionConfig()
engine = EmotionEngine.from_pretrained(config)

# Push biosignal data
engine.push(
    hr=72.0,
    rr_intervals_ms=[850.0, 820.0, 830.0, 845.0, 825.0],
    timestamp=datetime.now()
)

# Get inference results
results = engine.consume_ready()
for result in results:
    print(f"Emotion: {result.emotion} ({result.confidence:.1%})")
Full Python SDK Guide →

Use Cases

Mental Health Apps

Monitor stress levels in real-time:
from synheart_emotion import EmotionEngine, Emotion

engine = EmotionEngine.from_pretrained()

# Stream biosignals from wearable
for biosignal in wearable_stream():
    engine.push(
        hr=biosignal.heart_rate,
        rr_intervals_ms=biosignal.rr_intervals,
        timestamp=biosignal.timestamp
    )

    results = engine.consume_ready()
    for result in results:
        if result.emotion == Emotion.STRESSED and result.confidence > 0.7:
            send_notification("Consider taking a break")

Wellness Coaching

Track emotional patterns throughout the day:
// In your Flutter wellness app
final emotionEngine = EmotionEngine.fromPretrained();

// Integrate with Synheart Wear
synheartWear.streamHRV(windowSize: Duration(seconds: 60))
  .listen((metrics) {
    emotionEngine.push(
      hr: metrics.getMetric(MetricType.hr)!,
      rrIntervalsMs: metrics.rrIntervals,
      timestamp: DateTime.now(),
    );

    final results = await emotionEngine.consumeReadyAsync();
    if (results.isNotEmpty) {
      updateDashboard(results.first);
    }
  });

Research Applications

Collect emotion data for scientific studies:
// Android research app
val emotionEngine = EmotionEngine.fromPretrained(
    EmotionConfig(
        windowDuration = 60_000L, // 60 seconds
        stepDuration = 5_000L      // 5 seconds
    )
)

// Log all results for analysis
val results = emotionEngine.consumeReady()
results.forEach { result ->
    database.insert(
        timestamp = result.timestamp,
        emotion = result.emotion,
        confidence = result.confidence
    )
}

Model Details

Model Type: ExtraTrees (Extremely Randomized Trees) Task: Binary emotion recognition from HR/RR (Baseline vs Stress) Input Features: 14 HRV features over a 120s rolling window (default: 120s window, 60s step) 14 HRV Features:
  • Time-domain: RMSSD, Mean_RR, HRV_SDNN, pNN50
  • Frequency-domain: HRV_HF, HRV_LF, HRV_HF_nu, HRV_LF_nu, HRV_LFHF, HRV_TP
  • Non-linear: HRV_SD1SD2, HRV_Sampen, HRV_DFA_alpha1
  • Heart Rate: HR (in BPM)
Available Models:
  • ExtraTrees_120_60: 120-second window, 60-second step (default)
  • ExtraTrees_60_5: 60-second window, 5-second step
  • ExtraTrees_120_5: 120-second window, 5-second step
Performance:
  • Accuracy: 78.4% on WESAD validation set (LOSO CV)
  • F1 Score: 72.6% on WESAD validation set (LOSO CV)
  • Latency: < 1ms per inference (ONNX models)
  • Model Size: ~0.8-7.24 MB per model
The model is trained on WESAD-derived binary classification (Baseline vs Stress) with artifact rejection and normalization. ONNX format with built-in StandardScaler normalization. View Model Card → View Technical Specification (RFC E1.1) →

API Parity

All SDKs expose identical functionality:
FeaturePythonKotlinSwiftDart
EmotionConfig
EmotionEngine
EmotionResult
EmotionError
Feature Extraction
ExtraTrees/ONNX Model
Thread-Safe
Sliding Window

Available SDKs

Privacy & Security

  • On-Device Processing: All emotion inference happens locally
  • No Data Retention: Raw biometric data is not retained after processing
  • No Network Calls: No data is sent to external servers
  • Privacy-First Design: No built-in storage - you control what gets persisted
  • Not a Medical Device: This library is for wellness and research purposes only

Resources

Citation

If you use this SDK in your research:
@software{synheart_emotion,
  title = {Synheart Emotion: Multi-platform SDK for on-device emotion inference from biosignals},
  author = {Synheart AI Team},
  year = {2025},
  version = {0.1.0},
  url = {https://github.com/synheart-ai/synheart-emotion}
}

Author: Israel Goytom
Made with ❤️ by the Synheart AI Team