fromSource

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).

val source = contentResolver.openInputStream(uri)!!.asSource().buffered()
val recording = AudioRecording.fromSource(source)

Parameters

source

The source to read from. Will be consumed but not closed.

fileFormat

The container format of the data (default: WAV).