Audio
Audio wrapper that combines tensor data with audio-specific metadata.
This class provides a type-safe representation of audio data for use in data processing pipelines. It wraps an underlying tensor and tracks sample rate, channel layout, and other audio properties.
Example:
val audio = Audio.fromTensor(tensor, 16000, ChannelLayout.MONO)
println("Duration: ${audio.duration} seconds")
println("Samples: ${audio.sampleCount}")Content copied to clipboard
Parameters
T
The DType of the underlying tensor
V
The value type of tensor elements
Properties
Link copied to clipboard
Number of audio channels (1 for mono, 2 for stereo, etc.).
Link copied to clipboard
Duration in milliseconds.
Link copied to clipboard
Memory layout of the audio data.
Link copied to clipboard
Number of audio samples (per channel).
Link copied to clipboard
Sample rate in Hz (samples per second).