1 /********************************************************************** 2 3 Audacity: A Digital Audio Editor 4 5 InterpolateAudio.h 6 7 Dominic Mazzoni 8 9 *******************************************************************//*! 10 11 \file Matrix.h 12 \brief General routine to interpolate (or even extrapolate small amounts) 13 audio when a few of the samples are bad. Works great for a few 14 dozen bad samples, but not so well with hundreds. Uses the 15 least-squares autoregression (LSAR) algorithm, as described in: 16 17 Simon Godsill, Peter Rayner, and Olivier Cappe. Digital Audio Restoration. 18 Berlin: Springer, 1998. 19 20 This is the same work used by Gnome Wave Cleaner (GWC), however this 21 implementation is original. 22 23 *//*******************************************************************/ 24 25 #ifndef __AUDACITY_INTERPOLATE_AUDIO__ 26 #define __AUDACITY_INTERPOLATE_AUDIO__ 27 28 #include <cstddef> 29 30 // See top of file for a description of the algorithm. Interpolates 31 // the samples from buffer[firstBad] through buffer[firstBad+numBad-1], 32 // ignoring whatever value was there previously, and replacing them with 33 // values determined from the surrounding audio. Works best if the bad 34 // samples are in the middle, with several times as much data on either 35 // side (6x the number of bad samples on either side is great). However, 36 // it will work with less data, and with the bad samples on one end or 37 // the other. 38 void MATH_API InterpolateAudio(float *buffer, size_t len, 39 size_t firstBad, size_t numBad); 40 41 #endif // __AUDACITY_INTERPOLATE_AUDIO__ 42