neuralset.events.etypes.Audio

pydantic model neuralset.events.etypes.Audio[source][source]

Audio event corresponding to a WAV file.

Requires soundfile to 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:

torch.Tensor

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)
Fields:

requirements: ClassVar[tuple[str, ...]] = ('soundfile',)[source]
type: tp.ClassVar[str] = 'Audio'[source]