AudioChunk

class AudioChunk(val bytes: ByteArray, val format: PcmFormat, val timestamp: Duration)(source)

One block of interleaved PCM: CaptureConfig.chunkDuration of audio.

A frame is one sample per channel, so in mono a frame is a single sample. bytes is little-endian in format; if you just want numbers, call toFloatArray. timestamp counts captured audio from the start of the session, not wall time, so it does not jump across a pause.

Constructors

Link copied to clipboard
constructor(bytes: ByteArray, format: PcmFormat, timestamp: Duration)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val frames: Int
Link copied to clipboard

Functions

Link copied to clipboard

Peak and RMS loudness of this chunk, for waveforms and meters.

Link copied to clipboard

Samples as -1.0..1.0 floats, whatever the encoding. The easiest way to work with the audio.

Link copied to clipboard

Samples as Shorts. Only valid for PcmEncoding.Int16.