2012-05-15 175 views
1

我有一個音頻信號輸入爲雙數組。我希望通過將信號分段成25ms的漢明窗口分析幀,並將其重疊爲50%。我有用於計算漢明窗口的代碼。有人可以告訴我如何將音頻信號分段爲幀?僞代碼或Java代碼是首選。分割音頻信號

回答

2

僞代碼:

Fs = 44100;    // sample rate, e.g. 44.1 kHz 
overlap = 0.5;    // overlap = 50% 
nw = Fs * 0.025;   // no of samples in window 
ns = nw * (1.0 - overlap); // no of samples to increment n0, n1 
n0 = 0;     // window sample no begin 
n1 = n0 + nw;    // window sample no end 
N = 10 * Fs;    // N = total no of samples to process, e.g. 10 seconds 

do 
    get nw samples from n0 to (n1 - 1) into temporary buffer 
    apply window function to temporary buffer 
    apply FFT to temporary buffer 
    ... etc ... 
    n0 += ns; // increment window start/end by no of overlap samples 
    n1 += ns; 
while n1 <= N;