Comp-Core: Computational Choreography Platform
1. [Executive Summary](#executive-summary) 2. [System Architecture Overview](#system-architecture-overview) 3. [Core Subsystems](#core-subsystems) 4. [Application Layer](#application-layer) 5. [Data Flow Architecture](#data-flow-architecture) 6. [API Reference](#api-reference) 7. [Deployment Architecture](#deployment-architecture) 8. [Current Status](#current-status)
Full Public Reader
Comp-Core: Computational Choreography Platform
Master Architecture Documentation
Version: 2.0.0
Last Updated: December 26, 2024
Status: Production Development
---
Table of Contents
1. [Executive Summary](#executive-summary)
2. [System Architecture Overview](#system-architecture-overview)
3. [Core Subsystems](#core-subsystems)
4. [Application Layer](#application-layer)
5. [Data Flow Architecture](#data-flow-architecture)
6. [API Reference](#api-reference)
7. [Deployment Architecture](#deployment-architecture)
8. [Current Status](#current-status)
---
1. Executive Summary
Comp-Core is an integrated motion-to-music platform that transforms human movement into generative audio experiences. The system combines:
- Real-time Motion Capture: Dual-source tracking via MediaPipe (camera) and Mocopi (IMU sensors)
- Audio Synthesis: Conductor-orchestrated Strudel patterns driven by body movement
- Machine Learning: CC-MotionGen diffusion models with RAG++ retrieval for motion generation
- Multi-Platform Applications: iOS, Desktop (Tauri), and Web interfaces
Key Capabilities
| Capability | Technology | Status |
|---|---|---|
| Camera-based pose tracking | MediaPipe Holistic | Production |
| IMU-based skeleton tracking | Sony Mocopi (6 sensors) | Production |
| Real-time audio synthesis | Strudel/Tidal Cycles | Production |
| Motion-conditioned generation | CC-MotionGen Diffusion | Development |
| Semantic motion retrieval | RAG++ with FAISS | Development |
| Cross-platform apps | Tauri, SwiftUI, Next.js | Production |
---
2. System Architecture Overview
┌─────────────────────────────────────────────────────────────────────────────────┐
│ COMP-CORE SYSTEM ARCHITECTURE │
├─────────────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
│ │ APPLICATION LAYER │ │
│ │ ┌─────────────┐ ┌─────────────────┐ ┌──────────────────────────┐ │ │
│ │ │ TrajectoryOS│ │ EchelonCapture │ │ CC-Dashboard │ │ │
│ │ │ Desktop │ │ iOS │ │ Web │ │ │
│ │ │ (Tauri) │ │ (SwiftUI) │ │ (Next.js) │ │ │
│ │ └──────┬──────┘ └────────┬────────┘ └────────────┬─────────────┘ │ │
│ └─────────┼──────────────────┼────────────────────────┼───────────────────┘ │
│ │ │ │ │
│ ┌─────────┴──────────────────┴────────────────────────┴───────────────────┐ │
│ │ INTEGRATION LAYER │ │
│ │ ┌─────────────────┐ ┌──────────────────┐ ┌─────────────────────┐ │ │
│ │ │ WebSocket │ │ REST APIs │ │ Cloud Sync │ │ │
│ │ │ Streaming │ │ (trajectory) │ │ (GCS/S3) │ │ │
│ │ └────────┬────────┘ └────────┬─────────┘ └──────────┬──────────┘ │ │
│ └───────────┼────────────────────┼───────────────────────┼────────────────┘ │
│ │ │ │ │
│ ┌───────────┴────────────────────┴───────────────────────┴────────────────┐ │
│ │ CORE SERVICES │ │
│ │ │ │
│ │ ┌──────────────────────────────────────────────────────────────────┐ │ │
│ │ │ MOTION CAPTURE PIPELINE │ │ │
│ │ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────────┐ │ │ │
│ │ │ │ MediaPipe │──┬──▶│ Fusion │──┬──▶│ Skeleton │ │ │ │
│ │ │ │ (Camera) │ │ │ Engine │ │ │ Mapping │ │ │ │
│ │ │ └─────────────┘ │ └─────────────┘ │ └─────────────────┘ │ │ │
│ │ │ ┌─────────────┐ │ │ │ │ │
│ │ │ │ Mocopi │──┘ │ │ │ │
│ │ │ │ (IMU) │ │ │ │ │
│ │ │ └─────────────┘ │ │ │ │
│ │ └────────────────────────────────────────┼────────────────────────┘ │ │
│ │ │ │ │
│ │ ┌────────────────────────────────────────┼────────────────────────┐ │ │
│ │ │ AUDIO SYNTHESIS │ │ │
│ │ │ ▼ │ │ │
│ │ │ ┌─────────────┐ ┌─────────────────┐ ┌────────────┐ │ │ │
│ │ │ │ Conductor │◀─────│ Motion-to- │◀─────│ Skeleton │ │ │ │
│ │ │ │ Engine │ │ Audio Map │ │ State │ │ │ │
│ │ │ └──────┬──────┘ └─────────────────┘ └────────────┘ │ │ │
│ │ │ │ │ │ │
│ │ │ ▼ │ │ │
│ │ │ ┌─────────────┐ ┌─────────────────┐ │ │ │
│ │ │ │ Strudel │─────▶│ Web Audio │──────▶ 🔊 Audio Out │ │ │
│ │ │ │ Patterns │ │ API │ │ │ │
│ │ │ └─────────────┘ └─────────────────┘ │ │ │
│ │ └────────────────────────────────────────────────────────────────┘ │ │
│ │ │ │
│ │ ┌────────────────────────────────────────────────────────────────┐ │ │
│ │ │ ML / GENERATION │ │ │
│ │ │ ┌─────────────┐ ┌─────────────────┐ ┌────────────┐ │ │ │
│ │ │ │ CC-MotionGen│◀─────│ RAG++ │◀─────│ Motion │ │ │ │
│ │ │ │ Diffusion │ │ Retrieval │ │ Phrases │ │ │ │
│ │ │ └──────┬──────┘ └─────────────────┘ └────────────┘ │ │ │
│ │ │ │ │ │ │
│ │ │ ▼ │ │ │
│ │ │ ┌─────────────────────────────────────────────────────────┐ │ │ │
│ │ │ │ Generated Motion Sequences │ │ │ │
│ │ │ └─────────────────────────────────────────────────────────┘ │ │ │
│ │ └────────────────────────────────────────────────────────────────┘ │ │
│ └───────────────────────────────────────────────────────────────────────┘ │
│ │
│ ┌───────────────────────────────────────────────────────────────────────┐ │
│ │ DATA LAYER │ │
│ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ │
│ │ │ Prisma │ │ SQLite │ │ FAISS │ │ GCS/S3 │ │ │
│ │ │ (ORM) │ │ (Local) │ │ (Vector) │ │ (Cloud) │ │ │
│ │ └─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘ │ │
│ └───────────────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────────┘---
3. Core Subsystems
3.1 Motion Capture Pipeline
The motion capture system provides dual-source tracking with sensor fusion capabilities.
3.1.1 MediaPipe Integration
Location: `apps/web/cc-dashboard/src/lib/mediapipe/`
mediapipe/
├── core/
│ ├── EventEmitter.ts # Type-safe pub/sub system
│ ├── CameraService.ts # Webcam lifecycle management
│ └── index.ts
├── analyzers/
│ ├── BaseAnalyzer.ts # Abstract base with smoothing
│ ├── FaceAnalyzer.ts # Expression detection
│ ├── HandAnalyzer.ts # Gesture recognition
│ ├── PoseAnalyzer.ts # Body pose analysis
│ └── index.ts
├── pipeline/
│ └── HolisticPipeline.ts # Orchestrates all analyzers
├── types.ts # Shared type definitions
├── MediaPipeService.ts # Legacy singleton service
└── useMediaPipe.ts # React hooksArchitecture Pattern: Plugin-based modular design
// Modern API Usage
import { HolisticPipeline } from '@/lib/mediapipe'
const pipeline = new HolisticPipeline({
face: { smoothing: 0.3, detectBlinks: true },
hands: { detectGestures: true },
pose: { smoothing: 0.5 }
})
pipeline.on('face', (face) => {
console.log(face.smileIntensity, face.eyeOpenLeft)
})
pipeline.on('hands', (hands) => {
console.log(hands.left?.gesture, hands.right?.openness)
})
pipeline.on('pose', (pose) => {
console.log(pose.bodyLean, pose.armSpread)
})
await pipeline.initialize(videoElement)
pipeline.start()Landmark Count: 543 total
- Face: 468 landmarks
- Pose: 33 landmarks
- Hands: 21 landmarks × 2 = 42 landmarks
3.1.2 Mocopi Integration
Location: `apps/web/cc-dashboard/src/lib/mocopi/`
mocopi/
├── types.ts # Mocopi data structures
├── useMocopiStream.ts # WebSocket connection hook
├── MocopiLimbFusion.ts # IMU sensor fusion
├── conductorAdapter.ts # Bridge to Conductor
└── index.tsSensor Configuration:
| Sensor | Placement | Data |
|---|---|---|
| HEAD | Forehead | Quaternion + Accel |
| BODY | Chest/Hip | Quaternion + Accel |
| L_WRIST | Left wrist | Quaternion + Accel |
| R_WRIST | Right wrist | Quaternion + Accel |
| L_ANKLE | Left ankle | Quaternion + Accel |
| R_ANKLE | Right ankle | Quaternion + Accel |
Data Flow:
Mocopi App (iOS)
│
▼ UDP (14ch BVH)
┌─────────────────┐
│ BVH Sender │
│ (macOS App) │
└────────┬────────┘
│ WebSocket
▼
┌─────────────────┐
│ Mocopi Relay │
│ (VPS/Cloud) │
└────────┬────────┘
│ WebSocket
▼
┌─────────────────┐
│ CC-Dashboard │
│ (Browser) │
└─────────────────┘3.1.3 Sensor Fusion
Location: `apps/web/cc-dashboard/src/lib/mocopi/MocopiLimbFusion.ts`
Combines MediaPipe camera data with Mocopi IMU data for enhanced accuracy:
interface FusedSkeletonState {
// From Mocopi (high frequency, orientation-accurate)
limbOrientations: Map<LimbId, Quaternion>
limbAngularVelocities: Map<LimbId, Vector3>
// From MediaPipe (position-accurate, visual)
jointPositions: Map<JointId, Vector3>
faceLandmarks: Vector3[]
handLandmarks: { left: Vector3[], right: Vector3[] }
// Fused outputs
confidence: number
timestamp: number
}---
3.2 Audio Synthesis System
3.2.1 Conductor Engine
Location: `apps/web/cc-dashboard/src/lib/conductor/`
The Conductor orchestrates musical sections based on motion trajectories.
conductor/
├── ConductorEngine.ts # Main orchestrator
├── SectionState.ts # Musical section management
├── TrajectoryPredictor.ts # Motion trajectory analysis
├── types.ts # Type definitions
└── index.tsState Machine:
┌─────────────────┐
│ IDLE │
└────────┬────────┘
│ motion detected
▼
┌─────────────────┐
┌───────│ BUILDUP │───────┐
│ └────────┬────────┘ │
│ │ energy > 0.7 │ energy < 0.3
│ ▼ │
│ ┌─────────────────┐ │
│ │ DROP │ │
│ └────────┬────────┘ │
│ │ sustain < 8s │
│ ▼ │
│ ┌─────────────────┐ │
└──────▶│ BREAKDOWN │◀──────┘
└────────┬────────┘
│ motion stops
▼
┌─────────────────┐
│ OUTRO │
└─────────────────┘3.2.2 Strudel Integration
Location: Multiple locations for platform-specific implementations
# Web (Dashboard)
apps/web/cc-dashboard/src/lib/strudel/
├── MotionStrudel.ts # Motion-to-pattern mapping
└── PatternTemplates.ts # Pre-defined patterns
# iOS (EchelonCapture)
apps/ios/EchelonCapture/EchelonCapture/Services/
└── StrudelEngine.swift # Native Strudel bridge
# Desktop (Echelon Tauri)
apps/desktop/cc-echelon/apps/echelon-tauri/src/
├── audio/StrudelEngine.js
└── hooks/useStrudelEngine.jsPattern Mapping:
// Example: Arm movement controls filter cutoff
const motionToAudio = {
armHeight: {
min: 0, max: 1,
target: 'lpf',
range: [200, 8000] // Hz
},
bodyEnergy: {
min: 0, max: 1,
target: 'gain',
range: [0.3, 1.0]
},
handGesture: {
'fist': { pattern: 'bd sd bd sd' },
'open': { pattern: 'bd hh sd hh' },
'point': { pattern: 'bd [hh hh] sd [hh oh]' }
}
}---
3.3 Machine Learning Systems
3.3.1 CC-MotionGen
Location: `core/cc-ml/cc_motiongen/`
Diffusion-based motion generation conditioned on music features.
cc_motiongen/
├── model/
│ ├── diffusion.py # DDPM implementation
│ ├── unet.py # U-Net architecture
│ ├── decoder.py # Motion decoder
│ └── conditioning.py # Music conditioning
├── inference/
│ ├── sampler.py # DDPM sampling
│ ├── mpms_sampler.py # Multi-Person Motion Sampler
│ ├── postprocess.py # Output processing
│ └── selection.py # Best sample selection
├── training/
│ ├── trainer.py # Training loop
│ └── losses.py # Loss functions
├── data/
│ ├── dataset.py # Data loading
│ └── loader.py # Batch preparation
├── evaluation/
│ ├── benchmarks.py # Evaluation metrics
│ └── harness.py # Testing harness
└── config.py # ConfigurationModel Architecture:
┌─────────────────────────────────────────────────────────────────┐
│ CC-MotionGen Pipeline │
├─────────────────────────────────────────────────────────────────┤
│ │
│ ┌──────────────┐ │
│ │ Music Audio │──────┐ │
│ └──────────────┘ │ │
│ ▼ │
│ ┌──────────────┐ ┌──────────────┐ │
│ │ Music │ │ Jukebox │ │
│ │ Embeddings │◀─│ Encoder │ │
│ └──────┬───────┘ └──────────────┘ │
│ │ │
│ ▼ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ Diffusion U-Net │ │
│ │ ┌─────────┐ ┌─────────┐ ┌─────────┐ │ │
│ │ │ Down │───▶│ Middle │───▶│ Up │ │ │
│ │ │ Blocks │ │ Block │ │ Blocks │ │ │
│ │ └─────────┘ └─────────┘ └─────────┘ │ │
│ │ ▲ ▲ │ │ │
│ │ │ │ │ │ │
│ │ ┌────┴──────────────┴──────────────┘ │ │
│ │ │ Cross-Attention (Music Conditioning) │ │
│ │ └────────────────────────────────────────────────────┘ │ │
│ └──────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────────────┐ │
│ │ Motion │ │ Temporal │ │ Generated Motion │ │
│ │ Decoder │─▶│ Smoothing │─▶│ Sequence (T×J×3) │ │
│ └──────────────┘ └──────────────┘ └──────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────┘Key Parameters:
| Parameter | Value | Description |
|---|---|---|
| Sequence Length | 196 frames | ~6.5s at 30fps |
| Joint Count | 22 | SMPL skeleton |
| Latent Dim | 512 | Diffusion latent |
| Diffusion Steps | 1000 | Training steps |
| Inference Steps | 50 | DDIM accelerated |
3.3.2 RAG++ Policy
Location: `core/cc-core/cc_core/policy/rag_motionphrase/`
Retrieval-Augmented Generation for motion priors.
rag_motionphrase/
├── retriever.py # FAISS-based retrieval
├── reranker.py # Cross-encoder reranking
├── prior_builder.py # Motion prior construction
├── cache.py # LRU caching
├── index_store.py # Index management
├── config.py # Configuration
├── schemas.py # Pydantic models
├── service.py # Main service
└── __init__.pyRAG++ Flow:
┌─────────────────────────────────────────────────────────────────┐
│ RAG++ Pipeline │
├─────────────────────────────────────────────────────────────────┤
│ │
│ Query: "energetic dance with arm waves" │
│ │ │
│ ▼ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ 1. Dense Retrieval (FAISS) │ │
│ │ ┌─────────┐ ┌─────────────┐ ┌─────────────┐ │ │
│ │ │ Query │─────▶│ Embedding │─────▶│ Top-K │ │ │
│ │ │ Encoder │ │ (768-dim) │ │ Retrieval │ │ │
│ │ └─────────┘ └─────────────┘ └──────┬──────┘ │ │
│ └───────────────────────────────────────────────┼──────────┘ │
│ │ │
│ ▼ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ 2. Cross-Encoder Reranking │ │
│ │ ┌─────────────────────────────────────────────────────┐ │ │
│ │ │ Score each (query, motion_phrase) pair │ │ │
│ │ │ Reorder by relevance score │ │ │
│ │ └──────────────────────────────────────────┬──────────┘ │ │
│ └─────────────────────────────────────────────┼────────────┘ │
│ │ │
│ ▼ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ 3. Prior Construction │ │
│ │ ┌─────────────────────────────────────────────────────┐ │ │
│ │ │ Weighted blend of top motion phrases │ │ │
│ │ │ Temporal alignment and interpolation │ │ │
│ │ │ Output: Motion prior for diffusion │ │ │
│ │ └─────────────────────────────────────────────────────┘ │ │
│ └──────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────┘---
3.4 Skeleton System
Location: `core/cc-core/cc_core/skeleton/`
Unified skeleton representation for cross-platform motion data.
skeleton/
├── pose_frame.py # Single frame representation
├── mapping.py # Skeleton mapping utilities
├── limb_windows.py # Temporal windowing
├── derived_kinematics.py # Velocity, acceleration
└── __init__.pySkeleton Hierarchy:
ROOT (HIPS)
│
┌─────────────┼─────────────┐
│ │ │
SPINE L_HIP R_HIP
│ │ │
SPINE1 L_KNEE R_KNEE
│ │ │
SPINE2 L_ANKLE R_ANKLE
│ │ │
NECK L_FOOT R_FOOT
│
HEAD
│
┌─────┴─────┐
│ │
L_SHOULDER R_SHOULDER
│ │
L_ELBOW R_ELBOW
│ │
L_WRIST R_WRIST
│ │
L_HAND R_HAND---
4. Application Layer
4.1 TrajectoryOS Desktop (Tauri)
Location: `apps/tauri-desktop/`
Full-featured desktop application for life trajectory planning and motion capture.
tauri-desktop/
├── src/
│ ├── components/
│ │ ├── skills/ # Skill graph, learning paths
│ │ │ ├── SkillGraph/
│ │ │ ├── SkillDecay/
│ │ │ ├── LearningPaths/
│ │ │ ├── Competency/
│ │ │ └── PhysicsIntegration/
│ │ ├── speak/ # Voice capture integration
│ │ ├── tabs/ # Main navigation tabs
│ │ └── charts/ # Data visualizations
│ ├── lib/
│ │ ├── database.ts # SQLite operations
│ │ ├── tauri.ts # Tauri IPC
│ │ └── hooks/ # React hooks
│ └── App.tsx
├── src-tauri/
│ ├── src/
│ │ ├── main.rs # Tauri entry
│ │ ├── commands.rs # IPC commands
│ │ └── database.rs # Rust database ops
│ └── tauri.conf.json
└── package.jsonFeatures:
| Feature | Description | Status |
|---|---|---|
| Skill Graph | Visual skill dependency tracking | Production |
| Skill Decay | Ebbinghaus-based retention modeling | Production |
| Learning Paths | AI-generated learning roadmaps | Production |
| Voice Captures | Speak integration for audio journaling | Production |
| Prompt Logs | Claude conversation history sync | Production |
| Daily Reflection | Guided journaling with AI | Production |
| Physics Simulation | Life trajectory physics engine | Production |
4.2 EchelonCapture (iOS)
Location: `apps/ios/EchelonCapture/`
iOS app for motion capture sessions with Mocopi integration.
EchelonCapture/
├── EchelonCaptureApp.swift
├── Views/
│ ├── MainView.swift
│ ├── StreamView.swift
│ ├── SettingsView.swift
│ ├── PerformView.swift
│ ├── SensorDataView.swift
│ └── Session/
│ ├── SessionLobbyView.swift
│ ├── LiveCaptureView.swift
│ └── ContractDebugOverlay.swift
├── Services/
│ ├── ComprehensiveSensorManager.swift
│ ├── MotionStreamer.swift
│ ├── WebSocketService.swift
│ ├── StrudelEngine.swift
│ ├── LatentStreamService.swift
│ └── Session/
│ ├── SessionCompiler.swift
│ ├── SessionReplayEngine.swift
│ └── InstrumentStreamService.swift
├── Models/
│ └── Session/
│ ├── SessionDataModel.swift
│ └── InstrumentModels.swift
└── Audio/
└── InstrumentAudioEngine.swiftCapabilities:
| Feature | Description | Status |
|---|---|---|
| Device Motion | Accelerometer, gyroscope capture | Production |
| Session Recording | Full motion capture sessions | Production |
| Live Streaming | Real-time WebSocket streaming | Production |
| Strudel Audio | Embedded audio synthesis | Development |
| Session Replay | Playback recorded sessions | Production |
| Multi-Device | Coordinate multiple iOS devices | Production |
4.3 CC-Dashboard (Web)
Location: `apps/web/cc-dashboard/`
Next.js web application for motion visualization and audio control.
cc-dashboard/
├── src/
│ ├── app/
│ │ ├── (dashboard)/
│ │ │ ├── live/ # Real-time visualization
│ │ │ ├── trainer/ # ML model training UI
│ │ │ ├── planner/ # Session planning
│ │ │ ├── rekordbox/ # DJ integration
│ │ │ └── body/ # Full body tracking
│ │ └── mocopi/ # Mocopi-specific view
│ ├── components/
│ │ ├── mediapipe/ # MediaPipe visualizations
│ │ ├── webviz/ # 3D visualizations
│ │ ├── conductor/ # Audio control panels
│ │ └── viz/ # General visualizations
│ ├── lib/
│ │ ├── mediapipe/ # MediaPipe integration
│ │ ├── mocopi/ # Mocopi integration
│ │ ├── conductor/ # Conductor engine
│ │ ├── strudel/ # Strudel patterns
│ │ └── instrument/ # Instrument control
│ └── store/
│ ├── vizStore.ts # Visualization state
│ ├── conductorStore.ts # Conductor state
│ └── instrumentStore.ts # Instrument state
└── package.jsonRoutes:
| Route | Description |
|---|---|
| `/` | Landing with overview |
| `/live` | Real-time motion + audio |
| `/body` | Full body MediaPipe tracking |
| `/mocopi` | Mocopi sensor dashboard |
| `/trainer` | ML training interface |
| `/planner` | Session planning |
| `/rekordbox` | DJ software integration |
---
5. Data Flow Architecture
5.1 Real-Time Motion-to-Audio Flow
┌─────────────────────────────────────────────────────────────────────────────┐
│ REAL-TIME DATA FLOW │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ INPUT SOURCES │
│ ═══════════════ │
│ │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ Webcam │ │ Mocopi │ │ iPhone │ │
│ │ (30 fps) │ │ (60 Hz) │ │ Sensors │ │
│ └──────┬──────┘ └──────┬──────┘ └──────┬──────┘ │
│ │ │ │ │
│ ▼ ▼ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ CAPTURE LAYER (16-60 Hz) │ │
│ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────────────┐ │ │
│ │ │ MediaPipe │ │ Mocopi │ │ CoreMotion/CMMotion │ │ │
│ │ │ Holistic │ │ Parser │ │ Manager │ │ │
│ │ └──────┬──────┘ └──────┬──────┘ └─────────────┬───────────────┘ │ │
│ └─────────┼────────────────┼───────────────────────┼──────────────────┘ │
│ │ │ │ │
│ └────────────────┼───────────────────────┘ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ FUSION LAYER (30 Hz) │ │
│ │ ┌─────────────────────────────────────────────────────────────────┐│ │
│ │ │ Kalman Filter / Complementary Filter ││ │
│ │ │ - Mocopi orientation (high weight) ││ │
│ │ │ - MediaPipe position (high weight) ││ │
│ │ │ - iOS acceleration (supplementary) ││ │
│ │ └──────────────────────────────────────┬──────────────────────────┘│ │
│ └─────────────────────────────────────────┼────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ ANALYSIS LAYER (30 Hz) │ │
│ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌───────────┐ │ │
│ │ │ Skeleton │ │ Derived │ │ Gesture │ │ Energy │ │ │
│ │ │ State │ │ Kinematics │ │ Detect │ │ Metrics │ │ │
│ │ │ │ │ (vel,acc) │ │ │ │ │ │ │
│ │ └──────┬──────┘ └──────┬──────┘ └──────┬──────┘ └─────┬─────┘ │ │
│ └─────────┼────────────────┼────────────────┼───────────────┼─────────┘ │
│ │ │ │ │ │
│ └────────────────┼────────────────┼───────────────┘ │
│ ▼ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ MAPPING LAYER │ │
│ │ ┌─────────────────────────────────────────────────────────────────┐│ │
│ │ │ Motion-to-Audio Parameter Mapping ││ │
│ │ │ ││ │
│ │ │ armHeight ────▶ filter.cutoff [200-8000 Hz] ││ │
│ │ │ bodyEnergy ────▶ master.gain [0.3-1.0] ││ │
│ │ │ handGesture ────▶ pattern.select [kick,snare,hihat...] ││ │
│ │ │ bodyLean ────▶ pan.position [-1.0 to 1.0] ││ │
│ │ │ armSpread ────▶ reverb.wet [0.0-0.8] ││ │
│ │ │ legEnergy ────▶ tempo.adjust [0.8-1.2×] ││ │
│ │ └──────────────────────────────────────┬──────────────────────────┘│ │
│ └─────────────────────────────────────────┼────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ SYNTHESIS LAYER │ │
│ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────┐ │ │
│ │ │ Conductor │─────▶│ Strudel │─────▶│ Web Audio │ │ │
│ │ │ Engine │ │ Pattern │ │ API │ │ │
│ │ │ │ │ Engine │ │ │ │ │
│ │ └─────────────┘ └─────────────┘ └──────────┬──────────┘ │ │
│ └───────────────────────────────────────────────────────┼─────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────┐ │
│ │ 🔊 Audio │ │
│ │ Output │ │
│ └─────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────┘5.2 ML Generation Flow
┌─────────────────────────────────────────────────────────────────────────────┐
│ ML GENERATION FLOW │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ INPUT │ │
│ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────────────┐ │ │
│ │ │ Music │ │ Text │ │ Motion Seed │ │ │
│ │ │ Audio │ │ Prompt │ │ (optional) │ │ │
│ │ └──────┬──────┘ └──────┬──────┘ └─────────────┬───────────────┘ │ │
│ └─────────┼────────────────┼───────────────────────┼──────────────────┘ │
│ │ │ │ │
│ ▼ ▼ │ │
│ ┌─────────────────────────────────────────────────┼────────────────────┐ │
│ │ CONDITIONING │ │ │
│ │ ┌─────────────┐ ┌─────────────┐ │ │ │
│ │ │ Jukebox │ │ CLIP/ │ │ │ │
│ │ │ Encoder │ │ T5 │ │ │ │
│ │ └──────┬──────┘ └──────┬──────┘ │ │ │
│ │ │ │ │ │ │
│ │ ▼ ▼ │ │ │
│ │ ┌─────────────────────────────────────────────┼─────────────────┐ │ │
│ │ │ Conditioning Vector │ │ │ │
│ │ │ (music_emb + text_emb) │ │ │ │
│ │ └─────────────────────────┬───────────────────┘ │ │ │
│ └────────────────────────────┼──────────────────────────────────────┘ │ │
│ │ │ │
│ ▼ │ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ RAG++ RETRIEVAL │ │
│ │ ┌─────────────────────────────────────────────────────────────┐ │ │
│ │ │ 1. Query FAISS index with conditioning vector │ │ │
│ │ │ 2. Retrieve top-K motion phrases │ │ │
│ │ │ 3. Rerank with cross-encoder │ │ │
│ │ │ 4. Build motion prior from top-N │ │ │
│ │ └─────────────────────────────────────────┬───────────────────┘ │ │
│ └────────────────────────────────────────────┼────────────────────────┘ │
│ │ │
│ ┌────────────────────┼─────────────────────┐ │
│ │ │ │ │
│ ▼ ▼ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ CC-MotionGen DIFFUSION │ │
│ │ │ │
│ │ for t in [T, T-1, ..., 1]: │ │
│ │ noise_pred = unet(x_t, t, conditioning, motion_prior) │ │
│ │ x_{t-1} = denoise_step(x_t, noise_pred) │ │
│ │ │ │
│ │ motion_latent = x_0 │ │
│ │ │ │
│ └─────────────────────────────────────────┬────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ POST-PROCESSING │ │
│ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────────────┐ │ │
│ │ │ Motion │ │ Temporal │ │ Foot Contact │ │ │
│ │ │ Decoder │──▶ Smoothing │──▶ Cleanup │ │ │
│ │ └─────────────┘ └─────────────┘ └─────────────┬───────────────┘ │ │
│ └───────────────────────────────────────────────────┼──────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ OUTPUT │ │
│ │ ┌─────────────────────────────────────────────────────────────┐ │ │
│ │ │ Motion Sequence: (T=196, J=22, D=3) │ │ │
│ │ │ - Joint positions over ~6.5 seconds │ │ │
│ │ │ - 30 fps, SMPL skeleton format │ │ │
│ │ └─────────────────────────────────────────────────────────────┘ │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────┘---
6. API Reference
6.1 WebSocket APIs
Motion Stream (Dashboard ↔ Mocopi)
// Connection
ws://localhost:8765/mocopi
// Incoming Message Format
interface MocopiFrame {
timestamp: number
sensors: {
[sensorId: string]: {
quaternion: [w, x, y, z]
acceleration: [x, y, z]
}
}
skeleton?: {
joints: Array<{
name: string
position: [x, y, z]
rotation: [w, x, y, z]
}>
}
}
// Outgoing Commands
interface MocopiCommand {
type: 'calibrate' | 'reset' | 'set_config'
payload?: Record<string, unknown>
}Cloud Relay (VPS)
// Connection
wss://your-vps.com:443/relay
// Client Registration
interface RegisterMessage {
type: 'register'
clientType: 'sender' | 'receiver'
sessionId: string
}
// Motion Data Relay
interface RelayedFrame {
type: 'motion'
sessionId: string
data: MocopiFrame
}6.2 REST APIs
Trajectory Core Service
// Base URL: http://localhost:3001/api
// Sessions
GET /sessions // List sessions
POST /sessions // Create session
GET /sessions/:id // Get session
PUT /sessions/:id // Update session
DELETE /sessions/:id // Delete session
// Speak Integration
GET /speak/captures // List voice captures
POST /speak/captures/sync // Sync from Speak
GET /speak/captures/:id // Get capture details
// Prompt Logs
GET /prompt-logs // List prompt logs
POST /prompt-logs/sync // Sync from Claude
GET /prompt-logs/:id // Get log details6.3 Tauri IPC Commands
// src-tauri/src/commands.rs
#[tauri::command]
async fn get_goals() -> Result<Vec<Goal>, Error>
#[tauri::command]
async fn create_goal(goal: NewGoal) -> Result<Goal, Error>
#[tauri::command]
async fn get_skills() -> Result<Vec<Skill>, Error>
#[tauri::command]
async fn update_skill_proficiency(
skill_id: i64,
proficiency: f64
) -> Result<Skill, Error>
#[tauri::command]
async fn get_skill_decay_predictions() -> Result<Vec<DecayPrediction>, Error>
#[tauri::command]
async fn sync_speak_captures(path: String) -> Result<SyncResult, Error>
#[tauri::command]
async fn sync_prompt_logs(path: String) -> Result<SyncResult, Error>---
7. Deployment Architecture
7.1 Development Environment
┌─────────────────────────────────────────────────────────────────┐
│ LOCAL DEVELOPMENT │
├─────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ Developer Machine │ │
│ │ │ │
│ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────────┐ │ │
│ │ │ Next.js │ │ Tauri │ │ Xcode │ │ │
│ │ │ Dev │ │ Dev │ │ Simulator │ │ │
│ │ │ :3000 │ │ :1420 │ │ │ │ │
│ │ └──────┬──────┘ └──────┬──────┘ └────────┬────────┘ │ │
│ │ │ │ │ │ │
│ │ └────────────────┼──────────────────┘ │ │
│ │ │ │ │
│ │ ▼ │ │
│ │ ┌─────────────────────────────────────────────────┐ │ │
│ │ │ trajectory-core │ │ │
│ │ │ (Express + Prisma) │ │ │
│ │ │ :3001 │ │ │
│ │ └─────────────────────────────────────────────────┘ │ │
│ │ │ │
│ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────────┐ │ │
│ │ │ SQLite │ │ Redis │ │ Python venv │ │ │
│ │ │ (local) │ │ (optional) │ │ (cc-core) │ │ │
│ │ └─────────────┘ └─────────────┘ └─────────────────┘ │ │
│ │ │ │
│ └─────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────┘7.2 Production Architecture
┌─────────────────────────────────────────────────────────────────────────────┐
│ PRODUCTION ARCHITECTURE │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ CLIENT DEVICES │ │
│ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────────────┐ │ │
│ │ │ macOS │ │ iOS │ │ Browser │ │ │
│ │ │ (Tauri) │ │ (Swift) │ │ (Next.js) │ │ │
│ │ └──────┬──────┘ └──────┬──────┘ └─────────────┬───────────────┘ │ │
│ └─────────┼────────────────┼───────────────────────┼──────────────────┘ │
│ │ │ │ │
│ │ │ HTTPS │ │
│ │ │ │ │
│ ┌─────────┼────────────────┼───────────────────────┼────────────────────┐ │
│ │ │ │ │ │ │
│ │ ▼ ▼ ▼ │ │
│ │ ┌─────────────────────────────────────────────────────────────────┐│ │
│ │ │ Cloudflare / CDN ││ │
│ │ │ ┌─────────────────┐ ┌─────────────────────────────────────┐ ││ │
│ │ │ │ Static Assets │ │ WAF / DDoS Protection │ ││ │
│ │ │ │ (Dashboard) │ │ │ ││ │
│ │ │ └─────────────────┘ └─────────────────────────────────────┘ ││ │
│ │ └─────────────────────────────────────────────────────────────────┘│ │
│ │ │ │ │
│ │ ▼ │ │
│ │ ┌─────────────────────────────────────────────────────────────────┐│ │
│ │ │ Google Cloud Platform ││ │
│ │ │ ││ │
│ │ │ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐││ │
│ │ │ │ Cloud Run │ │ Cloud Run │ │ Vertex AI │││ │
│ │ │ │ (API) │ │ (ML Serving) │ │ (Training) │││ │
│ │ │ │ │ │ │ │ │││ │
│ │ │ └────────┬────────┘ └────────┬────────┘ └─────────────────┘││ │
│ │ │ │ │ ││ │
│ │ │ ▼ ▼ ││ │
│ │ │ ┌─────────────────────────────────────────────────────────┐ ││ │
│ │ │ │ Cloud SQL (PostgreSQL) │ ││ │
│ │ │ └─────────────────────────────────────────────────────────┘ ││ │
│ │ │ ││ │
│ │ │ ┌─────────────────┐ ┌─────────────────────────────────────┐ ││ │
│ │ │ │ GCS Buckets │ │ Pub/Sub │ ││ │
│ │ │ │ (Models/Data) │ │ (Event Queue) │ ││ │
│ │ │ └─────────────────┘ └─────────────────────────────────────┘ ││ │
│ │ │ ││ │
│ │ └─────────────────────────────────────────────────────────────────┘│ │
│ │ │ │
│ │ ┌─────────────────────────────────────────────────────────────────┐│ │
│ │ │ VPS (Mocopi Relay) ││ │
│ │ │ ┌─────────────────────────────────────────────────────────┐ ││ │
│ │ │ │ Python WebSocket Server │ ││ │
│ │ │ │ - Real-time motion relay │ ││ │
│ │ │ │ - Session management │ ││ │
│ │ │ │ - SSL termination │ ││ │
│ │ │ └─────────────────────────────────────────────────────────┘ ││ │
│ │ └─────────────────────────────────────────────────────────────────┘│ │
│ │ │ │
│ └──────────────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────┘---
8. Current Status
8.1 Component Status Matrix
| Component | Status | Completion | Notes |
|---|---|---|---|
| Motion Capture | |||
| MediaPipe Integration | Production | 95 | |
| Mocopi Integration | Production | 90 | |
| Sensor Fusion | Development | 70 | |
| Audio Synthesis | |||
| Conductor Engine | Production | 90 | |
| Strudel Patterns | Production | 85 | |
| Motion-Audio Map | Production | 80 | |
| Machine Learning | |||
| CC-MotionGen | Development | 75 | |
| RAG++ Retrieval | Development | 70 | |
| Motion Phrases | Development | 65 | |
| Applications | |||
| CC-Dashboard | Production | 90 | |
| TrajectoryOS Desktop | Production | 85 | |
| EchelonCapture iOS | Production | 85 | |
| Infrastructure | |||
| Mocopi Cloud Relay | Production | 95 | |
| Trajectory Core API | Production | 80 | |
| ML Training Pipeline | Development | 60 |
8.2 Recent Milestones
| Date | Milestone |
|---|---|
| Dec 26, 2024 | Unified codebase merge (MediaPipe + MotionGen) |
| Dec 25, 2024 | RAG++ policy integration |
| Dec 24, 2024 | Mocopi cloud relay v4 deployment |
| Dec 22, 2024 | Conductor engine state machine |
| Dec 21, 2024 | TrajectoryOS Desktop skill decay |
| Dec 20, 2024 | MediaPipe modular architecture |
8.3 Roadmap
Q1 2025
- [ ] CC-MotionGen model training on Vertex AI
- [ ] RAG++ production deployment
- [ ] iOS App Store submission (EchelonCapture)
- [ ] macOS App Store submission (TrajectoryOS)
Q2 2025
- [ ] Multi-person motion capture
- [ ] Real-time collaborative sessions
- [ ] VR/AR integration exploration
- [ ] Motion-to-MIDI export
Q3 2025
- [ ] Production ML inference API
- [ ] Motion phrase marketplace
- [ ] Advanced audio synthesis (spatial)
- [ ] Performance optimization
---
Appendix A: Quick Start Commands
# Clone and setup
git clone [email]:Diomandeee/Comp-Core.git
cd Comp-Core
# Dashboard (Web)
cd apps/web/cc-dashboard
npm install
npm run dev # http://localhost:3000
# TrajectoryOS (Desktop)
cd apps/tauri-desktop
npm install
npm run tauri dev
# Trajectory Core (API)
cd core/cc-trajectory/services/trajectory-core
npm install
npx prisma migrate dev
npm run dev # http://localhost:3001
# CC-Core (Python)
cd core/cc-core
python -m venv venv
source venv/bin/activate
pip install -e .
# Mocopi Relay (VPS)
cd deploy/mocopi-relay
./setup-vps.sh
python mocopi_relay_v4.py---
Appendix B: Environment Variables
# .env.example
# API Keys
OPENAI_API_KEY=sk-...
GOOGLE_CLOUD_PROJECT=comp-core-prod
# Database
DATABASE_URL=file:./dev.db
REDIS_URL=redis://localhost:6379
# Services
TRAJECTORY_CORE_URL=http://localhost:3001
MOCOPI_RELAY_URL=wss://relay.comp-core.io
# Feature Flags
ENABLE_ML_INFERENCE=false
ENABLE_CLOUD_SYNC=true---
Document Version: 2.0.0
Generated: December 26, 2024
Maintainer: Comp-Core Team
Promotion Decision
Promote into a technical note or architecture paper with implementation anchors.
Source Anchor
projects/Documentation/_archive/2024-12/superseded-guides/MERGED_COMP_CORE_MASTER_ARCHITECTURE.md
Detected Structure
Method · Evaluation · Code Anchors · Architecture