Closed fvhockney closed 2 years ago
When decoding a generated fingerprint with chromaprint.decode_fingerprint(data) the result contains signed integers when chromaprint.h specifies unsigned integers. Running the same song through fpcalc -raw <file> also returns only unsigned integers.
chromaprint.decode_fingerprint(data)
chromaprint.h
fpcalc -raw <file>
I believe the issue is in chromaprint.py
chromaprint.py
--SNIP-- _libchromaprint.chromaprint_decode_fingerprint.argtypes = \ (ctypes.POINTER(ctypes.c_char), ctypes.c_int, ctypes.POINTER(ctypes.POINTER(ctypes.c_int32)), --SNIP-- --SNIP-- def decode_fingerprint(data, base64=True): result_ptr = ctypes.POINTER(ctypes.c_int32)() --SNIP--
they should be
--SNIP-- _libchromaprint.chromaprint_decode_fingerprint.argtypes = \ (ctypes.POINTER(ctypes.c_char), ctypes.c_int, ctypes.POINTER(ctypes.POINTER(ctypes.c_uint32)), --SNIP-- --SNIP-- def decode_fingerprint(data, base64=True): result_ptr = ctypes.POINTER(ctypes.c_uint32)() --SNIP--
making these changes result in decode_fingerprint and fpcalc returning the same values
decode_fingerprint
fpcalc
Before change:
(621.0, ([908999590, 384710310, 380449462, 397357718, 363147918, 77935242, 77918859, 77642440, 81832728, 74558268, 74558260, 70298404, 70298400, 70292225, 339116739, 339657346, 339362450, 1416254114, 1420448418, 1453947298, 1453881507, 1454926003, 1446520961, 1446783120, 1193027712,1142305216, 1154875968, 1167196704, -980221408, -946854368, ...
After change:
(621.0, ([908999590, 384710310, 380449462, 397357718, 363147918, 77935242, 77918859, 77642440, 81832728, 74558268, 74558260, 70298404, 70298400, 70292225, 339116739, 339657346, 339362450, 1416254114, 1420448418, 1453947298, 1453881507, 1454926003, 1446520961, 1446783120, 1193027712,1142305216, 1154875968, 1167196704, 3314745888, 3348112928,
Output of fpcalc -raw
fpcalc -raw
DURATION=621 FINGERPRINT=908999590,384710310,380449462,397357718,363147918,77935242,77918859,77642440,81832728,74558268,74558260,70298404,70298400,70292225,339116739,339657346,339362450,1416254114,1420448418,1453947298,1453881507,1454926003,1446520961,1446783120,1193027712,1142305216,1154875968,1167196704,3314745888,3348112928, ...
Yep; this looks wrong! Thanks for pointing this out! Any chance you could turn your proposed change into a small pull request?
Pull request made :-)
Fixed in #73.
When decoding a generated fingerprint with
chromaprint.decode_fingerprint(data)
the result contains signed integers whenchromaprint.h
specifies unsigned integers. Running the same song throughfpcalc -raw <file>
also returns only unsigned integers.I believe the issue is in
chromaprint.py
they should be
making these changes result in
decode_fingerprint
andfpcalc
returning the same valuesBefore change:
After change:
Output of
fpcalc -raw