Applied Speech and Audio Processing: With matlab examples
Download 2.66 Mb. Pdf ko'rish
|
Applied Speech and Audio Processing With MATLAB Examples ( PDFDrive )
2.4. Segmentation
23 the filter order. Thus in the first-order filter shown, the current output sample will equal the current input sample minus 0.9375 times the previous input sample: y [n] = s[n] − 0.9375 × s[n − 1] (2.3) where the index n ranges from 0 to the length of the speech vector. 1 The problem comes at the start of each frame, with index n = 0. Consider the case of the second frame to be filtered. When calculating y [n] at the start of that frame, index n = 0 so y [0] depends upon s[−1], which will itself be zero. However, when calculating the same output value without having segmented the speech, the index would not be zero but 240 in this case. Given that y [240] = s[240] − 0.9375 × s[239], and since s[239] is known, the output would differ to the calculation in the segmented frame. Now this is only a single tap filter. Imagine a filter having more taps: the number of samples affected at the start of each new frame would be more, and thus the size of discontinuities is likely to be greater. In a tenth-order speech coder, this effect, if present, would very significantly degrade the quality of output speech. These past coefficients within a digital filter are termed the filter history, or its internal state. When filtering an array, the internal state is automatically updated sample-by- sample. However when filtering the beginning of an array, the internal state needs to be specified, otherwise it will default to zero. In the segmented speech case, the filter history is actually being reset to zero at the boundary of each frame – no wonder the output is distorted. Matlab actually provides a convenient way to set and store internal history using the filter() command. We will illustrate this by editing and repeating the segmented example above: w=240; hst=[]; n=floor(length(s)/w); for k=1:n seg=s(1+(k-1)*w:k*w); [segf, hst]=filter(h, 1, seg, hst); outsp2(1+(k-1)*w:k*w)=segf; end soundsc(outsp2); In the updated code, we are now passing in a history array to the filter() com- mand, and each time we perform the filter we are storing the resulting internal history. By specifying the filter history at the input to each subsequent frame, we are setting those internal coefficients to the state that they were in when the filter completed its operation 1 Remember in Matlab, the first index to an array is 1 rather than 0. Although we will use Matlab to illustrate the effect, we will use the common engineering approach of indexing from zero in our discussion and equations. |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling