fromTensor

fun <T : DType, V> fromTensor(tensor: Tensor<T, V>, sampleRate: Int, layout: ChannelLayout): Audio<T, V>(source)

Create Audio from an existing tensor with explicit metadata.

Return

A new Audio wrapping the tensor

Parameters

tensor

The tensor data containing audio samples

sampleRate

Sample rate in Hz

layout

Memory layout of the tensor

Throws

if tensor rank doesn't match layout