neuralset.events.etypes.Audio¶
- class neuralset.events.etypes.Audio(*, 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]¶
Audio event corresponding to a WAV file.
Requires
soundfileto be installed. Duration and frequency are auto-detected from the file if not provided.- Returns:
Audio tensor of shape (num_samples, num_channels) when
read()is called- Return type:
Notes
Automatically detects frequency and duration from file metadata
Supports partial loading via offset and duration
Mono audio is automatically reshaped to (N, 1)
Examples
audio = Audio(start=0, timeline="audio_exp", filepath="speech.wav") audio_tensor = audio.read() # Returns torch.Tensor print(audio_tensor.shape) # (num_samples, num_channels)