Skip to main content

shazamlite

CI License: MIT Python 3.9+

Identify any song from audio, with a pure-Python fingerprinting engine and live Shazam recognition — no API keys required.

shazamlite implements Shazam's legacy audio-signature algorithm in pure Python

  • numpy (byte-identical to ShazamIO's SignatureGenerator), sends the signature to Shazam's live discovery/v5 endpoint, and enriches results with iTunes metadata (artwork, album, previews).

Transparency: this project is a 50/50 collaboration between human creativity and AI implementation. The initial concept, requirements, and rough functionality were created by a human developer, then refined and polished by AI to ensure smooth functionality, proper error handling, and production-ready code quality.

Features

  • Recognition — match audio against Shazam's live discovery/v5 endpoint. Long files are scanned across their loudest windows, so quiet intros or trailing silence never block a match.
  • Signature engine — shazamlite.signature is a dependency-free reimpl of the legacy Shazam algorithm; output is byte-identical to ShazamIO (data:audio/vnd.shazam.sig).
  • Metadata — search (iTunes Search), world + genre charts (official CSVs), related tracks, artist info and top songs, all enriched with 600×600 artwork.
  • Optional extras — Chrome TLS impersonation (curl_cffi), broad audio decoding (soundfile/miniaudio), live-mic capture (sounddevice), accurate timezone detection (tzlocal), pydub support.
  • Sync + async facades, JSON-serializable dataclasses, rich errors with status code + body + URL.

Only numpy is required. Everything else is optional.

Install

pip install shazamlite                 # + numpy
pip install "shazamlite[all]"          # + curl_cffi, soundfile, miniaudio, tzlocal, sounddevice
Extra Provides
curl-cffi Chrome TLS impersonation (JA3/JA4/HTTP2)
soundfile Decode mp3 / flac / ogg / m4a files
miniaudio Alternative universal decoder
tzlocal Accurate local timezone detection
mic Live microphone capture via sounddevice
pydub Accept pydub.AudioSegment objects directly
dev pytest + ShazamIO (byte-parity test)

Quick start

import asyncio
from shazamlite import Shazam, ShazamAsync

shazam = Shazam(country="US")

track = shazam.recognize("song.mp3")     # path, WAV bytes, numpy array, or pydub segment
print(track.title, "-", track.artist)    # "Won't Bite (feat. Smino) - Doja Cat"
print(track.coverart)                    # 600x600 artwork URL
print(track.to_dict())                   # JSON-serializable dict

# Async
async def main():
    return await ShazamAsync().recognize("song.flac")

asyncio.run(main())

recognize() accepts a file path, raw WAV bytes, a numpy float array (pass sample_rate= for anything other than 16 kHz), or a pydub.AudioSegment. For recordings of speech or noise the server simply answers "no match".

CLI

shazamlite recognize song.mp3
shazamlite search "olivia rodrigo" --limit 5
shazamlite charts --world
shazamlite charts --country FR
shazamlite charts --country US --city "New York"
shazamlite charts --genre pop
shazamlite related 502331060
shazamlite artist 830588310 --top-songs

All output is JSON. Global flags: --country, --language, --timezone, --endpoint, --no-enrich, --json.

Metadata

shazam.search("queen bohemian", limit=5)
shazam.top_world_charts(limit=10)
shazam.top_genre_charts("pop")          # genre/world charts
shazam.top_country_charts("FR")         # note: country CSVs are 404 server-side (2026-08)
shazam.top_city_charts("US", "New York")# note: city CSVs are 404 server-side (2026-08)
shazam.related_tracks("502331060")
shazam.artist_about("830588310")        # -> {"artist_id", "name"}
shazam.artist_top_songs("830588310")

Errors

All errors derive from ShazamError.

Error Meaning
NoMatch Server answered, but nothing matched
BadData Not enough audio for a signature, or undecodable input
FailedDecodeJson Response was not valid JSON
HTTPStatusError Non-2xx (or persistent 429/5xx) — carries code, body, URL
MaxRetriesExceeded Transport failure after all retry attempts

429/5xx responses are retried with exponential backoff + jitter (default 3 attempts).

Development

pip install ".[dev]"
pytest                       # full suite (59 tests)
pytest tests/test_parity.py  # byte-parity vs ShazamIO

License

MIT — see LICENSE.


© 2026 Daniel Richard Todd Back · dytuk.media/shazamlite

Metadata

Release files for shazamlite 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for shazamlite 0.1.0
File Size Uploaded
shazamlite-0.1.0.tar.gz 30.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for shazamlite 0.1.0
File Interpreter ABI Platform
shazamlite-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 55.9 kB

Release files / shazamlite-0.1.0.tar.gz

Download URL shazamlite-0.1.0.tar.gz
Size 30.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a36614e9e2be9e5ed958534081de4052e25c040c49ad0ab633c26a038fc09ba1
BLAKE2b-256 checksum
How to use checksums
8ad128efe3f651ef2bf11f7aef4177729ce4f37b14a9c4a05aa0d60210174100
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 8, 2026.

Transparency log

Release files / shazamlite-0.1.0-py3-none-any.whl

Download URL shazamlite-0.1.0-py3-none-any.whl
Size 25.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b9359fd323271bd0e1a5cdf1becd3488f3213d2e6dfdb8abea95bf76cf55a9ae
BLAKE2b-256 checksum
How to use checksums
74946760e6b7e4f59c9153a15c7611c413f4cc27e22534a0684e9c86283d5f29
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 8, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page