I have an algorithm that looks at an audio frame, calculates a threshold in db-rms, and decides to filter the frame whether or not the threshold is crossed. However, filtering each block is producing discontinuities at the ends of the block. How can I rectify this? Is this an issue for overlap-add processing, and if so how can I get started with that? Thank you.
Spectrograph of audio clip (cropped poorly) before processing:

OLA Spectrograph of audio clip (cropped poorly) after processing:

Here is some MATLAB:
% file reading
filename = 'audio.wav';
[x,fs] = wavread(filename);
x = x(:,1);
xCopy = x;
% constant filter
biQ{1} = dsp.BiquadFilter();
biQ{1}.SOSMatrix = cookEQ(fs,1000,-60,2,'lp').*0.2;
Zi = zeros(2,3);
% window length and overlap
len = length(x);
blockLen = 256; % window length
hop = floor((blockLen)/2); % hop size
w = hamming(blockLen); % window
output = zeros(len,1);
% starting at hop to avoid if statement for first block
for pos=hop:hop:len-blockLen-hop
release(biQ{1});
ndx = pos+1:pos+blockLen; % current window location
window1 = x(ndx-hop) .* w;
[window1,Zi(:,1)] = filter(biQ{1}.SOSMatrix(1:3),biQ{1}.SOSMatrix(4:6),window1,Zi(:,1));
window2 = x(ndx) .* w;
[window2,Zi(:,2)] = filter(biQ{1}.SOSMatrix(1:3),biQ{1}.SOSMatrix(4:6),window2,Zi(:,2));
window3 = x(ndx+hop) .* w;
[window3,Zi(:,1)] = filter(biQ{1}.SOSMatrix(1:3),biQ{1}.SOSMatrix(4:6),window3,Zi(:,3));
firstHalf = window1(floor(length(window1)/2)+1:length(window1));
secondHalf = window3(1:floor(length(window1)/2));
overlapAdder = [firstHalf ; secondHalf];
output(ndx) = window2 + overlapAdder;
end
audiowrite([filename(1:end-4) '_ola.wav'],output,fs);