Audacity  3.0.3
Classes | Public Types | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Private Member Functions | Private Attributes | List of all members
EffectNoiseReduction::Worker Class Referencefinal
Inheritance diagram for EffectNoiseReduction::Worker:
[legend]
Collaboration diagram for EffectNoiseReduction::Worker:
[legend]

Classes

struct  MyWindow
 

Public Types

typedef EffectNoiseReduction::Settings Settings
 
typedef EffectNoiseReduction::Statistics Statistics
 
- Public Types inherited from SpectrumTransformer
using FloatVector = std::vector< float >
 
using WindowProcessor = std::function< bool(SpectrumTransformer &) >
 Type of function that transforms windows in the queue. More...
 

Public Member Functions

 Worker (eWindowFunctions inWindowType, eWindowFunctions outWindowType, EffectNoiseReduction &effect, const Settings &settings, Statistics &statistics)
 
 ~Worker ()
 
bool Process (TrackList &tracks, double mT0, double mT1)
 
- Public Member Functions inherited from TrackSpectrumTransformer
 ~TrackSpectrumTransformer () override
 
bool Process (const WindowProcessor &processor, WaveTrack *track, size_t queueLength, sampleCount start, sampleCount len)
 Invokes Start(), ProcessSamples(), and Finish() More...
 
 SpectrumTransformer (bool needsOutput, eWindowFunctions inWindowType, eWindowFunctions outWindowType, size_t windowSize, unsigned stepsPerWindow, bool leadingPadding, bool trailingPadding)
 
- Public Member Functions inherited from SpectrumTransformer
 SpectrumTransformer (bool needsOutput, eWindowFunctions inWindowType, eWindowFunctions outWindowType, size_t windowSize, unsigned stepsPerWindow, bool leadingPadding, bool trailingPadding)
 
virtual ~SpectrumTransformer ()
 
bool NeedsOutput () const
 
bool Start (size_t queueLength)
 Call once before a sequence of calls to ProcessSamples; Invokes DoStart. More...
 
bool ProcessSamples (const WindowProcessor &processor, const float *buffer, size_t len)
 Call multiple times. More...
 
bool Finish (const WindowProcessor &processor)
 Call once after a sequence of calls to ProcessSamples; flushes the queue and Invokes DoFinish. More...
 
size_t TotalQueueSize () const
 Useful functions to implement WindowProcesser: More...
 
size_t CurrentQueueSize () const
 How many windows in the queue have been filled? More...
 
bool QueueIsFull () const
 
WindowNth (int n)
 Access the queue, so you can inspect and modify any window in it. More...
 
WindowNewest ()
 
WindowLatest ()
 

Protected Member Functions

MyWindowNthWindow (int nn)
 
std::unique_ptr< WindowNewWindow (size_t windowSize) override
 Allocates a window to place in the queue. More...
 
bool DoStart () override
 Called before any calls to ProcessWindow. More...
 
bool DoFinish () override
 Called after the last call to ProcessWindow(). More...
 
- Protected Member Functions inherited from TrackSpectrumTransformer
bool DoStart () override
 Called before any calls to ProcessWindow. More...
 
void DoOutput (const float *outBuffer, size_t mStepSize) override
 Called within ProcessSamples if output was requested. More...
 
bool DoFinish () override
 Called after the last call to ProcessWindow(). More...
 

Static Protected Member Functions

static bool Processor (SpectrumTransformer &transformer)
 

Private Member Functions

void ApplyFreqSmoothing (FloatVector &gains)
 
void GatherStatistics ()
 
bool Classify (unsigned nWindows, int band)
 
void ReduceNoise ()
 
void FinishTrackStatistics ()
 

Private Attributes

const bool mDoProfile
 
EffectNoiseReductionmEffect
 
StatisticsmStatistics
 
FloatVector mFreqSmoothingScratch
 
const size_t mFreqSmoothingBins
 
size_t mBinLow
 
size_t mBinHigh
 
const int mNoiseReductionChoice
 
const int mMethod
 
const double mNewSensitivity
 
float mOneBlockAttack
 
float mOneBlockRelease
 
float mNoiseAttenFactor
 
float mOldSensitivityFactor
 
unsigned mNWindowsToExamine
 
unsigned mCenter
 
unsigned mHistoryLen
 
unsigned mProgressTrackCount = 0
 
sampleCount mLen = 0
 
sampleCount mProgressWindowCount = 0
 

Additional Inherited Members

- Protected Attributes inherited from SpectrumTransformer
const size_t mWindowSize
 
const size_t mSpectrumSize
 
const unsigned mStepsPerWindow
 
const size_t mStepSize
 
const bool mLeadingPadding
 
const bool mTrailingPadding
 

Detailed Description

Definition at line 257 of file NoiseReduction.cpp.

Member Typedef Documentation

◆ Settings

