AudioBuffer

class AudioBuffer(val data: ByteArray, val timestamp: Long, val durationMs: Long = 0, val sampleRate: Int = 16000)

Audio buffer containing PCM data from recording.

Constructors

Link copied to clipboard
constructor(data: ByteArray, timestamp: Long, durationMs: Long = 0, sampleRate: Int = 16000)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Raw PCM bytes (16-bit signed, little-endian)

Link copied to clipboard

Duration of this buffer in milliseconds

Link copied to clipboard

Number of samples in this buffer. For mono: frameCount = sampleCount For stereo: frameCount = sampleCount / 2

Link copied to clipboard

Sample rate of this audio buffer in Hz

Link copied to clipboard

Lazily computed float samples, normalized to -1.0, 1.0. This avoids allocation if float data is not needed.

Link copied to clipboard
val size: Int
Link copied to clipboard

Buffer timestamp in milliseconds from recording start

Functions

Link copied to clipboard

Fill a pre-allocated FloatArray with normalized samples. This is the zero-allocation path for real-time DSP.

Link copied to clipboard

Convenience method to get samples as FloatArray. Equivalent to accessing the lazy samples property.