In [1]:
import sys
sys.path.insert(2, '../src/')
# project imports
import read_audio, fingerprinting, match, datastore
from scipy.io import wavfile

In [2]:
%load_ext autoreload
%autoreload 2

In [14]:
def get_match(fpath, dstore):
    samples = read_audio.get_mono(fpath)
    hashes = fingerprinting.get_fingerprints(samples)
    # print len(list(match.get_matches_for_hashes(hashes, dstore)))
    return match.get_match(hashes, dstore)

In [26]:
dstore = datastore.Datastore()
dstore.add_fingerprints('../D5/WhoopeeTiYiYo.wav')
dstore.add_fingerprints('../D4/MMw.wav')
dstore.add_fingerprints('../D4/Mpmm.wav')
dstore.add_fingerprints('../D4/mMbm.wav')

In [31]:
get_match('../D4/MMw.wav', dstore)


Out[31]:
[('../D5/WhoopeeTiYiYo.wav', 74.803083900226767, 40.042811791383222),
 ('../D4/Mpmm.wav', 37.418956916099773, 0.034829931972789122),
 ('../D4/mMbm.wav', 37.418956916099773, 16.033378684807257)]

In [33]:
get_match('../D4/mmsm.wav', dstore)


Out[33]:
[('../D4/MMw.wav', 44.942222222222213, 46.521179138321997),
 ('../D4/Mpmm.wav', 43.920544217687073, 87.20253968253968),
 ('../D4/mMbm.wav', 44.338503401360548, 60.824671201814063)]

In [34]:
!open ../D4/

In [5]:
%%timeit
dstore = datastore.Datastore()
dstore.add_fingerprints('../D5/WhoopeeTiYiYo.wav')
dstore.add_fingerprints('../D4/MMw.wav')


1 loops, best of 3: 6.04 s per loop

In [17]:
%%timeit
get_match('../D4/MMw.wav', dstore)


1 loops, best of 3: 2.43 s per loop

In [393]:
match.get_match(hashes, dstore)


likely matches: [(0, -1497), (1, 0)]
Out[393]:
[('../D5/WhoopeeTiYiYo.wav\n', 74.803083900226767, 40.042811791383222),
 ('../D4/MMw.wav\n', 0.49922902494331073, 0.49922902494331073)]

In [ ]:
match.