beetbox / pyacoustid

Python bindings for Chromaprint acoustic fingerprinting and the Acoustid Web service
MIT License
332 stars 66 forks source link

chromaprint.decode_fingerprint raising me an error #21

Closed kpacn closed 10 years ago

kpacn commented 10 years ago

Hello I am trying to get raw fingerprint using python like fpcalc tool to use it with that snippet https://github.com/lalinsky/acoustid-tools/blob/master/fp-find.py , witch is working for me with sample from raw fingerprints. The problem is that chromaprint.decode_fingerprint raising me the following error:

in () ----> 1 raw_fp = chromaprint.decode_fingerprint(fp) local/lib/python2.7/site-packages/chromaprint.pyc in decode_fingerprint(data, base64) 133 _check(_libchromaprint.chromaprint_decode_fingerprint( 134 data, len(data), ctypes.byref(result_ptr), ctypes.byref(result_size), --> 135 ctypes.byref(algorithm), 1 if base64 else 0 136 )) 137 result = result_ptr[:result_size.value] local/lib/python2.7/site-packages/chromaprint.pyc in _check(res) 79 """ 80 if res != 1: ---> 81 raise FingerprintError() 82 83 class Fingerprinter(object): P.S. As I just saw Fingerprinter.finish returns bytestring not base64 encoded string so my issue is how to convert that to values that fpcalc -raw gives me. Also the python file fpcalc.py throws the same error.
sampsyo commented 10 years ago

Hmm; I can't seem to reproduce this: https://gist.github.com/sampsyo/8635686

Could you provide a test case for reproduction? (In other words, what input are you providing?)

I'm a little confused by your P.S. Fingerprinter.finish() does indeed return exactly the base64-style string you see when running fpcalc.py without the -r option. This is exactly what you want to send to decode_fingerprint, as fpcalc.py does.

lalinsky commented 10 years ago

The problem is caused by an older version of libchromaprint. chromaprint_decode_fingerprint used to incorrectly return invalid code. It was fixed in version 0.7 (I think).

kpacn commented 10 years ago

Thank you, confirmed that problem persist only in libchromaprint version 0.6 with 0.7 no such problem