Definition at line 261 of file NoiseReduction.cpp.

◆ Statistics

Definition at line 262 of file NoiseReduction.cpp.

Constructor & Destructor Documentation

◆ Worker()

EffectNoiseReduction::Worker::Worker ( eWindowFunctions  inWindowType,
eWindowFunctions  outWindowType,
EffectNoiseReduction effect,
const Settings settings,
Statistics statistics 
)

Definition at line 779 of file NoiseReduction.cpp.

787 : TrackSpectrumTransformer{ !settings.mDoProfile, inWindowType, outWindowType,
790 }
792 
793 , mEffect{ effect }
794 , mStatistics{ statistics }
795 
797 , mFreqSmoothingBins{ size_t(std::max(0.0, settings.mFreqSmoothingBands)) }
798 , mBinLow{ 0 }
800 
803 
804 // Sensitivity setting is a base 10 log, turn it into a natural log
806 {
807  const auto sampleRate = mStatistics.mRate;
808 
809 #ifdef EXPERIMENTAL_SPECTRAL_EDITING
810  {
811  // mBinLow is inclusive, mBinHigh is exclusive, of
812  // the range of frequencies to affect. Include any
813  // bin that partly overlaps the selected range of frequencies.
814  const double bin = sampleRate / mWindowSize;
815  if (f0 >= 0.0 )
816  mBinLow = floor(f0 / bin);
817  if (f1 >= 0.0)
818  mBinHigh = ceil(f1 / bin);
819  }
820 #endif
821 
822  const double noiseGain = -settings.mNoiseGain;
823  const unsigned nAttackBlocks = 1 + (int)(settings.mAttackTime * sampleRate / mStepSize);
824  const unsigned nReleaseBlocks = 1 + (int)(settings.mReleaseTime * sampleRate / mStepSize);
825  // Applies to amplitudes, divide by 20:
826  mNoiseAttenFactor = DB_TO_LINEAR(noiseGain);
827  // Apply to gain factors which apply to amplitudes, divide by 20:
828  mOneBlockAttack = DB_TO_LINEAR(noiseGain / nAttackBlocks);
829  mOneBlockRelease = DB_TO_LINEAR(noiseGain / nReleaseBlocks);
830  // Applies to power, divide by 10:
831  mOldSensitivityFactor = pow(10.0, settings.mOldSensitivity / 10.0);
832 
834  ? std::max(2, (int)(minSignalTime * sampleRate / mStepSize))
835  : 1 + mStepsPerWindow;
836 
838  wxASSERT(mCenter >= 1); // release depends on this assumption
839 
840  if (mDoProfile)
841 #ifdef OLD_METHOD_AVAILABLE
843 #else
844  mHistoryLen = 1;
845 #endif
846  else {
847  // Allow long enough queue for sufficient inspection of the middle
848  // and for attack processing
849  // See ReduceNoise()
850  mHistoryLen = std::max(mNWindowsToExamine, mCenter + nAttackBlocks);
851  }
852 }

References EffectNoiseReduction::Settings::mDoProfile, settings(), EffectNoiseReduction::Settings::StepsPerWindow(), and EffectNoiseReduction::Settings::WindowSize().

Here is the call graph for this function:

◆ ~Worker()

EffectNoiseReduction::Worker::~Worker ( )

Definition at line 691 of file NoiseReduction.cpp.

692 {
693 }

Member Function Documentation

◆ ApplyFreqSmoothing()

void EffectNoiseReduction::Worker::ApplyFreqSmoothing ( FloatVector gains)
private

Definition at line 748 of file NoiseReduction.cpp.

749 {
750  // Given an array of gain mutipliers, average them
751  // GEOMETRICALLY. Don't multiply and take nth root --
752  // that may quickly cause underflows. Instead, average the logs.
753 
754  if (mFreqSmoothingBins == 0)
755  return;
756 
757  {
758  auto pScratch = mFreqSmoothingScratch.data();
759  std::fill(pScratch, pScratch + mSpectrumSize, 0.0f);
760  }
761 
762  for (size_t ii = 0; ii < mSpectrumSize; ++ii)
763  gains[ii] = log(gains[ii]);
764 
765  // ii must be signed
766  for (int ii = 0; ii < (int)mSpectrumSize; ++ii) {
767  const int j0 = std::max(0, ii - (int)mFreqSmoothingBins);
768  const int j1 = std::min(mSpectrumSize - 1, ii + mFreqSmoothingBins);
769  for(int jj = j0; jj <= j1; ++jj) {
770  mFreqSmoothingScratch[ii] += gains[jj];
771  }
772  mFreqSmoothingScratch[ii] /= (j1 - j0 + 1);
773  }
774 
775  for (size_t ii = 0; ii < mSpectrumSize; ++ii)
776  gains[ii] = exp(mFreqSmoothingScratch[ii]);
777 }

References min().

