Applied Speech and Audio Processing: With matlab examples
Download 2.66 Mb. Pdf ko'rish
|
Applied Speech and Audio Processing With MATLAB Examples ( PDFDrive )
- Bu sahifa navigatsiya:
- 5.2. Parameterisation
- 5.2.4.3 Visualisation of line spectral pairs
Speech communications
q k = cos ω k . (5.26) To perform the conversion, we first need to solve the following set of recursive equations as an intermediate step: for k = 1, . . . , P f k = − 2f (k−1) q (2k−1) + 2f (k−1) for m = (k − 1), . . . , 1 f m = f m − 2f (m−1) q (2k−1) + f (m−2) . (5.27) We then apply initial conditions of f 0 = 1 and f −1 = 0, and calculate the coefficients of g similarly as follows: for k = 1, . . . , P g k = − 2g (k−1) q (2k) + 2g (k−1) for m = (k − 1), . . . , 1 g m = g m − 2g (m−1) q (2k) + g (m−2) . (5.28) Once the values of f and g have been determined, they form a second set of equations: f k = f k + f (k−1) for k = 1, . . . , P/2 (5.29) g k = g k + g (k−1) for k = 1, . . . , P/2 (5.30) which are then averaged to form LPC coefficients from the following: a k = 1 2 f k + 1 2 g k for k = 1, . . . , P/2 (5.31) a k = 1 2 f (k−P/2) − 1 2 g (k−P/2) for k = P/2 + 1, . . . , P. (5.32) Using Matlab, we can create a function that reads in LSPs (represented in radians), converts them to cosine domain and then replicates the steps above: function a=lsp-lpc(theta) p=length(theta); q=cos(theta(1:p)); f1(10)=1; f1(9)=0; for i=1:p/2 f1(10+i)=-2*q(2*i-1)*f1(10+i-1) + 2*f1(10+i-2); for k=i-1:-1:1 f1(10+k)=f1(10+k) - 2*q(2*i-1)*f1(10+k-1) + f1(10+k-2); end end f2(10)=1; f2(9)=0; for i=1:p/2 5.2. Parameterisation 111 f2(10+i)=-2*q(2*i)*f2(10+i-1) + 2*f2(10+i-2); for k=i-1:-1:1 f2(10+k)=f2(10+k) - 2*q(2*i)*f2(10+k-1) + f2(10+k-2); end end f1b(1)=f1(11)+1; f2b(1)=f2(11)-1; for i=2:p/2 f1b(i) = f1(10+i) + f1(10+i-1); f2b(i) = f2(10+i) - f2(10+i-1); end for i=1:p/2 a2(i) = 0.5*(f1b(i) + f2b(i)); a2(i+p/2) = 0.5*(f1b((p/2)-i+1) - f2b((p/2)-i+1)); end a=[1,a2]; The example LSP and LPC coefficient values given in Section 5.2.4.1 can again be used for testing of the function. 5.2.4.3 Visualisation of line spectral pairs As discussed previously, line spectral pairs are resident in the frequency domain. Their values can be denominated in Hz, more normally in radians, or as the cosine of their radian value. In this book, unless stated otherwise, all LSP values used in equations and Matlab code will be given in radians. Whatever the units, each line is located at a particular frequency. Thus a traditional method of visualising the value of lines is to plot them as an overlay on the LPC spec- trum. This was illustrated in Figure 5.10. The Matlab freqz() function generates a frequency response from an LPC polynomial, so we shall use that to plot a spectrum, and then overlay the LSPs on top of this, drawn as lines: function lpcsp(a, lsp) [HH, FF]=freqz(1, a, 100); semilogy(abs(HH),’m-’); hold on V=axis; axis([1,length(FF),V(3),V(4)]); hold on; lsc=100/pi; for lp=1:length(lsp) line([1+lsp(lp)*lsc,1+lsp(lp)*lsc], [V(3),V(4)]); end hold off; |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling