mirror of
https://github.com/cookiengineer/audacity
synced 2025-12-11 23:26:28 +01:00
New library for math...
... note the swap of target_link_libraries lines in src/CMakeLists.txt, needed to build at least on macOS, becuase FFT.h must be looked up first in lib-math, not in lib-src/twolame Also making a dependency cycle of SampleFormat and Dither! But we will tolerate that within one small library.
This commit is contained in:
41
libraries/lib-math/InterpolateAudio.h
Normal file
41
libraries/lib-math/InterpolateAudio.h
Normal file
@@ -0,0 +1,41 @@
|
||||
/**********************************************************************
|
||||
|
||||
Audacity: A Digital Audio Editor
|
||||
|
||||
InterpolateAudio.h
|
||||
|
||||
Dominic Mazzoni
|
||||
|
||||
*******************************************************************//*!
|
||||
|
||||
\file Matrix.h
|
||||
\brief General routine to interpolate (or even extrapolate small amounts)
|
||||
audio when a few of the samples are bad. Works great for a few
|
||||
dozen bad samples, but not so well with hundreds. Uses the
|
||||
least-squares autoregression (LSAR) algorithm, as described in:
|
||||
|
||||
Simon Godsill, Peter Rayner, and Olivier Cappe. Digital Audio Restoration.
|
||||
Berlin: Springer, 1998.
|
||||
|
||||
This is the same work used by Gnome Wave Cleaner (GWC), however this
|
||||
implementation is original.
|
||||
|
||||
*//*******************************************************************/
|
||||
|
||||
#ifndef __AUDACITY_INTERPOLATE_AUDIO__
|
||||
#define __AUDACITY_INTERPOLATE_AUDIO__
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
// See top of file for a description of the algorithm. Interpolates
|
||||
// the samples from buffer[firstBad] through buffer[firstBad+numBad-1],
|
||||
// ignoring whatever value was there previously, and replacing them with
|
||||
// values determined from the surrounding audio. Works best if the bad
|
||||
// samples are in the middle, with several times as much data on either
|
||||
// side (6x the number of bad samples on either side is great). However,
|
||||
// it will work with less data, and with the bad samples on one end or
|
||||
// the other.
|
||||
void MATH_API InterpolateAudio(float *buffer, size_t len,
|
||||
size_t firstBad, size_t numBad);
|
||||
|
||||
#endif // __AUDACITY_INTERPOLATE_AUDIO__
|
||||
Reference in New Issue
Block a user