Here is the call graph for this function:

◆ Classify()

bool EffectNoiseReduction::Worker::Classify ( unsigned  nWindows,
int  band 
)
inlineprivate

Definition at line 953 of file NoiseReduction.cpp.

954 {
955  switch (mMethod) {
956 #ifdef OLD_METHOD_AVAILABLE
957  case DM_OLD_METHOD:
958  {
959  float min = NthWindow(0).mSpectrums[band];
960  for (unsigned ii = 1; ii < nWindows; ++ii)
961  min = std::min(min, NthWindow(ii).mSpectrums[band]);
962  return
963  min <= mOldSensitivityFactor * mStatistics.mNoiseThreshold[band];
964  }
965 #endif
966  // New methods suppose an exponential distribution of power values
967  // in the noise; NEW sensitivity (which is nonnegative) is meant to be
968  // the negative of a log of probability (so the log is nonpositive)
969  // that noise strays above the threshold. Call that probability
970  // 1 - F. The quantile function of an exponential distribution is
971  // - log (1 - F) * mean. Thus simply multiply mean by sensitivity
972  // to get the threshold.
973  case DM_MEDIAN:
974  // This method examines the window and all other windows
975  // whose centers lie on or between its boundaries, and takes a median, to
976  // avoid being fooled by up and down excursions into
977  // either the mistake of classifying noise as not noise
978  // (leaving a musical noise chime), or the opposite
979  // (distorting the signal with a drop out).
980  if (nWindows <= 3)
981  // No different from second greatest.
982  goto secondGreatest;
983  else if (nWindows <= 5)
984  {
985  float greatest = 0.0, second = 0.0, third = 0.0;
986  for (unsigned ii = 0; ii < nWindows; ++ii) {
987  const float power = NthWindow(ii).mSpectrums[band];
988  if (power >= greatest)
989  third = second, second = greatest, greatest = power;
990  else if (power >= second)
991  third = second, second = power;
992  else if (power >= third)
993  third = power;
994  }
995  return third <= mNewSensitivity * mStatistics.mMeans[band];
996  }
997  else {
998  // not implemented
999  wxASSERT(false);
1000  return true;
1001  }
1002  secondGreatest:
1003  case DM_SECOND_GREATEST:
1004  {
1005  // This method just throws out the high outlier. It
1006  // should be less prone to distortions and more prone to
1007  // chimes.
1008  float greatest = 0.0, second = 0.0;
1009  for (unsigned ii = 0; ii < nWindows; ++ii) {
1010  const float power = NthWindow(ii).mSpectrums[band];
1011  if (power >= greatest)
1012  second = greatest, greatest = power;
1013  else if (power >= second)
1014  second = power;
1015  }
1016  return second <= mNewSensitivity * mStatistics.mMeans[band];
1017  }
1018  default:
1019  wxASSERT(false);
1020  return true;
1021  }
1022 }

References anonymous_namespace{NoiseReduction.cpp}::DM_MEDIAN, anonymous_namespace{NoiseReduction.cpp}::DM_OLD_METHOD, anonymous_namespace{NoiseReduction.cpp}::DM_SECOND_GREATEST, min(), and EffectNoiseReduction::mStatistics.

Here is the call graph for this function:

◆ DoFinish()

bool EffectNoiseReduction::Worker::DoFinish ( )
overrideprotectedvirtual

Called after the last call to ProcessWindow().

Returns
false to abort processing. Default implementation just returns true.

Reimplemented from SpectrumTransformer.

Definition at line 1148 of file NoiseReduction.cpp.

1149 {
1150  if (mDoProfile)
1153 }

References TrackSpectrumTransformer::DoFinish().

Here is the call graph for this function:

◆ DoStart()

bool EffectNoiseReduction::Worker::DoStart ( )
overrideprotectedvirtual

Called before any calls to ProcessWindow.

More queue initializations can be done here.

Returns
false to abort processing. Default implementation just returns true.

Reimplemented from SpectrumTransformer.

Definition at line 854 of file NoiseReduction.cpp.

855 {
856  for (size_t ii = 0, nn = TotalQueueSize(); ii < nn; ++ii) {
857  MyWindow &record = NthWindow(ii);
858  std::fill(record.mSpectrums.begin(), record.mSpectrums.end(), 0.0);
859  std::fill(record.mGains.begin(), record.mGains.end(), mNoiseAttenFactor);
860  }
862 }

References TrackSpectrumTransformer::DoStart(), EffectNoiseReduction::Worker::MyWindow::mGains, and EffectNoiseReduction::Worker::MyWindow::mSpectrums.

Here is the call graph for this function:

◆ FinishTrackStatistics()

void EffectNoiseReduction::Worker::FinishTrackStatistics ( )
private

Definition at line 894 of file NoiseReduction.cpp.

895 {
896  const auto windows = mStatistics.mTrackWindows;
897 
898  // Combine averages in case of multiple profile tracks.
899  if (windows) {
900  const auto multiplier = mStatistics.mTotalWindows;
901  const auto denom = windows + multiplier;
902  for (size_t ii = 0, nn = mStatistics.mMeans.size(); ii < nn; ++ii) {
903  auto &mean = mStatistics.mMeans[ii];
904  auto &sum = mStatistics.mSums[ii];
905  mean = (mean * multiplier + sum) / denom;
906  // Reset for next track
907  sum = 0;
908  }
909  // Reset for next track
911  mStatistics.mTotalWindows = denom;
912  }
913 }

References EffectNoiseReduction::mStatistics.

◆ GatherStatistics()

void EffectNoiseReduction::Worker::GatherStatistics ( )
private

Definition at line 915 of file NoiseReduction.cpp.

916 {
918 
919  {
920  // NEW statistics
921  auto pPower = NthWindow(0).mSpectrums.data();
922  auto pSum = mStatistics.mSums.data();
923  for (size_t jj = 0; jj < mSpectrumSize; ++jj) {
924  *pSum++ += *pPower++;
925  }
926  }
927 
928 #ifdef OLD_METHOD_AVAILABLE
929  // The noise threshold for each frequency is the maximum
930  // level achieved at that frequency for a minimum of
931  // mMinSignalBlocks blocks in a row - the max of a min.
932 
933  auto finish = mHistoryLen;
934 
935  {
936  // old statistics
937  auto pPower = NthWindow(0).mSpectrums.data();
938  auto pThreshold = mStatistics.mNoiseThreshold.data();
939  for (size_t jj = 0; jj < mSpectrumSize; ++jj) {
940  float min = *pPower++;
941  for (unsigned ii = 1; ii < finish; ++ii)
942  min = std::min(min, NthWindow(ii).mSpectrums[jj]);
943  *pThreshold = std::max(*pThreshold, min);
944  ++pThreshold;
945  }
946  }
947 #endif
948 }

References min(), and EffectNoiseReduction::mStatistics.

Here is the call graph for this function:

◆ NewWindow()

auto EffectNoiseReduction::Worker::NewWindow ( size_t  windowSize)
overrideprotectedvirtual

Allocates a window to place in the queue.

Only when initializing – windows are recycled thereafter. You can derive from Window to add fields, and then override this factory function.

Reimplemented from SpectrumTransformer.

Definition at line 606 of file NoiseReduction.cpp.

608 {
609  return std::make_unique<MyWindow>(windowSize);
610 }

◆ NthWindow()

MyWindow& EffectNoiseReduction::Worker::NthWindow ( int  nn)
inlineprotected

Definition at line 289 of file NoiseReduction.cpp.

289 { return static_cast<MyWindow&>(Nth(nn)); }

References SpectrumTransformer::Nth().

Here is the call graph for this function:

◆ Process()

bool EffectNoiseReduction::Worker::Process ( TrackList tracks,
double  mT0,
double  mT1 
)

Definition at line 695 of file NoiseReduction.cpp.

697 {
699  for ( auto track : tracks.Selected< WaveTrack >() ) {
701  if (track->GetRate() != mStatistics.mRate) {
702  if (mDoProfile)
703  mEffect.Effect::MessageBox(
704  XO("All noise profile data must have the same sample rate.") );
705  else
706  mEffect.Effect::MessageBox(
707  XO(
708 "The sample rate of the noise profile must match that of the sound to be processed.") );
709  return false;
710  }
711 
712  double trackStart = track->GetStartTime();
713  double trackEnd = track->GetEndTime();
714  double t0 = std::max(trackStart, inT0);
715  double t1 = std::min(trackEnd, inT1);
716 
717  if (t1 > t0) {
718  auto start = track->TimeToLongSamples(t0);
719  auto end = track->TimeToLongSamples(t1);
720  const auto len = end - start;
721  mLen = len;
722  const auto extra = (mStepsPerWindow - 1) * mStepSize;
723  // Adjust denominator for presence or absence of padding,
724  // which makes the number of windows visited either more or less
725  // than the number of window steps in the data.
726  if (mDoProfile)
727  mLen -= extra;
728  else
729  mLen += extra;
730 
732  Processor, track, mHistoryLen, start, len ))
733  return false;
734  }
736  }
737 
738  if (mDoProfile) {
739  if (mStatistics.mTotalWindows == 0) {
740  mEffect.Effect::MessageBox(XO("Selected noise profile is too short."));
741  return false;
742  }
743  }
744 
745  return true;
746 }

References min(), EffectNoiseReduction::mStatistics, TrackSpectrumTransformer::Process(), TrackList::Selected(), and XO.

Here is the call graph for this function:

◆ Processor()

bool EffectNoiseReduction::Worker::Processor ( SpectrumTransformer transformer)
staticprotected

