-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlpc.txt
31 lines (31 loc) · 827 Bytes
/
lpc.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
def lpc_coeff(pem_Seg1):
# 这一部分是计算 auto-correlation parameters
# lpc参数长度 + 1
auto_coeff = np.array([0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0])
i = 0
while i <= 10:
j = i
while j < 881:
auto_coeff[i] += pem_Seg1[j] * pem_Seg1[j-i]
j += 1
i += 1
print(auto_coeff)
a = []
for i in range(10):
tmp = []
j = 0
while j < i:
tmp.append(auto_coeff[i - j])
j += 1
if j == i:
tmp.append(auto_coeff[0])
j += 1
while j > i and j <10:
tmp.append(auto_coeff[j - i])
j += 1
a.append(tmp)
b = auto_coeff[1:11]
inverse = np.linalg.inv(a)
lpccoeff = np.dot(b, inverse)
print(lpccoeff)
return lpccoeff