Matlab中音频信号前后的零填充

时间:2019-06-27 16:31:18

标签: matlab signal-processing matlab-guide

在.25秒的块上应用自定义功能后,我的音频信号长度为Fs 44100,长度为82778。我想在循环输出之前和之后添加零填充的.25 * .5 * Fs,这样我可以获得与原始信号相同的长度。

[x, Fs] = audioread('RobynSpeakingFrom.wav');
time=length (x)/Fs; %time in second
N=Fs*0.250; %number of samples per chunk
M=length(x)-N; % the mumber of the required signals 
Fundamental=zeros(1,M); %signal frame
for i=1:M
    s = i;%start
    e = i+N-1;%end
    chunk = x(s:e);
    fundamental = F0(chunk,Fs);
    Fundamental(i)=fundamental;
end

1 个答案:

答案 0 :(得分:0)

您可以使用padarray方法添加零填充:

pad_size = round(0.25*0.5*Fs); %Number of zeros to pad
Fundamental = padarray(Fundamental, [0, pad_size], 0); %Pad with zeros before and after Fundamental.

我希望我在不知道F0RobynSpeakingFrom.wav的情况下得到正确的答案...