如何在音频信号处理中创建汉明窗口

时间:2018-07-25 08:14:45

标签: matlab audio signal-processing fft windowing

请帮助我,我是新手...

我有一个音频-fs = 16000(.wav)。我想用汉明窗触摸此音频。

这是我的代码:

y = audioread('Mono.wav');

sr = 16000; %sampling rate

w = 512; %window size

T = w/sr; %period

% t is an array of times at which the hamming function is evaluated

t = linspace(0, 1, 16000);

twindow = t(1:512);


hamming = 0.54 - 0.46 * cos((2 * pi * twindow)/T);

plot(hamming);

title('Hamming');


问题:

1)如何制作重叠的帧并将这些帧存储到矩阵中?

(创建框架)

2)重叠添加来自输入矩阵的帧

(融合框架)

谢谢您的关注

1 个答案:

答案 0 :(得分:0)

要制作重叠框,我建议您使用buffer函数:

>> x = 1:100;
>> y = buffer(x, 20, 5) % create a frame of 20 elements with 5 elements overlap.

y =

     0    11    26    41    56    71    86
     0    12    27    42    57    72    87
     0    13    28    43    58    73    88
     0    14    29    44    59    74    89
     0    15    30    45    60    75    90
     1    16    31    46    61    76    91
     2    17    32    47    62    77    92
     [...]
     9    24    39    54    69    84    99
    10    25    40    55    70    85   100
    11    26    41    56    71    86     0
    12    27    42    57    72    87     0
    13    28    43    58    73    88     0
    14    29    44    59    74    89     0
    15    30    45    60    75    90     0

要对每个帧应用海明窗,只需使用y .* hamming(20)