neuralset.events.etypes.BaseSplittableEvent¶
- class neuralset.events.etypes.BaseSplittableEvent(*, start: float, timeline: str, duration: Annotated[float, Ge(ge=0)] = 0.0, extra: dict[str, Any] = {}, filepath: Path | str = '', frequency: float = 0, offset: Annotated[float, Ge(ge=0)] = 0.0)[source][source]¶
Base class for dynamic events (audio and video) which can be read in parts.
Supports reading only a specific section [offset, offset + duration] of the file, enabling efficient partial loading of large media files.
- Parameters:
offset (float, optional) – Start position within the file in seconds (relative to file start, not timeline) Default: 0.0
Notes
offset is relative to the event file, not the absolute timeline
The
_split()method can divide an event into multiple sub-events
Examples
# Load only seconds 5-10 of an audio file audio = Audio(start=100, timeline="t1", filepath="long_audio.wav", offset=5.0, duration=5.0) audio_data = audio.read() # Only loads 5 seconds