# Path: auana/common.py
# def hann(M, sym=True):
# 	'''
# 	hanning window.
# 	'''
# 	# Docstring adapted from NumPy's hanning function
# 	if M < 1:
# 		return np.array([])
# 	if M == 1:
# 		return np.ones(1, 'd')
# 	odd = M % 2
# 	if not sym and not odd:
# 		M = M + 1
# 		n = np.arange(0, M)
# 		w = 0.5 - 0.5 * np.cos(2.0 * np.pi * n / (M - 1))
# 	if not sym and not odd:
# 		w = w[:-1]
# 	return w


import os
import numpy as np
from ctypes import *
from auana.common import hann

	-----------------------------------------
	|-----win1------|-----win2-----|---------
	-----------------------------------------

	To improve efficiency, there are several method to be adopted:
		1) The section that have matched, we don't search it in next time.
		2) If accuracy is too low when we have finished the majority search, directly search next file.
		3) Use ".so".
	'''
	r = com.Compare(tdata, sdata, tlen, slen, compare_config)
	return r.accuracy, r.position
	






###########################################################
#   Get audio fingerprint
###########################################################
def get_fingerprint(wdata,framerate):
	'''
	Compute the fingerprint.
	'''
	#data length
	data_len = wdata.shape[-1]

	#hanning window

# Path: auana/common.py
# def hann(M, sym=True):
# 	'''
# 	hanning window.
# 	'''
# 	# Docstring adapted from NumPy's hanning function
# 	if M < 1:
# 		return np.array([])
# 	if M == 1:
# 		return np.ones(1, 'd')
# 	odd = M % 2
# 	if not sym and not odd:
# 		M = M + 1
# 		n = np.arange(0, M)
# 		w = 0.5 - 0.5 * np.cos(2.0 * np.pi * n / (M - 1))
# 	if not sym and not odd:
# 		w = w[:-1]
# 	return w


# Path: auana/recognize.py
import os
import numpy as np
from ctypes import *
from auana.common import hann


	-----------------------------------------
	|-----win1------|-----win2-----|---------
	-----------------------------------------

	To improve efficiency, there are several method to be adopted:
		1) The section that have matched, we don't search it in next time.
		2) If accuracy is too low when we have finished the majority search, directly search next file.
		3) Use ".so".
	'''
	r = com.Compare(tdata, sdata, tlen, slen, compare_config)
	return r.accuracy, r.position
	






###########################################################
#   Get audio fingerprint
###########################################################
def get_fingerprint(wdata,framerate):
	'''
	Compute the fingerprint.
	'''
	#data length
	data_len = wdata.shape[-1]

	#hanning window

	hanning = hann(DEF_FFT_SIZE, sym=0)