pooz
Newbie level 5
EDIT: Simplified question: please see below.
Hi at all!
I would like to calculate the lpc in a frame/block and filter this frame. (The framesize is 1024 samples long and has been decomposed of my original vector x with a hop size of 50%)
I am using Matlab and have the problem, that when I reassemble the frame, for which I have calculated the lpc and then executed the filter, the resulting envelopes fractions (portions of 1024 samples) does not fit at each other. Not only the first samples of the actual block dont fit to the last samples of the previos block, the whole envelope seems to be shifted above or below. (I considered the overlapping)
I guess, this is due to the fact, that I always recalculate the lpc coefficients for each block. When not doing so, and instead just calculating the coeffs at once by using the whole vector, my overlapping algorithm with the filtering works fine. But I want to use it as a realtime application later in C, so I won´t have the whole vector x
So my question in short would be:
How to use LPC with subsequent filtering, when applying on overlapping frames and recalculating the coeffs for each frame?
(The Purpose is, to build a transient Detector as a realtime app (VST-Plug-In) which works frame based.)
If you like, here is a minimal code example, which is really very raw and dirty . By default, it works (the difference between the algorithm as a vector and the block based algorithm is zero. but when uncommenting the LPC-line in the loop, you will see the difference)
I would be very thankful for your help.
Hi at all!
I would like to calculate the lpc in a frame/block and filter this frame. (The framesize is 1024 samples long and has been decomposed of my original vector x with a hop size of 50%)
I am using Matlab and have the problem, that when I reassemble the frame, for which I have calculated the lpc and then executed the filter, the resulting envelopes fractions (portions of 1024 samples) does not fit at each other. Not only the first samples of the actual block dont fit to the last samples of the previos block, the whole envelope seems to be shifted above or below. (I considered the overlapping)
I guess, this is due to the fact, that I always recalculate the lpc coefficients for each block. When not doing so, and instead just calculating the coeffs at once by using the whole vector, my overlapping algorithm with the filtering works fine. But I want to use it as a realtime application later in C, so I won´t have the whole vector x
So my question in short would be:
How to use LPC with subsequent filtering, when applying on overlapping frames and recalculating the coeffs for each frame?
(The Purpose is, to build a transient Detector as a realtime app (VST-Plug-In) which works frame based.)
If you like, here is a minimal code example, which is really very raw and dirty . By default, it works (the difference between the algorithm as a vector and the block based algorithm is zero. but when uncommenting the LPC-line in the loop, you will see the difference)
Code:
clc, clear all;
x=1:20;
hop = 2;
frameLen = 4;
yyy = [];
a = lpc(x,1);
y = filter([0 -a(2:end)],1,x);
plot (y(1:10),'r')
for i=1:4
frameRange = (1:frameLen) + (i-1)*hop;
xFrame = x(frameRange);
% a = lpc(xFrame,1); % when using this line, it won´t work any more.
yy(i,1:frameLen) = filter([0 -a(2:end)],1,xFrame);
yyy = [yyy yy(i,1+hop:frameLen)];
hold on
plot (frameRange,yy(i,1:frameLen),'k')
hold off
end
y
yyy = [yy(1,1:hop) yyy]
diff = y(1:length(yyy)) - yyy
hold on
plot (yyy,'--r')
hold off
I would be very thankful for your help.