Skip to content
davthecoder
Klarinet: Kotlin Multiplatform app screenshot
Mobile

Klarinet

Klarinet is an open-source Kotlin Multiplatform audio SDK: one idiomatic Kotlin API for low-latency playback, recording, file I/O, and real-time effects across Android and Apple platforms. Under the hood it delegates to the best native backend on each platform: Google Oboe (AAudio / OpenSL ES) on Android, AVAudioEngine on Apple. A shared C++ DSP core powers 16 hot-swappable, lock-free effects. Published on Maven Central.

Kotlin MultiplatformAudioKMPOpen SourceOboeC++

The audio layer Kotlin Multiplatform was missing

Cross-platform UI is largely solved: Compose Multiplatform lets you share screens, navigation, and business logic across Android and iOS. Audio was left behind. If your app needs to play a tone, record from a mic, decode a file, or apply reverb, you write platform-specific code twice and keep both sides in sync forever.

Klarinet fills that gap. You write your audio code once in Kotlin, and the library delegates to the best native backend on each platform: Google Oboe (AAudio / OpenSL ES) on Android, AVAudioEngine on Apple. The point is that you don’t pay an abstraction tax for going cross-platform. Each backend is the one the platform vendor recommends for serious audio work, so you get native latency and native behavior while still writing the calling code once.

What’s inside

  • Low-latency playback and recording behind a single AudioEngine API, with a callback that runs directly on the native audio thread. Keeping that callback on the real audio thread is what makes sub-10ms latency achievable, since the audio buffer never has to bounce back through the JVM or a managed dispatcher to get filled.
  • 16 built-in effects powered by a shared C++ DSP core: gain, pan, compressor, limiter, noise gate, 8-band parametric EQ, low/high/band-pass filters, delay, reverb, chorus, flanger, phaser, and tremolo. Putting the DSP in C++ means the exact same processing math runs on Android and Apple, so a reverb sounds the same on both platforms instead of drifting apart between two separate implementations.
  • Hot-swappable effect chains. Add, remove, or reorder effects while audio is streaming, with every parameter update lock-free and audio-thread safe. Lock-free matters here because taking a mutex on the audio thread is how you get glitches and dropouts, so parameter changes are published to the running graph without ever blocking it.
  • Real-time metering through Kotlin Flows (levelFlow()) and raw PCM access for FFT, pitch detection, or custom signal processing. The Flow-based metering fits naturally into Compose and coroutine code, and the raw PCM tap is the escape hatch for anything Klarinet doesn’t do for you out of the box.

Built for real apps

Music production tools, voice and communication apps, games, audio analysers, and accessibility tools that need live passthrough with sub-10ms latency. These are the cases where the two-implementations approach hurts most: audio bugs are hard to reproduce, and having one code path instead of two means a fix lands on both platforms at once. One API, two platform families, no parity drift.

Install

Klarinet is open source and published to Maven Central, so pulling it in is a single Gradle dependency with no extra repositories to configure:

implementation("com.vectencia.klarinet:klarinet:0.0.1")

Source is on GitHub, and the package listing lives on klibs.io.

Frequently Asked Questions

What is Klarinet?

Klarinet is an open-source Kotlin Multiplatform audio SDK. It gives you one idiomatic Kotlin API for low-latency playback, recording, file I/O, and real-time effects, so you write your audio code once and run it across Android and Apple platforms.

What platforms does Klarinet support?

Android and Apple platforms. On each one it delegates to the native backend the platform vendor recommends: Google Oboe (AAudio / OpenSL ES) on Android, and AVAudioEngine on Apple.

What is Klarinet built with?

An idiomatic Kotlin API on top of native audio backends, with a shared C++ DSP core that powers the 16 built-in effects. Metering is exposed through Kotlin Flows via levelFlow(), and raw PCM access is available for FFT, pitch detection, or custom signal processing.

Is Klarinet open source, and how do I install it?

Yes. The source is on GitHub, and the library is published to Maven Central. You add it with a single Gradle dependency: implementation("com.vectencia.klarinet:klarinet:0.0.1").