kodio
0.1.5indexedEnables straightforward audio recording and playback with a modern asynchronous API using coroutines and Flow, supporting seamless audio stream handling across various platforms.
Enables straightforward audio recording and playback with a modern asynchronous API using coroutines and Flow, supporting seamless audio stream handling across various platforms.
Surfaced from shared tags and platforms — no rankings paid for.
[!CAUTION]
This library is still in very early development.
Kotlin Multiplatform Audio Library for recording, playback, and transcription with a coroutines-based API.
import space.kodio.core.Kodio
import kotlin.time.Duration.Companion.seconds
suspend fun main() {
// Record audio for 5 seconds
val recording = Kodio.record(duration = 5.seconds)
// Play it back
recording.play()
// Save to file
recording.saveAs(Path("voice_note.wav"))
}
dependencies {
// Core library (required)
implementation("space.kodio:core:0.1.5")
// Optional: Compose state holders and waveform
implementation("space.kodio.extensions:compose:0.1.5")
// Optional: Material 3 UI components
implementation("space.kodio.extensions:compose-material3:0.1.5")
// Optional: Audio transcription (OpenAI Whisper)
implementation("space.kodio.extensions:transcription:0.1.5")
}
Kodio is silent by default: no log output is produced until you configure it. Consumers decide when and where logs appear, rather than Kodio printing to the console unprompted.
Enable logging at application startup with the built-in platform console writer:
import space.kodio.core.Kodio
import space.kodio.core.logging.LogLevel
import space.kodio.core.logging.platformLogWriter
Kodio.configureLogging {
minLevel = LogLevel.Debug
addWriter(platformLogWriter())
}
platformLogWriter() routes to Logcat on Android, NSLog on Apple platforms, the browser console on JS/Wasm, and stdout/stderr on JVM. The same API works across all targets.
To stay silent (the default), do nothing, or explicitly disable:
Kodio.configureLogging { minLevel = LogLevel.None }
Bridge to your own logging backend (Kermit, SLF4J, Crashlytics, etc.) by implementing KodioLogWriter:
Kodio.configureLogging {
minLevel = LogLevel.Warn
addWriter { level, tag, message, throwable ->
MyLogger.log(level.name, tag, message, throwable)
}
}
Log levels: Trace, Debug, Info, Warn, Error, None. Messages at or above minLevel are forwarded to all registered writers.
See the Logging docs page for full details.
Inspired by kmp-record.