Skip to content

PartyService/MSP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🕺 MoveSpace Processor (MSP)

MoveSpace Processor (MSP) is a cross-platform motion analysis engine designed to evaluate human movement data—such as accelerometer and gyroscope readings—against pre-trained motion models stored in .msm files. Inspired by Ubisoft's Just Dance MARS system, MSP enables real-time motion scoring and classification, making it ideal for motion-driven games, fitness tracking, and movement quality assessment tools.


🏗 Project Structure

MSP/
├── javascript/       # JavaScript & TypeScript implementation (reference version)
├── python/           # Python port (completed)
├── csharp/           # C# port (planned)
├── c++/              # C++ port (planned)
├── example/          # Example .msm models and test data
├── README.md         # Project documentation

🚀 Features

  • ✅ Cross-platform motion scoring engine
  • ✅ Reads and decodes binary .msm files
  • ✅ Analyzes acceleration vector data
  • ✅ FFT, RMS, direction, and stability metrics
  • ✅ Supports Mahalanobis and Naive Bayes classifiers
  • ✅ Modular architecture for extensibility
  • ✅ Implemented in JavaScript/TypeScript and Python

🧪 Sample Use Case (JavaScript)

import { Model, Analyzer } from '../javascript/msp.js';

// Step 1: Load a MoveSpace model (.msm) as binary data
const buffer = await fetch('./generic_generic.msm').then(r => r.arrayBuffer());
const model = new Model(buffer);

// Step 2: Initialize the analyzer with one or more models
const analyzer = new Analyzer([model]);

// Step 3: Feed motion samples into the analyzer
// ⚠️ Timestamps must be in milliseconds, matching real-time intervals
// Acceleration values should be in raw sensor format [x, y, z] (unit: m/s² or Gs depending on source)
analyzer.addSamples([
  { timestamp: 0, accel: [0.17, -0.79, 0.34] },      // t = 0 ms
  { timestamp: 20, accel: [-0.45, -1.04, -1.32] },   // t = 20 ms
  { timestamp: 40, accel: [-1.47, 0.71, 0.59] },     // t = 40 ms
  // ...
]);

// Step 4: Analyze a motion segment
// - 'model.modelName' should match the model name inside the .msm file (e.g., 'generic')
// - '0' is the start time in milliseconds (relative to the first sample)
const result = analyzer.analyzeMove(model.modelName, 0);

// Step 5: View the results
console.log("Composite Score (0-100):", result.score);
console.log("Breakdown:", result.components);

/*
Output:
Composite Score (0-100): 72
Breakdown: {
  statistical: 0.729,
  autoCorrelation: 1,
  direction: 0,
  stability: 0,
  classifier: 0
}
*/

📊 Simulated Output

Using random motion sample (50 vectors) compared to generic_generic.msm

Metric Value
Model Name generic
Map Name Generic
Measure Set Acc_Dev_Dir_NP
Model Duration 652 ms
Classifier Type Naive Bayes
Reference Mean ~4.90e-44 (zero)
RMS Error 1.75
Normalized Score 0.729

🧠 What’s Inside a .msm File?

  • Endianness marker
  • Version
  • Model, Map, and Measure Names
  • Duration (in seconds)
  • Low/High Thresholds
  • Auto-correlation Thresholds
  • Direction Impact
  • Classifier Block (means, covariance, energy)

📘 References


🔄 Language Support

Language Status Notes
JavaScript/TypeScript ✅ Completed Reference implementation
Python ✅ Completed Matching logic and I/O
C++ 🔜 Planned High-performance runtime
C# 🔜 Planned Ideal for Unity integration

📜 License

This project is part of the LilyPad Next Licensed under the Apache License 2.0

About

a cross-platform motion analysis engine designed to evaluate human movement data

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published