Skip to main content

No project description provided

Project description

Stain

Fast audio fingerprinting for Python

Install

pip install music-stain

Usage

fp = music_stain.PyFingerprinter()
hashes = fp.fingerprint_file("song.wav")

for h in hashes:
    print(f"{h.hash} @ {h.time}")

API

PyFingerprinter() - Create fingerprinter
.fingerprint_file(path) -> list[PyHash] - Returns fingerprint hashes

PyHash
.hash: int - Fingerprint hash value
.time: int - Time offset (frames)

Matching Example

Build database:

db = {}
for h in fp.fingerprint_file("song.wav"):
    db.setdefault(h.hash, []).append(("song_id", h.time))

Match query:

matches = {}
for h in fp.fingerprint_file("query.wav"):
    if h.hash in db:
        for song_id, db_time in db[h.hash]:
            offset = db_time - h.time
            matches[(song_id, offset)] = matches.get((song_id, offset), 0) + 1

best = max(matches.items(), key=lambda x: x[1])
print(f"Matched: {best[0][0]} with {best[1]} hits")

Formats

WAV, MP3, FLAC, OGG, M4A, etc.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

music_stain-0.1.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

music_stain-0.1.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

music_stain-0.1.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

music_stain-0.1.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

File details

Details for the file music_stain-0.1.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for music_stain-0.1.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b33b12f6c294a3144b3f90da881c293f87054db0119ab2bd509887030de59d62
MD5 7f1eeb2b16b5ba92ad30a9196c4d25a2
BLAKE2b-256 852f96b9cff30ec7e1197a3165a9d651adea600c37b04b0dca906076ecfa3cab

See more details on using hashes here.

File details

Details for the file music_stain-0.1.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for music_stain-0.1.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7b5e9db96e692fa0b5cddc1fa53e94cd42b0dc385196d2de6294c01fabaa8076
MD5 2cdd9cccb7b5562b3a067aba926bcbe6
BLAKE2b-256 016ba2e423437d653b1f347ff95b9166a8b9f619be47f86920d071c3dfb8c08d

See more details on using hashes here.

File details

Details for the file music_stain-0.1.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for music_stain-0.1.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5f1fbf2491ffd2411a656a97d19b873a86a2d215f56b5b1a87952b7fb36f5ca2
MD5 3866c43bbaf424e2ebac7769b48d9fe2
BLAKE2b-256 635628919a422bbfbed639e676a374bf3c0214c233cda24b2143e775c4266b85

See more details on using hashes here.

File details

Details for the file music_stain-0.1.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for music_stain-0.1.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f29f489febacb161d99bc5c3cd03322df010d702ed680ebca392058a9f493952
MD5 74e9931ac6ea6c859d7c6a1eeb8cc20e
BLAKE2b-256 c8bb0e06985bee08d0fb80917d2e53024bb24f139c010882c664cce4dbce19a6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page