concat
suspend fun concat(recordings: List<AudioRecording>, targetFormat: AudioFormat? = null): AudioRecording
Stitches multiple separately recorded segments into a single contiguous AudioRecording.
Record successive segments with separate start()/stop() cycles (calling reset() in between), then concatenate the results:
val first = recorder.use { it.start(); waitForUserPause(); it.stop(); it.getRecording()!! }
val second = recorder.use { it.start(); waitForUserStop(); it.stop(); it.getRecording()!! }
val full = AudioRecording.concat(first, second)Content copied to clipboard
If the segments share a format, the bytes are concatenated as-is (cheap). If they differ, every segment is converted to targetFormat (defaults to the first segment's format) using convertAudio before being joined.
Parameters
recordings
Two or more segments to stitch (order is preserved).
targetFormat
The desired output format. Defaults to the first recording's format.
Throws
if recordings is empty.
suspend fun concat(vararg recordings: AudioRecording, targetFormat: AudioFormat? = null): AudioRecording
Vararg overload of concat for ergonomic call sites.