Horatio
Horatio — Claude Context
Zero-dependency foundation package. Defines the types that all other packages (Enobarbus, Ariel, Touchstone) depend on. No framework imports beyond Foundation, CoreGraphics, and CoreMIDI (AVFoundation only for #if canImport guards).
What Lives Here
InputSource.swift — The core protocol and all concrete source types:
- InputSource protocol: id, type, isActive, position (0–1 normalized), intensity (0–1), metadata
- HandInputSource — wrist position + finger count + chirality
- TouchInputSource — multi-touch slots (always active; inactive = removed)
- BodyJointInputSource — 19 body joints with confidence
- FaceLandmarkInputSource — face landmarks + expression coefficients
- RelationshipInputSource — derived from two sources (distance, angle, delta)
- DepthEnrichedInputSource — wraps another source with Z-depth
- Legacy EyeInputSource / MouthInputSource — prefer FaceLandmarkInputSource
- TrackerCapability enum — vision capabilities (handPose, bodyPose2D, etc.) + ARKit capabilities (arkitFace, arkitBody) + hardware (trueDepth, lidarDepth, multiCam)
- TrackerCapabilities struct — runtime detection via available, available(for:) (iOS-only hardware checks)
MIDITypes.swift — MIDI routing and message types:
- MIDIRoute — binds a source ID to channel + mapping mode + scale + note range
- MappingMode — .notes(axis:), .controlChange(cc:), .pitchBend, .velocity, .depth(cc:)
- Scale enum — 12 musical scales with intervals arrays
- MIDIMessage enum — noteOn/Off, CC, pitchBend, pressure, programChange
- RoutedMIDIMessage — message tagged with source ID
- midiToHz() — MIDI note number to Hz conversion (A4 = 440 Hz)
MIDIPacketParser.swift — Raw MIDI packet parsing (moved from Ariel):
- ParsedMIDIEvent — parsed channel voice event (status, channel, data1, data2)
- MIDIPacketParser — parses MIDIPacket into [ParsedMIDIEvent], handles all channel voice messages (0x80–0xEF)
Source ID Conventions
- Hands:
leftHand,rightHand,leftHand2,rightHand2 - Body:
body.{joint}(e.g.,body.leftShoulder,body.root) - Face:
face.{landmark}(e.g.,face.leftEye,face.mouthOpen,face.yaw) - Relationships:
rel.{metric}(e.g.,rel.kneeDistance) - Depth: matches underlying source ID
- Touch:
touch0–touch3
Rules
- No framework dependencies. This package must stay importable by everything — no AVFoundation, UIKit, Vision, ARKit.
- Hardware detection (
isTrueDepthAvailable,isLiDARAvailable) is behind#if os(iOS). - Adding a new
InputSourceTypeorTrackerCapabilitycase affects all downstream packages — check Enobarbus trackers and app-level switch statements. - All source types are value types (structs/enums) and most conform to
Equatable.
Tests
cd Packages/Horatio && swift test
MIDIRouteTests, InputSourceTests, ScaleTests.