worldveil / dejavu

Audio fingerprinting and recognition in Python
MIT License
6.36k stars 1.43k forks source link

fails to read files not in 44100hz #14

Closed pguridi closed 10 years ago

pguridi commented 10 years ago

having a wav file in 48000hz I get this:

Traceback (most recent call last): File "/usr/lib64/python2.7/multiprocessing/process.py", line 258, in _bootstrap self.run() File "/usr/lib64/python2.7/multiprocessing/process.py", line 114, in run self._target(_self._args, *_self._kwargs) File "dejavu/dejavu/control.py", line 84, in fingerprint_worker channels = self.extract_channels(wavout_path) File "dejavu/dejavu/control.py", line 108, in extract_channels assert Fs == self.fingerprinter.Fs AssertionError

Is is possible to down-sample the file to 44100? would it be still accurate?

worldveil commented 10 years ago

Well a simple solution is having a setter for Fingerprinter.Fs, but you have to be careful you must recognize using the same Fs as when you fingerprinted which isn't really doable if you are listening to audio over mic.

If the down-sampling is deterministic, then yes it should still work (?). I'll think about it but in meantime test it out and see what happens. I think it is probably best to have dejavu make everything into 44100 to make everything uniform across spectrogram generation / fingerprinting.

Wessie commented 10 years ago

I've tried matching a few songs with up-sampled and down-sampled copies and they still seem to match fine.

If anyone can find anything that suggests this doesn't work on all tracks we could down-sample by default to something lower.

pguridi commented 10 years ago

that's great news!. but, how does it works? is it possible to fingerprint a 48000 file?, or should be down-sampled to 44100 when converting the wav?

worldveil commented 10 years ago

marking this as solved for now as it seems to work.