Skip to main content

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.

songprint is a pure-Kotlin library that converts raw PCM audio into the binary signature format used by Shazam clients. Feed it 10–12 seconds of 16kHz mono audio and it produces a compact fingerprint you can send to the public Shazam discovery endpoint to identify any song — all in a few milliseconds, with no native code and no external dependencies.

Quickstart

Add the dependency and identify your first song in minutes.

API Reference

Full documentation for SignatureGenerator, RecognitionClient, and Pcm.

PCM Preparation

Convert raw audio bytes from any sample rate or channel count to the required format.

How It Works

Understand the FFT pipeline and Shazam’s constellation-map signature format.

Why songprint?

Zero Dependencies

No external runtime libraries. The entire implementation is self-contained Kotlin.

No API Key Required

Works with the public Shazam discovery endpoint — no registration needed.

KMP-Ready Core

The fingerprinting core uses only common Kotlin — no java.io, java.nio, or java.util.zip.

Battle-Tested

Built for RadioShake, an Android internet-radio app that identifies live-stream songs continuously.

How it works in three steps

1

Prepare PCM audio

Convert your audio source to 16kHz mono 16-bit PCM using the Pcm utilities.
val samples = Pcm.bytesToShorts(pcmBytes)
val mono16k = Pcm.resampleToMono16k(samples, 44100, 2)
2

Generate the signature

Pass the samples to SignatureGenerator. The pure-Kotlin FFT pipeline runs in milliseconds.
val signature = SignatureGenerator().generateSignature(mono16k)
3

Identify the song

Send the signature to the Shazam discovery endpoint via RecognitionClient.
val json = RecognitionClient().recognise(signature, mono16k.size)
// json contains track.title, track.subtitle (artist), track.images.coverart, etc.

Installation

Add JitPack to your repositories and include the dependency:
build.gradle.kts
repositories {
    maven("https://jitpack.io")
}

dependencies {
    implementation("com.github.hitenpatel:songprint:0.1.0")
}
songprint requires JVM 17 or later. The fingerprinting core (SignatureGenerator and Pcm) is pure common Kotlin and can be used in Kotlin Multiplatform projects. RecognitionClient uses java.net.HttpURLConnection and is JVM-only.

Build docs developers (and LLMs) love