Assume I have a 48Khz samplerate audio stream, and every fourth sample is lost. The original material was filtered to about 22KHz. I was surprised to see that every 4th sample lost causes an alias around 6KHz as well as 12KHz. What I want to do is to "guess" a new value for the missing sample that will minimize the error components, especially those aliased around 6KHz. I know there is no perfect solution. What is an optimal solution (besides better error correction) to conceal this error? Bruce
interpolating every 4th sample
Started by ●March 1, 2007
Reply by ●March 1, 20072007-03-01
On 1 Mrz., 08:55, "doh ..." <s...@nospam.com> wrote:> Assume I have a 48Khz samplerate audio stream, and every fourth sample is > lost. The original material > was filtered to about 22KHz. > > I was surprised to see that every 4th sample lost causes an alias around > 6KHz as well as 12KHz. > > What I want to do is to "guess" a new value for the missing sample that will > minimize the error components, > especially those aliased around 6KHz. I know there is no perfect solution. > > What is an optimal solution (besides better error correction) to conceal > this error?It certainly isn't optimal, but why not use polynomial interpolation, using some neighbours from each side? For example, using two neighbours on each side gives you a third order polynomial interpolation function. Try out different orders to see which gives you best result for your signal. Another approach would be to use a periodic function as interpolation kernel. Again using the same number of neighbours from each side, compute the periodic function that passes through the neighbour values. Regards, Andor
Reply by ●March 1, 20072007-03-01
Andor wrote:>>Assume I have a 48Khz samplerate audio stream, and every fourth sample is >>lost. The original material was filtered to about 22KHz. >> >>What I want to do is to "guess" a new value for the missing sample that will >>minimize the error components, >>especially those aliased around 6KHz. I know there is no perfect solution. >> > It certainly isn't optimal, but why not use polynomial interpolation, > using some neighbours from each side? For example, using two > neighbours on each side gives you a third order polynomial > interpolation function. Try out different orders to see which gives > you best result for your signal.The polynomial interpolation is simple, however the results will be wildly wrong at the high frequencies. The interpolation using LPC or Kalman filter is much better for this application. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
Reply by ●March 1, 20072007-03-01
doh ... wrote:> Assume I have a 48Khz samplerate audio stream, and every fourth sample is > lost. The original material > was filtered to about 22KHz. > > I was surprised to see that every 4th sample lost causes an alias around > 6KHz as well as 12KHz. > > What I want to do is to "guess" a new value for the missing sample that will > minimize the error components, > especially those aliased around 6KHz. I know there is no perfect solution. > > What is an optimal solution (besides better error correction) to conceal > this error?Who stole your samples? Replacing every fourth sample with zero amounts to multiplying -- modulating, that is -- by the the signal 11101110.... Modulation theory predicts the results you see, so it oughtn't surprise you after thinking on it. Jerry -- Engineering is the art of making what you want from things you can get. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Reply by ●March 1, 20072007-03-01
Jerry Avins wrote:>> Assume I have a 48Khz samplerate audio stream, and every fourth sample is >> lost.> Who stole your samples?The professor, probably... VLV
Reply by ●March 1, 20072007-03-01
On 1 Mrz., 15:15, Vladimir Vassilevsky <antispam_bo...@hotmail.com> wrote:> Andor wrote: > >>Assume I have a 48Khz samplerate audio stream, and every fourth sample is > >>lost. The original material was filtered to about 22KHz. > > >>What I want to do is to "guess" a new value for the missing sample that will > >>minimize the error components, > >>especially those aliased around 6KHz. I know there is no perfect solution. > > > It certainly isn't optimal, but why not use polynomial interpolation, > > using some neighbours from each side? For example, using two > > neighbours on each side gives you a third order polynomial > > interpolation function. Try out different orders to see which gives > > you best result for your signal. > > The polynomial interpolation is simple, however the results will be > wildly wrong at the high frequencies. The interpolation using LPC or > Kalman filter is much better for this application.The reason I didn't mention LPC was that the prediction equations are seriously disturbed by the zeros. It's well possible that the zeros get modeled right into the data, and the LPC extrapolation for the deleted sample will be close to zero again (I've seen this happen in a similar case). For very short segments such as one single sample, polynomial interoplation usually works quite well for audio. If the OP is not happy with the results, I would go for the periodic interpolation, which can incorporate much more samples than polynomial interpolation, and gives a pretty good bandlimited approximation for the missing data points. Regards, Andor
Reply by ●March 1, 20072007-03-01
Andor wrote:>>>>Assume I have a 48Khz samplerate audio stream, and every fourth sample is >>>>lost. The original material was filtered to about 22KHz.>>>It certainly isn't optimal, but why not use polynomial interpolation, >>>using some neighbours from each side?>>The polynomial interpolation is simple, however the results will be >>wildly wrong at the high frequencies. The interpolation using LPC or >>Kalman filter is much better for this application. >> The reason I didn't mention LPC was that the prediction equations are > seriously disturbed by the zeros.It is probably possible to modify the equations so zeroes will be ignored. This would be a good exercise in math.> It's well possible that the zeros > get modeled right into the data, and the LPC extrapolation for the > deleted sample will be close to zero again (I've seen this happen in a > similar case).Instead of zeroes, the interpolated data from the past can be used for the prediction. There is a certain potential for ill behavior in the singular cases, however it is unlikely with the realistic audio signals.> For very short segments such as one single sample, polynomial > interoplation usually works quite well for audio.That's what they do in the CD players.> If the OP is not > happy with the results, I would go for the periodic interpolation, > which can incorporate much more samples than polynomial interpolation, > and gives a pretty good bandlimited approximation for the missing data > points.Agreed. The interpolation in the frq. domain is pretty straightforward and the approximation would be quite good. VLV
Reply by ●March 1, 20072007-03-01
On 1 Mrz., 16:06, Vladimir Vassilevsky <antispam_bo...@hotmail.com> wrote:> Andor wrote: > >>>>Assume I have a 48Khz samplerate audio stream, and every fourth sample is > >>>>lost. The original material was filtered to about 22KHz. > >>>It certainly isn't optimal, but why not use polynomial interpolation, > >>>using some neighbours from each side? > >>The polynomial interpolation is simple, however the results will be > >>wildly wrong at the high frequencies. The interpolation using LPC or > >>Kalman filter is much better for this application. > > > The reason I didn't mention LPC was that the prediction equations are > > seriously disturbed by the zeros. > > It is probably possible to modify the equations so zeroes will be > ignored. This would be a good exercise in math.That would limit you to prediction order 2 or smaller. Larger order predictors necessarily contain zero samples in any prediction equation. If a second order predictor is used, each batch of 3 consecutive non-stolen samples yiels an equation, and one can use the standard least-squares to compute the prediction coefficients. It remains that a second-order predictor probably doesn't do much better than polynomial interpolation.> > > It's well possible that the zeros > > get modeled right into the data, and the LPC extrapolation for the > > deleted sample will be close to zero again (I've seen this happen in a > > similar case). > > Instead of zeroes, the interpolated data from the past can be used for > the prediction. There is a certain potential for ill behavior in the > singular cases, however it is unlikely with the realistic audio signals.Yes, an iterative approach could be possible. First interpolate using low-order predictor or polynomials, then use higher-order predictors.> > > For very short segments such as one single sample, polynomial > > interoplation usually works quite well for audio. > > That's what they do in the CD players.I thought CD players sample-and-hold ...> > > If the OP is not > > happy with the results, I would go for the periodic interpolation, > > which can incorporate much more samples than polynomial interpolation, > > and gives a pretty good bandlimited approximation for the missing data > > points. > > Agreed. The interpolation in the frq. domain is pretty straightforward > and the approximation would be quite good.Yes, it's probably the best way to proceed for this problem. Regards, Andor
Reply by ●March 1, 20072007-03-01
Andor wrote:>>>The reason I didn't mention LPC was that the prediction equations are >>>seriously disturbed by the zeros. >> >>It is probably possible to modify the equations so zeroes will be >>ignored. This would be a good exercise in math. > > > That would limit you to prediction order 2 or smaller. Larger order > predictors necessarily contain zero samples in any prediction > equation.Why it has to be that way? It seems possible to restate the linear prediction problem so the every 4-th sample will be skipped. VLV
Reply by ●March 1, 20072007-03-01
Vladimir Vassilevsky wrote:> > > Andor wrote: > > >>>> The reason I didn't mention LPC was that the prediction equations are >>>> seriously disturbed by the zeros. >>> >>> It is probably possible to modify the equations so zeroes will be >>> ignored. This would be a good exercise in math. >> >> >> That would limit you to prediction order 2 or smaller. Larger order >> predictors necessarily contain zero samples in any prediction >> equation. > > Why it has to be that way? It seems possible to restate the linear > prediction problem so the every 4-th sample will be skipped.Certainly. And a polynomial interpolation that uses the three samples on each side of a stolen one is probably adequate and simple enough so it's probably what the klepto-professor had in mind. Jerry -- Engineering is the art of making what you want from things you can get. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯






