声门脉冲语音处理
创始人
2024-02-17 19:39:58
0

在这里插入图片描述
对于 0gattack(t)
攻击部分,即上升分支的时间,时间 t 的范围从 0 秒到最大峰值时间 tpeak ,图示例中选择为大约总长度的 35%,即 tpeak=35%⋅T0,或者在样本 Lattack=⌊35%⋅Lg⌉ 中,运算符 ⌊⋅⌉ 是舍入运算符,在 Python 用 np.round()
对于 tpeakgrelease(t)
对于 tcgsustain(t)
数学上定义为:
脉冲长度(以秒为单位)T0 = 1/Fp
样本长度 Lg=Fs/Fp的绝对值
在这里插入图片描述

在这里插入图片描述

gattack

# reminder (lab-sheet 1), generation of a sine signal
fs = 8000                          # samples per second
dt = 1/fs                          # seconds per samplefp = 150                           # pitch frequency (of complete glottis pulse)
Lg = np.floor(fs/fp)               # number of samples per glottis pulse
Lattack = np.round(0.35*Lg)        # length of the attach part
tPeak = Lattack / fs               # time in seconds of the attack partprint('A period of a signal with frequency of '+str(fp)+' Hz is '+str(1/fp)+' seconds or '+str(fs/fp)+' samples')
print('The glottis impulse has thus a length of '+str(Lg))omega_g = np.pi / tPeak            # (angular) frequency# let's first create a full period of the sinus (since we know how this works)
t1 = np.arange(0,Lg/fs,dt)         # time vector in seconds (one period length)
x1 = np.cos(omega_g*t1)            # one period of cosine wave signal# now a raised cosine
x2 = 0.5*(1-np.cos(omega_g*t1))    # rased cosine signal (same time vector as before)# sine signal of frequency fp Hz
tAttack = np.arange(0,tPeak,dt)         # shorter time vector in seconds
gAttack = 0.5*(1-np.cos(omega_g*tAttack))     # same raised cosine signal as before for shorter timeplt.figure(figsize=(8,6))
plt.subplot(3,1,1)
plt.plot(x1,marker='.',label='$x_1(t)=\cos(\omega_g t)$')
plt.xlim(-1,Lg)
plt.ylim(-1.1,1.1)
plt.xlabel('dicrete time in samples $k$')
plt.legend(loc='upper right')plt.subplot(3,1,2)
plt.plot(x2,marker='.',label='raised cosine $x_2(t)=\cos(\omega_g t)$')
plt.xlim(-1,Lg)
plt.ylim(-1.1,1.1)
plt.xlabel('dicrete time in samples $k$')
plt.legend(loc='lower right')plt.subplot(3,1,3)
plt.plot(gAttack,marker='.',label='$g_{\mathrm{attack}}(t)$')
plt.xlim(-1,Lg)
plt.ylim(-1.1,1.1)
plt.xlabel('dicrete time in samples $k$')
plt.legend(loc='lower right')# create a second axis to (additionally) show time in ms
ax1 = plt.gca()                   # get current axis
ax2 = ax1.twiny()                 # add a secod axis (allowing for second x-labels) 
ax2.set_xticks(ax1.get_xticks())  # copy x-ticks to second axis
ax2.set_xbound(ax1.get_xbound())  # copy x-bounds to second axis
ax2.set_xticklabels([str(x/fs*1000) for x in ax1.get_xticks()])
ax2.set_xlabel('time $t$ in ms');plt.tight_layout()

grelease

K=2Ldecay = np.round(0.15*Lg)        # length of the attach part
print((K-1)/K)
print(np.arccos((K-1)/K))tc = tPeak + np.arccos((K-1)/K)/omega_gprint('tPeak='+str(tPeak*1000)+' ms, '+str(tPeak*fs)+'samples')
print('tc=   '+str(tc*1000)+' ms, '+str(tc*fs)+'samples')t = np.arange(tPeak,tc,dt)         # shorter time vector in secondsg_decay= K* np.cos(omega_g * (t-tPeak)) -K +1plt.figure()
plt.plot(tAttack,gAttack,marker='.',c='r',label='$g_{\mathrm{attack}}(t)$')
plt.axvline(x=np.max(tAttack),c='r',ls='--',label='$t_\mathrm{peak}}$')
plt.plot(t,g_decay,marker='.',label='$g_{\mathrm{release}}(t)$')
plt.axvline(x=np.max(tc),c='r',ls='--',label='$t_c$')plt.legend();

最后

g=np.concatenate((gAttack,g_decay,np.zeros(20,)))plt.figure()
plt.plot(g);

在这里插入图片描述

相关内容

热门资讯

喜欢穿一身黑的男生性格(喜欢穿... 今天百科达人给各位分享喜欢穿一身黑的男生性格的知识,其中也会对喜欢穿一身黑衣服的男人人好相处吗进行解...
发春是什么意思(思春和发春是什... 本篇文章极速百科给大家谈谈发春是什么意思,以及思春和发春是什么意思对应的知识点,希望对各位有所帮助,...
网络用语zl是什么意思(zl是... 今天给各位分享网络用语zl是什么意思的知识,其中也会对zl是啥意思是什么网络用语进行解释,如果能碰巧...
为什么酷狗音乐自己唱的歌不能下... 本篇文章极速百科小编给大家谈谈为什么酷狗音乐自己唱的歌不能下载到本地?,以及为什么酷狗下载的歌曲不是...
家里可以做假山养金鱼吗(假山能... 今天百科达人给各位分享家里可以做假山养金鱼吗的知识,其中也会对假山能放鱼缸里吗进行解释,如果能碰巧解...
华为下载未安装的文件去哪找(华... 今天百科达人给各位分享华为下载未安装的文件去哪找的知识,其中也会对华为下载未安装的文件去哪找到进行解...
四分五裂是什么生肖什么动物(四... 本篇文章极速百科小编给大家谈谈四分五裂是什么生肖什么动物,以及四分五裂打一生肖是什么对应的知识点,希...
怎么往应用助手里添加应用(应用... 今天百科达人给各位分享怎么往应用助手里添加应用的知识,其中也会对应用助手怎么添加微信进行解释,如果能...
苏州离哪个飞机场近(苏州离哪个... 本篇文章极速百科小编给大家谈谈苏州离哪个飞机场近,以及苏州离哪个飞机场近点对应的知识点,希望对各位有...
客厅放八骏马摆件可以吗(家里摆... 今天给各位分享客厅放八骏马摆件可以吗的知识,其中也会对家里摆八骏马摆件好吗进行解释,如果能碰巧解决你...