# 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 math
import numpy as np
from auana.common import hann
		detect_zcr = compute_zcr(frame)
		print n, detect_zcr
		ZCR_FALG = False

		#EXPECT_ZCR == detect_zcr
		if (EXPECT_ZCR-3) <= detect_zcr <= (EXPECT_ZCR+3):
			ZCR_FALG = True

			if SIGNAL_START_FLAG is False:
				SIGNAL_START_FLAG = True

		elif SIGNAL_START_FLAG is True and ZCR_FALG is False:
			return 100
		else:
			continue

		count += 1

		if count > frames_num: break

		#hanning window to smooth the edge
		xs = np.multiply(frame, hanning)
		xfp = np.absolute(np.fft.rfft(xs))


		#fundamental frequency
		fund  = xfp[f_lower:f_upper].max()
		xfp[f_lower:f_upper] = 0

		#compute 

# 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/frequency.py
import math
import numpy as np
from auana.common import hann

		detect_zcr = compute_zcr(frame)
		print n, detect_zcr
		ZCR_FALG = False

		#EXPECT_ZCR == detect_zcr
		if (EXPECT_ZCR-3) <= detect_zcr <= (EXPECT_ZCR+3):
			ZCR_FALG = True

			if SIGNAL_START_FLAG is False:
				SIGNAL_START_FLAG = True

		elif SIGNAL_START_FLAG is True and ZCR_FALG is False:
			return 100
		else:
			continue

		count += 1

		if count > frames_num: break

		#hanning window to smooth the edge
		xs = np.multiply(frame, hanning)
		xfp = np.absolute(np.fft.rfft(xs))


		#fundamental frequency
		fund  = xfp[f_lower:f_upper].max()
		xfp[f_lower:f_upper] = 0

		#compute 

		d = xfp[int(40/scale):int(1500/scale)].max()