Reply by Stephan M. Bernsee November 7, 20042004-11-07
On 2004-11-04 10:07:35 +0100, Andor Bariska <an2or@nospam.net> said:

> That's true - as I wrote originally, one needs the assumption of > (local) stationarity of the signal for the algorithm to work. For short > drop-outs (< 20 samples), this is generally ok. For longer stretches > (as in a slowly increasing pitch section), this becomes a problem. > > The next step would be to try to find a non-stationary model, such as > ARIMA or fractional ARIMA or something else. Highly non-trivial. > > Regards, > Andor
Yes I agree. Clearly, most of the problems of DSP techniques (at least in the area I'm working in) come from the assumption of short-time stationarity, which is a helpful concept to begin with but can't be ignored if you really need very high-end stuff... -- Stephan M. Bernsee http://www.dspdimension.com
Reply by Andor Bariska November 4, 20042004-11-04
Stephan M. Bernsee wrote:
> On 2004-11-03 17:08:44 +0100, Andor Bariska <an2or@nospam.net> said: > >> Stephan M. Bernsee wrote: >> >>> To do this right you need to do the same backwards in time from the >>> end of the missing segment and blend the sinusoidal parameters >>> between the two sets. Then you'll have to sort out ambiguity (what >>> oscillator at the beginning of the gap corresponds to which one at >>> the end)... this can be fairly complicated it you want to do it right. >> >> >> There is no need to do that - one can just crossfade the (forwards and >> backwards) oscillator outputs. > > > Not sure if that's enough... imagine a singer singing a note at slowly > increasing pitch. If you simply crossfade between the two segments > you'll hear a glitch. If you track the pitch across the gap and match > the oscillators you get the correct result...
That's true - as I wrote originally, one needs the assumption of (local) stationarity of the signal for the algorithm to work. For short drop-outs (< 20 samples), this is generally ok. For longer stretches (as in a slowly increasing pitch section), this becomes a problem. The next step would be to try to find a non-stationary model, such as ARIMA or fractional ARIMA or something else. Highly non-trivial. Regards, Andor
Reply by Stephan M. Bernsee November 4, 20042004-11-04
On 2004-11-04 08:21:11 +0100, Bernhard Holzmayer 
<Holzmayer.Bernhard@deadspam.com> said:

> I'd probably solve it for the real parts. With the imag parts? - Either > do the same, or just average the two values. > I don't know which is more appropriate.
I still don't get it - what exactly are you trying to do? -- Stephan M. Bernsee http://www.dspdimension.com
Reply by Bernhard Holzmayer November 4, 20042004-11-04
Andor Bariska wrote:

> Bernhard Holzmayer wrote: > ... >> build a new FFT signal where at every frequency bin newFFT=min(FFT1,FFT2) > > What's the min of two complex numbers?
Right, should have been more precise. Since it's a real audio stream, I guess that optimal phase response isn't so important as long as the loudest portions are suppressed. I'd probably solve it for the real parts. With the imag parts? - Either do the same, or just average the two values. I don't know which is more appropriate. I guess, it's more important for the OP to find a quick and dirty solution which provides an agreable result, than to identify an optimal algorithm. Bernhard
Reply by Stephan M. Bernsee November 3, 20042004-11-03
On 2004-11-03 17:08:44 +0100, Andor Bariska <an2or@nospam.net> said:

> Stephan M. Bernsee wrote: >> To do this right you need to do the same backwards in time from the end >> of the missing segment and blend the sinusoidal parameters between the >> two sets. Then you'll have to sort out ambiguity (what oscillator at >> the beginning of the gap corresponds to which one at the end)... this >> can be fairly complicated it you want to do it right. > > There is no need to do that - one can just crossfade the (forwards and > backwards) oscillator outputs.
Not sure if that's enough... imagine a singer singing a note at slowly increasing pitch. If you simply crossfade between the two segments you'll hear a glitch. If you track the pitch across the gap and match the oscillators you get the correct result... -- Stephan M. Bernsee http://www.dspdimension.com
Reply by Andor Bariska November 3, 20042004-11-03
Stephan M. Bernsee wrote:
> On 2004-11-03 15:45:39 +0100, Andor Bariska <an2or@nospam.net> said: > >> [snip] >> For a complex signal (music or speech for example), you may assume >> that it is the sum of several exponentially (or otherwise) damped sine >> waves with constant frequency (at least for short stationary >> stretches, this is quite a sensible assumption). Now you can find >> (again with least-squares, but there are better algorithms) the >> coefficients for all oscillators by looking at a bunch of samples from >> the signal just before (and after) the corrupted stretch. >> [snip] > > > To do this right you need to do the same backwards in time from the end > of the missing segment and blend the sinusoidal parameters between the > two sets. Then you'll have to sort out ambiguity (what oscillator at the > beginning of the gap corresponds to which one at the end)... this can be > fairly complicated it you want to do it right.
There is no need to do that - one can just crossfade the (forwards and backwards) oscillator outputs. There are however many improvements possible on the crude process I sketched above. Check the references I gave. Regards, Andor
Reply by Stephan M. Bernsee November 3, 20042004-11-03
On 2004-11-03 15:45:39 +0100, Andor Bariska <an2or@nospam.net> said:

> [snip] > For a complex signal (music or speech for example), you may assume that > it is the sum of several exponentially (or otherwise) damped sine waves > with constant frequency (at least for short stationary stretches, this > is quite a sensible assumption). Now you can find (again with > least-squares, but there are better algorithms) the coefficients for > all oscillators by looking at a bunch of samples from the signal just > before (and after) the corrupted stretch. > [snip]
To do this right you need to do the same backwards in time from the end of the missing segment and blend the sinusoidal parameters between the two sets. Then you'll have to sort out ambiguity (what oscillator at the beginning of the gap corresponds to which one at the end)... this can be fairly complicated it you want to do it right. For this, you could estimate sweep and ramp rates of the sinusoids to get a good match, or use a HMM for tracking them across the gap. You can probably invest as much time as you wish into "solving" this problem. -- Stephan M. Bernsee http://www.dspdimension.com
Reply by Andor Bariska November 3, 20042004-11-03
DavidSaunders9 wrote:
> Hi > > I am looking at fixing corrupt audio files by interpolating the wave > pattern that should be present in place of the corrupt segment. I have > been looking at 'cubic interpolation' but it seems to me that this > scheme is only useful in interpolating individual sample values, not > in interpolating whole missing segments of data. Am I correct in this > thinking or is it possible to use this scheme to interpolate the > missing segment? If it is not suitable, are there any other > algorithms/schemes that may be useful?
Immagine you had a pure sine wave of unknown frequency, phase and amplitude. You know that some stretches of this sine wave are zeroed out (for whatever reason), and you want to fix that. What do you do? A sensible idea would be to take the recursive equation for an oscillator, and find the coefficients with least-squares which result in something close to your sine wave (exact, if the sine wave samples contain no error). Then, after you have initialized the oscillator (with the coefficients and the last two samples of the sine wave before the zero stretch), just take the output of the oscillator to reconstruct the sine wave. For a complex signal (music or speech for example), you may assume that it is the sum of several exponentially (or otherwise) damped sine waves with constant frequency (at least for short stationary stretches, this is quite a sensible assumption). Now you can find (again with least-squares, but there are better algorithms) the coefficients for all oscillators by looking at a bunch of samples from the signal just before (and after) the corrupted stretch. The fancy name for this is extrapolation (or interpolation) with AR modelling. W. Etter,S. J. Godsill and I. Kauppinen are people who have done interesting work on this (try searching DAFx, AES and IEEE). Regards, Andor
Reply by Andor Bariska November 3, 20042004-11-03
Bernhard Holzmayer wrote:
...
> build a new FFT signal where at every frequency bin newFFT=min(FFT1,FFT2)
What's the min of two complex numbers?
Reply by Bernhard Holzmayer November 3, 20042004-11-03
DavidSaunders9 wrote:

> Hi > > I am looking at fixing corrupt audio files by interpolating the wave > pattern that should be present in place of the corrupt segment. I have > been looking at 'cubic interpolation' but it seems to me that this > scheme is only useful in interpolating individual sample values, not > in interpolating whole missing segments of data. Am I correct in this > thinking or is it possible to use this scheme to interpolate the > missing segment? If it is not suitable, are there any other > algorithms/schemes that may be useful? > > Any help is much appreciated > > Thankyou very much > > David Saunders
What about this link: "Interpolation of long gaps in audio signals..." http://www.elec.qmul.ac.uk/dafx03/proceedings/pdfs/dafx10.pdf Bernhard