I have been looking at trying to use wavelets for multichannel audio dynamic range processor. I am in the very early stages of trying to get decomposition and reconstruction working. In this thesis, it is suggested that a multiresolution dwt can be calculated using a tree of complementary filters. Being a hands-on person, I decided to jump straight in with the following Matlab code . . .

n = 31;
flipVec = [repmat([1 -1],1,floor(n/2)) 1];

% Get analysis and reconstruction filter weights using order and sign flips
bH0 = fir1(n-1,0.5);
bH1 = fliplr(bH0).*flipVec;
bF0 = fliplr(bH0);
bF1 = fliplr(bH1);

x = [1; zeros(1023,1)];

y0 = fftfilt(bH0, x);
y1 = fftfilt(bH1, x);

%skip stright to adding zeros every other sample
y0(1:2:end) = 0;
y1(1:2:end) = 0;

y2 = fftfilt(bH0, y0);
y3 = fftfilt(bH1, y0);

%skip stright to adding zeros every other sample
y2(1:2:end) = 0;
y3(1:2:end) = 0;

% =============
% y0 = 2*fftfilt(bF0, y2) + 2*fftfilt(bF1, y3);
z = 2*fftfilt(bF0, y0) + 2*fftfilt(bF1, y1);

figure; freqz(z,1)
figure; plot(z)

If I try to go deeper than the first level of the tree (by uncommenting the line towards the end of the snippet), I no longer get perfect reconstruction. This makes sense to me as the signal down the left-side of the tree has gone through more processing stages, so it has greater delay relative to the signals processed by the right-side of the tree. I'm obviously not using the correct type of filter, or am fundamentally misunderstanding the examples available online. A nudge in the right direction, or basic code example would be great help.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.