Definition at line 864 of file NoiseReduction.cpp.

865 {
866  auto &worker = static_cast<Worker &>(transformer);
867  // Compute power spectrum in the newest window
868  {
869  MyWindow &record = worker.NthWindow(0);
870  float *pSpectrum = &record.mSpectrums[0];
871  const double dc = record.mRealFFTs[0];
872  *pSpectrum++ = dc * dc;
873  float *pReal = &record.mRealFFTs[1], *pImag = &record.mImagFFTs[1];
874  for (size_t nn = worker.mSpectrumSize - 2; nn--;) {
875  const double re = *pReal++, im = *pImag++;
876  *pSpectrum++ = re * re + im * im;
877  }
878  const double nyquist = record.mImagFFTs[0];
879  *pSpectrum = nyquist * nyquist;
880  }
881 
882  if (worker.mDoProfile)
883  worker.GatherStatistics();
884  else
885  worker.ReduceNoise();
886 
887  // Update the Progress meter, let user cancel
888  return !worker.mEffect.TrackProgress(worker.mProgressTrackCount,
889  std::min(1.0,
890  ((++worker.mProgressWindowCount).as_double() * worker.mStepSize)
891  / worker.mLen.as_double()));
892 }

References min(), and EffectNoiseReduction::Worker::MyWindow::mSpectrums.

Here is the call graph for this function:

◆ ReduceNoise()

void EffectNoiseReduction::Worker::ReduceNoise ( )
private

Definition at line 1024 of file NoiseReduction.cpp.

1025 {
1026  auto historyLen = CurrentQueueSize();
1027  auto nWindows = std::min<unsigned>(mNWindowsToExamine, historyLen);
1028 
1030  {
1031  MyWindow &record = NthWindow(0);
1032  // Default all gains to the reduction factor,
1033  // until we decide to raise some of them later
1034  float *pGain = &record.mGains[0];
1035  std::fill(pGain, pGain + mSpectrumSize, mNoiseAttenFactor);
1036  }
1037 
1038  // Raise the gain for elements in the center of the sliding history
1039  // or, if isolating noise, zero out the non-noise
1040  if (nWindows > mCenter)
1041  {
1042  auto pGain = NthWindow(mCenter).mGains.data();
1044  // All above or below the selected frequency range is non-noise
1045  std::fill(pGain, pGain + mBinLow, 0.0f);
1046  std::fill(pGain + mBinHigh, pGain + mSpectrumSize, 0.0f);
1047  pGain += mBinLow;
1048  for (size_t jj = mBinLow; jj < mBinHigh; ++jj) {
1049  const bool isNoise = Classify(nWindows, jj);
1050  *pGain++ = isNoise ? 1.0 : 0.0;
1051  }
1052  }
1053  else {
1054  // All above or below the selected frequency range is non-noise
1055  std::fill(pGain, pGain + mBinLow, 1.0f);
1056  std::fill(pGain + mBinHigh, pGain + mSpectrumSize, 1.0f);
1057  pGain += mBinLow;
1058  for (size_t jj = mBinLow; jj < mBinHigh; ++jj) {
1059  const bool isNoise = Classify(nWindows, jj);
1060  if (!isNoise)
1061  *pGain = 1.0;
1062  ++pGain;
1063  }
1064  }
1065  }
1066 
1068  {
1069  // In each direction, define an exponential decay of gain from the
1070  // center; make actual gains the maximum of mNoiseAttenFactor, and
1071  // the decay curve, and their prior values.
1072 
1073  // First, the attack, which goes backward in time, which is,
1074  // toward higher indices in the queue.
1075  for (size_t jj = 0; jj < mSpectrumSize; ++jj) {
1076  for (unsigned ii = mCenter + 1; ii < historyLen; ++ii) {
1077  const float minimum =
1078  std::max(mNoiseAttenFactor,
1079  NthWindow(ii - 1).mGains[jj] * mOneBlockAttack);
1080  float &gain = NthWindow(ii).mGains[jj];
1081  if (gain < minimum)
1082  gain = minimum;
1083  else
1084  // We can stop now, our attack curve is intersecting
1085  // the release curve of some window previously processed.
1086  break;
1087  }
1088  }
1089 
1090  // Now, release. We need only look one window ahead. This part will
1091  // be visited again when we examine the next window, and
1092  // carry the decay further.
1093  {
1094  auto pNextGain = NthWindow(mCenter - 1).mGains.data();
1095  auto pThisGain = NthWindow(mCenter).mGains.data();
1096  for (auto nn = mSpectrumSize; nn--;) {
1097  *pNextGain =
1098  std::max(*pNextGain,
1099  std::max(mNoiseAttenFactor,
1100  *pThisGain++ * mOneBlockRelease));
1101  ++pNextGain;
1102  }
1103  }
1104  }
1105 
1106 
1107  if (QueueIsFull()) {
1108  auto &record = NthWindow(historyLen - 1); // end of the queue
1109  const auto last = mSpectrumSize - 1;
1110 
1112  // Apply frequency smoothing to output gain
1113  // Gains are not less than mNoiseAttenFactor
1114  ApplyFreqSmoothing(record.mGains);
1115 
1116  // Apply gain to FFT
1117  {
1118  const float *pGain = &record.mGains[1];
1119  float *pReal = &record.mRealFFTs[1];
1120  float *pImag = &record.mImagFFTs[1];
1121  auto nn = mSpectrumSize - 2;
1123  for (; nn--;) {
1124  // Subtract the gain we would otherwise apply from 1, and
1125  // negate that to flip the phase.
1126  const double gain = *pGain++ - 1.0;
1127  *pReal++ *= gain;
1128  *pImag++ *= gain;
1129  }
1130  record.mRealFFTs[0] *= (record.mGains[0] - 1.0);
1131  // The Fs/2 component is stored as the imaginary part of the DC component
1132  record.mImagFFTs[0] *= (record.mGains[last] - 1.0);
1133  }
1134  else {
1135  for (; nn--;) {
1136  const double gain = *pGain++;
1137  *pReal++ *= gain;
1138  *pImag++ *= gain;
1139  }
1140  record.mRealFFTs[0] *= record.mGains[0];
1141  // The Fs/2 component is stored as the imaginary part of the DC component
1142  record.mImagFFTs[0] *= record.mGains[last];
1143  }
1144  }
1145  }
1146 }

