# 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


def compute_mm(data):
	w = 4096
	length = len(data)
	s = 0
	e = w

	max_m = []

	for i in xrange(length/w):
		d = data[s:e]
		s = e
		e += w

		a = d.max()
		b = d.min()

		f = (a-b)*0.707

		max_m.append(f)
	return np.mean(max_m)



def compute_volume(wdata,framerate):
	#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/frequency.py
import math
import numpy as np
from auana.common import hann



def compute_mm(data):
	w = 4096
	length = len(data)
	s = 0
	e = w

	max_m = []

	for i in xrange(length/w):
		d = data[s:e]
		s = e
		e += w

		a = d.max()
		b = d.min()

		f = (a-b)*0.707

		max_m.append(f)
	return np.mean(max_m)



def compute_volume(wdata,framerate):
	#data length
	data_len = wdata.shape[-1]

	#hanning window

	hanning = hann(DEF_FFT_SIZE, sym=0)