Companion

object Companion

Functions

Link copied to clipboard
suspend fun concat(recordings: List<AudioRecording>, targetFormat: AudioFormat? = null): AudioRecording

Stitches multiple separately recorded segments into a single contiguous AudioRecording.

suspend fun concat(vararg recordings: AudioRecording, targetFormat: AudioFormat? = null): AudioRecording

Vararg overload of concat for ergonomic call sites.

Link copied to clipboard
fun empty(format: AudioFormat = AudioQuality.Default.format): AudioRecording

Creates an empty recording placeholder.

Link copied to clipboard
suspend fun fromAudioFlow(audioFlow: AudioFlow, duration: Duration? = null): AudioRecording

Creates an AudioRecording from an AudioFlow by collecting all chunks. This suspends until the flow completes.

Link copied to clipboard

Creates an AudioRecording from raw byte data. The data is copied to prevent external mutation.

Link copied to clipboard
fun AudioRecording.Companion.fromBytes(bytes: ByteArray, fileFormat: AudioFileFormat = AudioFileFormat.Wav): AudioRecording

Decodes an audio file from raw bytes (e.g. Compose resources via Res.readBytes(), network responses, or any in-memory representation).

Link copied to clipboard
fun fromChunks(format: AudioFormat, chunks: List<ByteArray>, duration: Duration? = null): AudioRecording

Creates an AudioRecording from multiple byte array chunks. Each chunk is copied to prevent external mutation.

Link copied to clipboard
fun AudioRecording.Companion.fromFile(path: Path, fileSystem: FileSystem = SystemFileSystem): AudioRecording

Reads an audio file from the filesystem. The format is auto-detected from the file extension.

Link copied to clipboard
fun AudioRecording.Companion.fromSource(source: Source, fileFormat: AudioFileFormat = AudioFileFormat.Wav): AudioRecording

Decodes an audio file from a Source stream (e.g. Android ContentResolver, platform input streams, or any kotlinx.io.Source).