References EffectNoiseReduction::Worker::MyWindow::mGains, anonymous_namespace{NoiseReduction.cpp}::NRC_ISOLATE_NOISE, and anonymous_namespace{NoiseReduction.cpp}::NRC_LEAVE_RESIDUE.

Member Data Documentation

◆ mBinHigh

size_t EffectNoiseReduction::Worker::mBinHigh
private

Definition at line 313 of file NoiseReduction.cpp.

◆ mBinLow

size_t EffectNoiseReduction::Worker::mBinLow
private

Definition at line 312 of file NoiseReduction.cpp.

◆ mCenter

unsigned EffectNoiseReduction::Worker::mCenter
private

Definition at line 325 of file NoiseReduction.cpp.

◆ mDoProfile

const bool EffectNoiseReduction::Worker::mDoProfile
private

Definition at line 304 of file NoiseReduction.cpp.

◆ mEffect

EffectNoiseReduction& EffectNoiseReduction::Worker::mEffect
private

Definition at line 306 of file NoiseReduction.cpp.

◆ mFreqSmoothingBins

const size_t EffectNoiseReduction::Worker::mFreqSmoothingBins
private

Definition at line 310 of file NoiseReduction.cpp.

◆ mFreqSmoothingScratch

FloatVector EffectNoiseReduction::Worker::mFreqSmoothingScratch
private

Definition at line 309 of file NoiseReduction.cpp.

◆ mHistoryLen

unsigned EffectNoiseReduction::Worker::mHistoryLen
private

Definition at line 326 of file NoiseReduction.cpp.

◆ mLen

sampleCount EffectNoiseReduction::Worker::mLen = 0
private

Definition at line 330 of file NoiseReduction.cpp.

◆ mMethod

const int EffectNoiseReduction::Worker::mMethod
private

Definition at line 316 of file NoiseReduction.cpp.

◆ mNewSensitivity

const double EffectNoiseReduction::Worker::mNewSensitivity
private

Definition at line 317 of file NoiseReduction.cpp.

◆ mNoiseAttenFactor

float EffectNoiseReduction::Worker::mNoiseAttenFactor
private

Definition at line 321 of file NoiseReduction.cpp.

◆ mNoiseReductionChoice

const int EffectNoiseReduction::Worker::mNoiseReductionChoice
private

Definition at line 315 of file NoiseReduction.cpp.

◆ mNWindowsToExamine

unsigned EffectNoiseReduction::Worker::mNWindowsToExamine
private

Definition at line 324 of file NoiseReduction.cpp.

◆ mOldSensitivityFactor

float EffectNoiseReduction::Worker::mOldSensitivityFactor
private

Definition at line 322 of file NoiseReduction.cpp.

◆ mOneBlockAttack

float EffectNoiseReduction::Worker::mOneBlockAttack
private

Definition at line 319 of file NoiseReduction.cpp.

◆ mOneBlockRelease

float EffectNoiseReduction::Worker::mOneBlockRelease
private

Definition at line 320 of file NoiseReduction.cpp.

◆ mProgressTrackCount

unsigned EffectNoiseReduction::Worker::mProgressTrackCount = 0
private

Definition at line 329 of file NoiseReduction.cpp.

◆ mProgressWindowCount

sampleCount EffectNoiseReduction::Worker::mProgressWindowCount = 0
private

