设计概览
电话语音信号频率范围是:300Hz ~ 3400Hz。
基本思路
基频:18 KHz
18KHz 导致个别人群耳鸣,放弃
试音范围: 165 - 2637 Hz(调制 三角波 11等分)
基频:20 KHz
试音范围:131 - 1976 Hz(调制 正弦波 11等分)
-
定时器重载值:2399
-
分频系数:0
-
实际基频:48MHz / 2400 / 1 = 20 KHz
-
正弦表
[0,741,1410,1940,2281,2399,2281,1940,1410,741,0]
-
曲线生成
#-- coding: utf-8 --
import matplotlib.pyplot as plt
import math
import numpy as np
def sineMode(A,T,index):
result = A * math.sin((math.pi / T) * index)
print(result)
return int(result)
max = 250
lenth = 10
y0 = []
open("sine.txt","w").write("")
with open('sine.txt', 'a') as f:
i = 0
while i <= lenth:
f.write(str(sineMode(max, lenth, i))+',')
# if i % 10 == 0:
# f.write('\n')
# if i % 100 == 0:
# f.write('\n')
i += 1
x = np.linspace(0, lenth,num=lenth+1)
for i in x:
print(i)
y0.append(sineMode(max, lenth, i))
plt.figure(1)
plt.title('Sine pic')
plt.plot(x, y0,'*')
plt.legend()
plt.show()
- 测试中间数据
频率 | (20KHz)计数长度 |
---|---|
重音部 | |
131 | 152 |
147 | 136 |
165 | 121 |
175 | 114 |
196 | 102 |
220 | 90 |
247 | 80 |
中音部 | |
262 | 76 |
294 | 68 |
330 | 60 |
349 | 57 |
392 | 51 |
440 | 45 |
494 | 40 |
高音部 | |
523 | 38 |
587 | 34 |
659 | 30 |
698 | 28 |
784 | 25 |
880 | 22 |
988 | 20 |
二高音 | |
1047 | 19 |
1175 | 17 |
1319 | 15 |
1397 | 14 |
1568 | 12 |
1760 | 11 |
1976 | 10 |