def OutMidCorrection(self, correctionType, firOrd, fs):
"""
Method to "correct" the middle outer ear transfer function.
As appears in :
- A. Härmä, and K. Palomäki, ''HUTear – a free Matlab toolbox for modeling of human hearing'',
in Proceedings of the Matlab DSP Conference, pp 96-99, Espoo, Finland 1999.
"""
# Lookup tables for correction
f1 = np.array([20, 25, 30, 35, 40, 45, 50, 55, 60, 70, 80, 90, 100, \
125, 150, 177, 200, 250, 300, 350, 400, 450, 500, 550, \
600, 700, 800, 900, 1000, 1500, 2000, 2500, 2828, 3000, \
3500, 4000, 4500, 5000, 5500, 6000, 7000, 8000, 9000, 10000, \
12748, 15000])
ELC = np.array([ 31.8, 26.0, 21.7, 18.8, 17.2, 15.4, 14.0, 12.6, 11.6, 10.6, \
9.2, 8.2, 7.7, 6.7, 5.3, 4.6, 3.9, 2.9, 2.7, 2.3, \
2.2, 2.3, 2.5, 2.7, 2.9, 3.4, 3.9, 3.9, 3.9, 2.7, \
0.9, -1.3, -2.5, -3.2, -4.4, -4.1, -2.5, -0.5, 2.0, 5.0, \
10.2, 15.0, 17.0, 15.5, 11.0, 22.0])
MAF = np.array([ 73.4, 65.2, 57.9, 52.7, 48.0, 45.0, 41.9, 39.3, 36.8, 33.0, \
29.7, 27.1, 25.0, 22.0, 18.2, 16.0, 14.0, 11.4, 9.2, 8.0, \
6.9, 6.2, 5.7, 5.1, 5.0, 5.0, 4.4, 4.3, 3.9, 2.7, \
0.9, -1.3, -2.5, -3.2, -4.4, -4.1, -2.5, -0.5, 2.0, 5.0, \
10.2, 15.0, 17.0, 15.5, 11.0, 22.0])
f2 = np.array([ 125, 250, 500, 1000, 1500, 2000, 3000, \
4000, 6000, 8000, 10000, 12000, 14000, 16000])
MAP = np.array([ 30.0, 19.0, 12.0, 9.0, 11.0, 16.0, 16.0, \
14.0, 14.0, 9.9, 24.7, 32.7, 44.1, 63.7])
if correctionType == 'ELC':
freqTable = f1
CorrectionTable = ELC
elif correctionType == 'MAF':
freqTable = f1
CorrectionTable = MAF
elif correctionType == 'MAP':
freqTable = f2
CorrectionTable = MAP
else :
print('Unrecongised operation: ELC will be used instead...')
freqTable = f1
CorrectionTable = ELC
freqN = np.arange(0, firOrd) * fs/2. / (firOrd-1)
spline = uspline(freqTable, CorrectionTable)
crc = spline(freqN)
crclin = 10. ** (-crc/ 10.)
return crclin, freqN, crc
评论列表
文章目录