LiteRtAudio

expect class LiteRtAudio

Represents audio data that can be preprocessed before being fed into a LiteRT model.

This class provides common audio operations such as resampling and converting audio data into a normalized FloatArray.

Types

Link copied to clipboard
expect object Companion

Properties

Link copied to clipboard
expect val channels: Int

The number of audio channels (e.g., 1 for mono, 2 for stereo).

Link copied to clipboard
expect val sampleRate: Int

The sample rate of the audio in Hz.

Functions

Link copied to clipboard
expect fun resample(targetSampleRate: Int): LiteRtAudio

Returns a copy of this audio data resampled to the target sample rate.

Link copied to clipboard
expect fun toFloatArray(): FloatArray

Returns the audio data as a FloatArray.

Link copied to clipboard
expect fun toMono(): LiteRtAudio

Converts the audio to mono if it has multiple channels.