Definition at line 331 of file NoiseReduction.cpp.

◆ mStatistics

Statistics& EffectNoiseReduction::Worker::mStatistics
private

Definition at line 307 of file NoiseReduction.cpp.


The documentation for this class was generated from the following file:
EffectNoiseReduction::Worker::FinishTrackStatistics
void FinishTrackStatistics()
Definition: NoiseReduction.cpp:894
TrackSpectrumTransformer::DoStart
bool DoStart() override
Called before any calls to ProcessWindow.
Definition: SpectrumTransformer.cpp:404
anonymous_namespace{NoiseReduction.cpp}::NRC_LEAVE_RESIDUE
@ NRC_LEAVE_RESIDUE
Definition: NoiseReduction.cpp:160
EffectNoiseReduction::Settings::mDoProfile
bool mDoProfile
Definition: NoiseReduction.cpp:222
WaveTrack
A Track that contains audio waveform data.
Definition: WaveTrack.h:69
DB_TO_LINEAR
const double MIN_Threshold_Linear DB_TO_LINEAR(MIN_Threshold_dB)
EffectNoiseReduction::Worker::mCenter
unsigned mCenter
Definition: NoiseReduction.cpp:325
EffectNoiseReduction::Settings::StepsPerWindow
unsigned StepsPerWindow() const
Definition: NoiseReduction.cpp:220
EffectNoiseReduction::Worker::mEffect
EffectNoiseReduction & mEffect
Definition: NoiseReduction.cpp:306
EffectNoiseReduction::Worker::mProgressWindowCount
sampleCount mProgressWindowCount
Definition: NoiseReduction.cpp:331
EffectNoiseReduction::Settings::mNoiseReductionChoice
int mNoiseReductionChoice
Definition: NoiseReduction.cpp:237
SpectrumTransformer::mStepsPerWindow
const unsigned mStepsPerWindow
Definition: SpectrumTransformer.h:155
SpectrumTransformer::mSpectrumSize
const size_t mSpectrumSize
Definition: SpectrumTransformer.h:153
SpectrumTransformer::Nth
Window & Nth(int n)
Access the queue, so you can inspect and modify any window in it.
Definition: SpectrumTransformer.h:140
EffectNoiseReduction::Worker::MyWindow::mGains
FloatVector mGains
Definition: NoiseReduction.cpp:283
EffectNoiseReduction::Worker::Worker
Worker(eWindowFunctions inWindowType, eWindowFunctions outWindowType, EffectNoiseReduction &effect, const Settings &settings, Statistics &statistics)
Definition: NoiseReduction.cpp:779
anonymous_namespace{NoiseReduction.cpp}::minSignalTime
const float minSignalTime
Definition: NoiseReduction.cpp:116
EffectNoiseReduction::Worker::mLen
sampleCount mLen
Definition: NoiseReduction.cpp:330
XO
#define XO(s)
Definition: Internat.h:31
anonymous_namespace{NoiseReduction.cpp}::DM_OLD_METHOD
@ DM_OLD_METHOD
Definition: NoiseReduction.cpp:99
SpectrumTransformer::CurrentQueueSize
size_t CurrentQueueSize() const
How many windows in the queue have been filled?
Definition: SpectrumTransformer.cpp:265
EffectNoiseReduction::Worker::mNoiseAttenFactor
float mNoiseAttenFactor
Definition: NoiseReduction.cpp:321
EffectNoiseReduction::Worker::NthWindow
MyWindow & NthWindow(int nn)
Definition: NoiseReduction.cpp:289
EffectNoiseReduction::Statistics::mTotalWindows
unsigned mTotalWindows
Definition: NoiseReduction.cpp:191
EffectNoiseReduction::Statistics::mTrackWindows
unsigned mTrackWindows
Definition: NoiseReduction.cpp:192
EffectNoiseReduction::Worker::mMethod
const int mMethod
Definition: NoiseReduction.cpp:316
EffectNoiseReduction::Settings::mAttackTime
double mAttackTime
Definition: NoiseReduction.cpp:230
EffectNoiseReduction::Worker::mOldSensitivityFactor
float mOldSensitivityFactor
Definition: NoiseReduction.cpp:322
SpectrumTransformer::mStepSize
const size_t mStepSize
Definition: SpectrumTransformer.h:156
EffectNoiseReduction::Settings::mReleaseTime
double mReleaseTime
Definition: NoiseReduction.cpp:231
EffectNoiseReduction::Worker::ApplyFreqSmoothing
void ApplyFreqSmoothing(FloatVector &gains)
Definition: NoiseReduction.cpp:748
EffectNoiseReduction::Statistics::mMeans
FloatVector mMeans
Definition: NoiseReduction.cpp:194
EffectNoiseReduction::Settings::mOldSensitivity
double mOldSensitivity
Definition: NoiseReduction.cpp:234
EffectNoiseReduction::Settings::mMethod
int mMethod
Definition: NoiseReduction.cpp:243
EffectNoiseReduction::Worker::mNewSensitivity
const double mNewSensitivity
Definition: NoiseReduction.cpp:317
anonymous_namespace{NoiseReduction.cpp}::DM_SECOND_GREATEST
@ DM_SECOND_GREATEST
Definition: NoiseReduction.cpp:98
SpectrumTransformer::QueueIsFull
bool QueueIsFull() const
Definition: SpectrumTransformer.cpp:333
EffectNoiseReduction::Worker::MyWindow::mSpectrums
FloatVector mSpectrums
Definition: NoiseReduction.cpp:282
anonymous_namespace{NoiseReduction.cpp}::NRC_ISOLATE_NOISE
@ NRC_ISOLATE_NOISE
Definition: NoiseReduction.cpp:159
EffectNoiseReduction::Worker::mProgressTrackCount
unsigned mProgressTrackCount
Definition: NoiseReduction.cpp:329
EffectNoiseReduction::Statistics::mSums
FloatVector mSums
Definition: NoiseReduction.cpp:193
EffectNoiseReduction::Worker::mOneBlockAttack
float mOneBlockAttack
Definition: NoiseReduction.cpp:319
EffectNoiseReduction::Worker::mBinHigh
size_t mBinHigh
Definition: NoiseReduction.cpp:313
EffectNoiseReduction::Worker::mDoProfile
const bool mDoProfile
Definition: NoiseReduction.cpp:304
TrackSpectrumTransformer::DoFinish
bool DoFinish() override
Called after the last call to ProcessWindow().
Definition: SpectrumTransformer.cpp:378
EffectNoiseReduction::Worker::Processor
static bool Processor(SpectrumTransformer &transformer)
Definition: NoiseReduction.cpp:864
EffectNoiseReduction::Worker::Classify
bool Classify(unsigned nWindows, int band)
Definition: NoiseReduction.cpp:953
EffectNoiseReduction::Statistics::mRate
double mRate
Definition: NoiseReduction.cpp:187
EffectNoiseReduction::Settings::WindowSize
size_t WindowSize() const
Definition: NoiseReduction.cpp:219
min
int min(int a, int b)
Definition: CompareAudioCommand.cpp:106
EffectNoiseReduction::Worker::mFreqSmoothingBins
const size_t mFreqSmoothingBins
Definition: NoiseReduction.cpp:310
EffectNoiseReduction::Worker::mNoiseReductionChoice
const int mNoiseReductionChoice
Definition: NoiseReduction.cpp:315
EffectNoiseReduction::Worker::mStatistics
Statistics & mStatistics
Definition: NoiseReduction.cpp:307
EffectNoiseReduction::Worker::mFreqSmoothingScratch
FloatVector mFreqSmoothingScratch
Definition: NoiseReduction.cpp:309
EffectNoiseReduction::Worker::mHistoryLen
unsigned mHistoryLen
Definition: NoiseReduction.cpp:326
EffectNoiseReduction::Settings::mNoiseGain
double mNoiseGain
Definition: NoiseReduction.cpp:229
SpectrumTransformer::TotalQueueSize
size_t TotalQueueSize() const
Useful functions to implement WindowProcesser:
Definition: SpectrumTransformer.h:128
EffectNoiseReduction::Worker::mNWindowsToExamine
unsigned mNWindowsToExamine
Definition: NoiseReduction.cpp:324
anonymous_namespace{NoiseReduction.cpp}::DM_MEDIAN
@ DM_MEDIAN
Definition: NoiseReduction.cpp:97
SpectrumTransformer::mWindowSize
const size_t mWindowSize
Definition: SpectrumTransformer.h:152
EffectNoiseReduction::Settings::mNewSensitivity
double mNewSensitivity
Definition: NoiseReduction.cpp:227
EffectNoiseReduction::Worker::mBinLow
size_t mBinLow
Definition: NoiseReduction.cpp:312
EffectNoiseReduction::Settings::mFreqSmoothingBands
double mFreqSmoothingBands
Definition: NoiseReduction.cpp:228
settings
static Settings & settings()
Definition: TrackInfo.cpp:86
EffectNoiseReduction::Worker::mOneBlockRelease
float mOneBlockRelease
Definition: NoiseReduction.cpp:320
TrackList::Selected
auto Selected() -> TrackIterRange< TrackType >
Definition: Track.h:1388
TrackSpectrumTransformer
Subclass of SpectrumTransformer that rewrites a track.
Definition: SpectrumTransformer.h:183
TrackSpectrumTransformer::Process
bool Process(const WindowProcessor &processor, WaveTrack *track, size_t queueLength, sampleCount start, sampleCount len)
Invokes Start(), ProcessSamples(), and Finish()
Definition: SpectrumTransformer.cpp:341