Documentation Index
Fetch the complete documentation index at: https://mintlify.com/hitenpatel/songprint/llms.txt
Use this file to discover all available pages before exploring further.
SignatureGenerator and Pcm are written in pure common Kotlin — no java.io, no java.nio, no java.util.zip, and no platform-specific intrinsics. They can be included in any Kotlin Multiplatform shared module and will compile unchanged on any KMP target. RecognitionClient, on the other hand, uses java.net.HttpURLConnection and java.util.Base64, which means it is JVM-only. Understanding this split is the key to a clean KMP architecture with songprint.
What is KMP-compatible
SignatureGenerator
Pure common Kotlin. No JVM-only imports. Compiles on all KMP targets — Android, JVM, JS, and native. Safe to place in
commonMain.Pcm
Pure common Kotlin. No JVM-only imports. Compiles on all KMP targets. Safe to place in
commonMain.RecognitionClient
JVM-only. Uses
java.net.HttpURLConnection and java.util.Base64. Only available in androidMain / jvmMain source sets.Full library (JitPack JAR)
Published as a single JVM JAR. Depends on it from
androidMain or jvmMain; do not add it to commonMain in a multiplatform module.Adding the dependency
In a Kotlin Multiplatform module, scope the songprint dependency to the JVM/Android source sets whereRecognitionClient is needed. SignatureGenerator and Pcm source files can be added to commonMain directly (see the architecture section below), but if you are pulling in the whole JitPack artifact it belongs in a JVM-side source set.
Recommended architecture
The cleanest approach is to keep all fingerprinting logic incommonMain and isolate the HTTP transport behind an interface or expect/actual declaration in the platform-specific source sets.
Define a recognition interface in commonMain
Expose a simple suspending interface that
commonMain code can call without knowing about HTTP or the JVM.Run SignatureGenerator in commonMain
SignatureGenerator and Pcm compile without modification in commonMain.Implement RecognitionService on Android / JVM
The
actual (or concrete) implementation lives in androidMain or jvmMain, where RecognitionClient is available.Example expect/actual structure
If you preferexpect/actual over an interface, the structure is similar. Declare the expectation in commonMain and fulfill it in each platform source set.
songprint is published as a standard JVM JAR via JitPack. For iOS or native KMP targets,
RecognitionClient is not available through the artifact. The fingerprinting core (SignatureGenerator and Pcm) can be used on those targets by copying the two source files directly into your shared module’s commonMain source set — they have no imports beyond the Kotlin standard library.