com.sonosthesia.extractor
v1.12.0
Published
Sonosthesia unity extractor
Readme
com.sonosthesia.extractor
Extraction helpers for turning interaction events into normalized values that can drive other Sonosthesia systems.
Overview
This package provides static and dynamic extractors that convert incoming events into typed data (for example float, Vector3, or other structs you add). Extractors can be composed with processors from com.sonosthesia.processing and configured as ScriptableObject assets to re-use extraction strategies across scenes.
Static extractors
Static extractors (IStaticExtractor) map a single event to a value, which is useful when only the first event is available (for example MIDI note properties). The StaticExtractorSettings base class is generic so you can target any data type and lets you combine:
- A raw extraction strategy, such as
PeakFloatStaticExtractorSettingsorPeakVectorStaticExtractorSettingsfor selecting peak magnitude, strength, duration, a constant value, or a custom extractor tailored to the output type. - Post-processing via the configured
IProcessorinstance. - Optional composition with other extractors through the
InterfaceReferencefield.
Dynamic extractors
Dynamic extractors (IDynamicExtractor) create sessions that react to event streams over time. The DynamicExtractorSettings pipeline is also generic so it can be applied to any structured value. Built-in follow strategies include:
- Float:
Initial,Track,Relative, andNormalizedviaFloatDynamicExtractorSettings(relative and normalized variants derive values from the first sample). - Vector:
Initial,Track, andRelativeviaVectorDynamicExtractorSettings. - Custom: implement your own typed follow strategies by extending
DynamicExtractorSettings<TValue>and pairing it with a session processor suited to your data.
Session processors such as FuncExtractionSessionProcessor, InitialSession, and RelativeSession make it easy to wrap custom logic around existing sessions while keeping implementations stateless when needed.
Customization
Both static and dynamic extractors can be authored as plain C# classes implementing IStaticExtractor or IDynamicExtractor, then wrapped in SettingsStaticExtractor or SettingsDynamicExtractor so they can be serialized as assets. Editor drawers (FloatStaticExtractorSettingsDrawer, FloatDynamicExtractorSettingsDrawer) provide an inspector-friendly way to configure follow strategy, processors, and custom extractor references.
Usage in dependent packages
Other Sonosthesia packages build on these extractors to translate domain events into reusable control signals:
- Pointer: Provides
FloatPointerStaticExtractorSettingsandFloatPointerDynamicExtractorSettingsthat pull pressure, scroll, raycast, or screen-space data fromPointerEventstreams, and feeds those values into affordances such asPointerTriggerConfiguration. FloatPointerStaticExtractorSettings.cs FloatPointerDynamicExtractorSettings.cs PointerTriggerConfiguration.cs - Touch: Provides static and dynamic extractor settings for
TouchEventthat modulate values based on actor data, and routes the outputs into trigger/affordance configurations likeTouchTriggerConfiguration. FloatTouchDynamicExtractorSettings.cs FloatTouchStaticExtractorSettings.cs TouchTriggerConfiguration.cs - Interaction: Consumes
IStaticExtractorandIDynamicExtractoroutputs to drive envelope playback, pairing dynamic value extraction with static attack/release extraction insideInteractiveTriggerSettings. IInteractiveTriggerSettings.cs - Trigger: Consumes multiple static extractor outputs inside
SignalTriggerConfigurationto calculate value and timing before firing envelopes. SignalTriggerConfiguration.cs - VFX: Consumes static extractor outputs in
VFXEventAffordanceto set per-attribute values before dispatching visual effect events. VFXEventAffordance.cs - Instrument: Consumes touch extractor outputs in
TouchMIDINoteConfigurationto derive channel, pitch, and expressive MIDI data from touch events. TouchMIDINoteConfiguration.cs
