Audacity  3.0.3
Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Friends | List of all members
EffectNoiseRemoval Class Referencefinal

A two-pass effect to remove background noise. More...

#include <NoiseRemoval.h>

Inheritance diagram for EffectNoiseRemoval:
[legend]
Collaboration diagram for EffectNoiseRemoval:
[legend]

Public Member Functions

 EffectNoiseRemoval ()
 
virtual ~EffectNoiseRemoval ()
 
ComponentInterfaceSymbol GetSymbol () override
 
TranslatableString GetDescription () override
 
EffectType GetType () override
 
bool SupportsAutomation () override
 
bool ShowInterface (wxWindow &parent, const EffectDialogFactory &factory, bool forceModal=false) override
 
bool Init () override
 
bool CheckWhetherSkipEffect () override
 
bool Process () override
 
void End () override
 
- Public Member Functions inherited from Effect
 Effect ()
 
virtual ~Effect ()
 
PluginPath GetPath () override
 
VendorSymbol GetVendor () override
 
wxString GetVersion () override
 
EffectFamilySymbol GetFamily () override
 
bool IsInteractive () override
 
bool IsDefault () override
 
bool IsLegacy () override
 
bool SupportsRealtime () override
 
bool SetHost (EffectHostInterface *host) override
 
unsigned GetAudioInCount () override
 
unsigned GetAudioOutCount () override
 
int GetMidiInCount () override
 
int GetMidiOutCount () override
 
sampleCount GetLatency () override
 
size_t GetTailSize () override
 
void SetSampleRate (double rate) override
 
size_t SetBlockSize (size_t maxBlockSize) override
 
size_t GetBlockSize () const override
 
bool IsReady () override
 
bool ProcessInitialize (sampleCount totalLen, ChannelNames chanMap=NULL) override
 
bool ProcessFinalize () override
 
size_t ProcessBlock (float **inBlock, float **outBlock, size_t blockLen) override
 
bool RealtimeInitialize () override
 
bool RealtimeAddProcessor (unsigned numChannels, float sampleRate) override
 
bool RealtimeFinalize () override
 
bool RealtimeSuspend () override
 
bool RealtimeResume () override
 
bool RealtimeProcessStart () override
 
size_t RealtimeProcess (int group, float **inbuf, float **outbuf, size_t numSamples) override
 
bool RealtimeProcessEnd () override
 
bool GetAutomationParameters (CommandParameters &parms) override
 
bool SetAutomationParameters (CommandParameters &parms) override
 
bool LoadUserPreset (const RegistryPath &name) override
 
bool SaveUserPreset (const RegistryPath &name) override
 
RegistryPaths GetFactoryPresets () override
 
bool LoadFactoryPreset (int id) override
 
bool LoadFactoryDefaults () override
 
void SetHostUI (EffectUIHostInterface *host) override
 
bool PopulateUI (ShuttleGui &S) final
 
bool IsGraphicalUI () override
 
bool ValidateUI () override
 
bool HideUI () override
 
bool CloseUI () override
 
bool CanExportPresets () override
 
void ExportPresets () override
 
void ImportPresets () override
 
bool HasOptions () override
 
void ShowOptions () override
 
double GetDefaultDuration () override
 
double GetDuration () override
 
NumericFormatSymbol GetDurationFormat () override
 
virtual NumericFormatSymbol GetSelectionFormat ()
 
void SetDuration (double duration) override
 
RegistryPath GetUserPresetsGroup (const RegistryPath &name) override
 
RegistryPath GetCurrentSettingsGroup () override
 
RegistryPath GetFactoryDefaultsGroup () override
 
virtual wxString GetSavedStateGroup ()
 
bool HasSharedConfigGroup (const RegistryPath &group) override
 
bool GetSharedConfigSubgroups (const RegistryPath &group, RegistryPaths &subgroups) override
 
bool GetSharedConfig (const RegistryPath &group, const RegistryPath &key, wxString &value, const wxString &defval={}) override
 
bool GetSharedConfig (const RegistryPath &group, const RegistryPath &key, int &value, int defval=0) override
 
bool GetSharedConfig (const RegistryPath &group, const RegistryPath &key, bool &value, bool defval=false) override
 
bool GetSharedConfig (const RegistryPath &group, const RegistryPath &key, float &value, float defval=0.0) override
 
bool GetSharedConfig (const RegistryPath &group, const RegistryPath &key, double &value, double defval=0.0) override
 
bool SetSharedConfig (const RegistryPath &group, const RegistryPath &key, const wxString &value) override
 
bool SetSharedConfig (const RegistryPath &group, const RegistryPath &key, const int &value) override
 
bool SetSharedConfig (const RegistryPath &group, const RegistryPath &key, const bool &value) override
 
bool SetSharedConfig (const RegistryPath &group, const RegistryPath &key, const float &value) override
 
bool SetSharedConfig (const RegistryPath &group, const RegistryPath &key, const double &value) override
 
bool RemoveSharedConfigSubgroup (const RegistryPath &group) override
 
bool RemoveSharedConfig (const RegistryPath &group, const RegistryPath &key) override
 
bool HasPrivateConfigGroup (const RegistryPath &group) override
 
bool GetPrivateConfigSubgroups (const RegistryPath &group, RegistryPaths &paths) override
 
bool GetPrivateConfig (const RegistryPath &group, const RegistryPath &key, wxString &value, const wxString &defval={}) override
 
bool GetPrivateConfig (const RegistryPath &group, const RegistryPath &key, int &value, int defval=0) override
 
bool GetPrivateConfig (const RegistryPath &group, const RegistryPath &key, bool &value, bool defval=false) override
 
bool GetPrivateConfig (const RegistryPath &group, const RegistryPath &key, float &value, float defval=0.0) override
 
bool GetPrivateConfig (const RegistryPath &group, const RegistryPath &key, double &value, double defval=0.0) override
 
bool SetPrivateConfig (const RegistryPath &group, const RegistryPath &key, const wxString &value) override
 
bool SetPrivateConfig (const RegistryPath &group, const RegistryPath &key, const int &value) override
 
bool SetPrivateConfig (const RegistryPath &group, const RegistryPath &key, const bool &value) override
 
bool SetPrivateConfig (const RegistryPath &group, const RegistryPath &key, const float &value) override
 
bool SetPrivateConfig (const RegistryPath &group, const RegistryPath &key, const double &value) override
 
bool RemovePrivateConfigSubgroup (const RegistryPath &group) override
 
bool RemovePrivateConfig (const RegistryPath &group, const RegistryPath &key) override
 
virtual PluginID GetID ()
 
virtual bool Startup (EffectClientInterface *client)
 
virtual bool Startup ()
 
virtual bool GetAutomationParameters (wxString &parms)
 
virtual bool SetAutomationParameters (const wxString &parms)
 
virtual RegistryPaths GetUserPresets ()
 
virtual bool HasCurrentSettings ()
 
virtual bool HasFactoryDefaults ()
 
virtual ManualPageID ManualPage ()
 
virtual FilePath HelpPage ()
 
virtual void SetUIFlags (unsigned flags)
 
virtual unsigned TestUIFlags (unsigned mask)
 
virtual bool IsBatchProcessing ()
 
virtual void SetBatchProcessing (bool start)
 
void SetPresetParameters (const wxArrayString *Names, const wxArrayString *Values)
 
bool DoEffect (double projectRate, TrackList *list, WaveTrackFactory *factory, NotifyingSelectedRegion &selectedRegion, wxWindow *pParent=nullptr, const EffectDialogFactory &dialogFactory={})
 
bool Delegate (Effect &delegate, wxWindow &parent, const EffectDialogFactory &factory)
 
virtual bool IsHidden ()
 
int MessageBox (const TranslatableString &message, long style=DefaultMessageBoxStyle, const TranslatableString &titleStr={})
 
- Public Member Functions inherited from EffectClientInterface
virtual ~EffectClientInterface ()
 
- Public Member Functions inherited from EffectDefinitionInterface
virtual ~EffectDefinitionInterface ()
 
virtual EffectType GetClassification ()
 
- Public Member Functions inherited from ComponentInterface
virtual ~ComponentInterface ()
 
TranslatableString GetName ()
 
virtual bool DefineParams (ShuttleParams &WXUNUSED(S))
 
- Public Member Functions inherited from EffectUIClientInterface
virtual ~EffectUIClientInterface ()
 
- Public Member Functions inherited from EffectHostInterface
virtual ~EffectHostInterface ()
 
- Public Member Functions inherited from ConfigClientInterface
virtual ~ConfigClientInterface ()
 

Static Public Attributes

static const ComponentInterfaceSymbol Symbol { XO("Noise Removal") }
 
- Static Public Attributes inherited from Effect
static const wxString kUserPresetIdent = wxT("User Preset:")
 
static const wxString kFactoryPresetIdent = wxT("Factory Preset:")
 
static const wxString kCurrentSettingsIdent = wxT("<Current Settings>")
 
static const wxString kFactoryDefaultsIdent = wxT("<Factory Defaults>")
 

Private Member Functions

bool ProcessOne (int count, WaveTrack *track, sampleCount start, sampleCount len)
 
void Initialize ()
 
void StartNewTrack ()
 
void ProcessSamples (size_t len, float *buffer)
 
void FillFirstHistoryWindow ()
 
void ApplyFreqSmoothing (float *spec)
 
void GetProfile ()
 
void RemoveNoise ()
 
void RotateHistoryWindows ()
 
void FinishTrack ()
 

Private Attributes

bool mDoProfile
 
bool mHasProfile
 
int mLevel
 
double mSampleRate
 
size_t mWindowSize
 
size_t mSpectrumSize
 
float mMinSignalTime
 
Floats mNoiseThreshold
 
double mSensitivity
 
double mFreqSmoothingHz
 
double mNoiseGain
 
double mAttackDecayTime
 
bool mbLeaveNoise
 
std::shared_ptr< WaveTrackmOutputTrack
 
sampleCount mInSampleCount
 
sampleCount mOutSampleCount
 
int mInputPos
 
HFFT hFFT
 
Floats mFFTBuffer
 
Floats mWindow
 
int mFreqSmoothingBins
 
int mAttackDecayBlocks
 
float mOneBlockAttackDecay
 
float mNoiseAttenFactor
 
float mSensitivityFactor
 
size_t mMinSignalBlocks
 
size_t mHistoryLen
 
Floats mInWaveBuffer
 
Floats mOutOverlapBuffer
 
ArraysOf< float > mSpectrums
 
ArraysOf< float > mGains
 
ArraysOf< float > mRealFFTs
 
ArraysOf< float > mImagFFTs
 

Friends

class NoiseRemovalDialog
 

Additional Inherited Members

- Public Types inherited from Effect
enum  : long { DefaultMessageBoxStyle = wxOK | wxCENTRE }
 
using VetoDialogHook = bool(*)(wxDialog *)
 
- Public Types inherited from EffectClientInterface
using EffectDialogFactory = std::function< wxDialog *(wxWindow &parent, EffectHostInterface *, EffectUIClientInterface *) >
 
- Static Public Member Functions inherited from Effect
static VetoDialogHook SetVetoDialogHook (VetoDialogHook hook)
 
static CommandID GetSquashedName (wxString name)
 
static void IncEffectCounter ()
 
- Protected Member Functions inherited from Effect
virtual bool ProcessPass ()
 
virtual bool InitPass1 ()
 
virtual bool InitPass2 ()
 
virtual int GetPass ()
 
virtual double CalcPreviewInputLength (double previewLength)
 
virtual void Preview (bool dryOnly)
 
virtual void PopulateOrExchange (ShuttleGui &S)
 
virtual bool TransferDataToWindow ()
 
virtual bool TransferDataFromWindow ()
 
virtual bool EnableApply (bool enable=true)
 
virtual bool EnablePreview (bool enable=true)
 
virtual void EnableDebug (bool enable=true)
 
bool TotalProgress (double frac, const TranslatableString &={})
 
bool TrackProgress (int whichTrack, double frac, const TranslatableString &={})
 
bool TrackGroupProgress (int whichGroup, double frac, const TranslatableString &={})
 
int GetNumWaveTracks ()
 
int GetNumWaveGroups ()
 
void GetBounds (const WaveTrack &track, const WaveTrack *pRight, sampleCount *start, sampleCount *len)
 
void SetLinearEffectFlag (bool linearEffectFlag)
 
void SetPreviewFullSelectionFlag (bool previewDurationFlag)
 
bool IsPreviewing ()
 
void IncludeNotSelectedPreviewTracks (bool includeNotSelected)
 
void CopyInputTracks (bool allSyncLockSelected=false)
 
std::shared_ptr< AddedAnalysisTrackAddAnalysisTrack (const wxString &name=wxString())
 
ModifiedAnalysisTrack ModifyAnalysisTrack (const LabelTrack *pOrigTrack, const wxString &name=wxString())
 
void ReplaceProcessedTracks (const bool bGoodResult)
 
TrackAddToOutputTracks (const std::shared_ptr< Track > &t)
 
const TrackListinputTracks () const
 
const AudacityProjectFindProject () const
 
- Protected Attributes inherited from Effect
ProgressDialogmProgress
 
double mProjectRate
 
double mSampleRate
 
wxWeakRef< NotifyingSelectedRegionmpSelectedRegion {}
 
WaveTrackFactorymFactory
 
std::shared_ptr< TrackListmOutputTracks
 
double mT0
 
double mT1
 
wxArrayString mPresetNames
 
wxArrayString mPresetValues
 
int mPass
 
wxDialog * mUIDialog
 
wxWindow * mUIParent
 
int mUIResultID
 
unsigned mUIFlags
 
sampleCount mSampleCnt
 
- Static Protected Attributes inherited from Effect
static int nEffectsDone =0
 

Detailed Description

A two-pass effect to remove background noise.

The first pass is done over just noise. For each windowed sample of the sound, we take a FFT and then statistics are tabulated for each frequency band - specifically the maximum level achieved by at least (n) sampling windows in a row, for various values of (n).

During the noise removal phase, we start by setting a gain control for each frequency band such that if the sound has exceeded the previously-determined threshold, the gain is set to 0, otherwise the gain is set lower (e.g. -18 dB), to suppress the noise. Then frequency-smoothing is applied so that a single frequency is never suppressed or boosted in isolation, and then time-smoothing is applied so that the gain for each frequency band moves slowly. Lookahead is employed; this effect is not designed for real-time but if it were, there would be a significant delay.

The gain controls are applied to the complex FFT of the signal, and then the inverse FFT is applied, followed by a Hann window; the output signal is then pieced together using overlap/add of half the window size.

Definition at line 34 of file NoiseRemoval.h.

Constructor & Destructor Documentation

◆ EffectNoiseRemoval()

EffectNoiseRemoval::EffectNoiseRemoval ( )

Definition at line 83 of file NoiseRemoval.cpp.

84 {
85  mWindowSize = 2048;
86  mSpectrumSize = 1 + mWindowSize / 2;
87 
88  gPrefs->Read(wxT("/Effects/NoiseRemoval/NoiseSensitivity"),
89  &mSensitivity, 0.0);
90  gPrefs->Read(wxT("/Effects/NoiseRemoval/NoiseGain"),
91  &mNoiseGain, -24.0);
92  gPrefs->Read(wxT("/Effects/NoiseRemoval/NoiseFreqSmoothing"),
93  &mFreqSmoothingHz, 150.0);
94  gPrefs->Read(wxT("/Effects/NoiseRemoval/NoiseAttackDecayTime"),
95  &mAttackDecayTime, 0.15);
96  gPrefs->Read(wxT("/Effects/NoiseRemoval/NoiseLeaveNoise"),
97  &mbLeaveNoise, false);
98 // mbLeaveNoise = false;
99 
100 
101  mMinSignalTime = 0.05f;
102  mHasProfile = false;
103  mDoProfile = true;
104 
106 
107  Init();
108 }

References gPrefs, Init(), mAttackDecayTime, mbLeaveNoise, mDoProfile, mFreqSmoothingHz, mHasProfile, mMinSignalTime, mNoiseGain, mNoiseThreshold, mSensitivity, mSpectrumSize, mWindowSize, and ArrayOf< X >::reinit().

Here is the call graph for this function:

◆ ~EffectNoiseRemoval()

EffectNoiseRemoval::~EffectNoiseRemoval ( )
virtual

Definition at line 110 of file NoiseRemoval.cpp.

111 {
112 }

Member Function Documentation

◆ ApplyFreqSmoothing()

void EffectNoiseRemoval::ApplyFreqSmoothing ( float *  spec)
private

Definition at line 244 of file NoiseRemoval.cpp.

245 {
246  Floats tmp{ mSpectrumSize };
247  int j, j0, j1;
248 
249  for(int i = 0; i < mSpectrumSize; i++) {
250  j0 = wxMax(0, i - mFreqSmoothingBins);
251  j1 = wxMin(mSpectrumSize-1, i + mFreqSmoothingBins);
252  tmp[i] = 0.0;
253  for(j = j0; j <= j1; j++) {
254  tmp[i] += spec[j];
255  }
256  tmp[i] /= (j1 - j0 + 1);
257  }
258 
259  for(size_t i = 0; i < mSpectrumSize; i++)
260  spec[i] = tmp[i];
261 }

References mFreqSmoothingBins, and mSpectrumSize.

Referenced by End(), and RemoveNoise().

Here is the caller graph for this function:

◆ CheckWhetherSkipEffect()

bool EffectNoiseRemoval::CheckWhetherSkipEffect ( )
overridevirtual

Reimplemented from Effect.

Definition at line 151 of file NoiseRemoval.cpp.

152 {
153  return (mLevel == 0);
154 }

References mLevel.

◆ End()

void EffectNoiseRemoval::End ( )
overridevirtual

Reimplemented from Effect.

Definition at line 305 of file NoiseRemoval.cpp.

306 {
307  hFFT.reset();
308 
309  if (mDoProfile) {
311  }
312 
313  mSpectrums.reset();
314  mGains.reset();
315  mRealFFTs.reset();
316  mImagFFTs.reset();
317 
318  mFFTBuffer.reset();
319  mInWaveBuffer.reset();
320  mWindow.reset();
321  mOutOverlapBuffer.reset();
322 
323  mOutputTrack.reset();
324 }

References ApplyFreqSmoothing(), hFFT, mDoProfile, mFFTBuffer, mGains, mImagFFTs, mInWaveBuffer, mNoiseThreshold, mOutOverlapBuffer, mOutputTrack, mRealFFTs, mSpectrums, and mWindow.

Here is the call graph for this function:

◆ FillFirstHistoryWindow()

void EffectNoiseRemoval::FillFirstHistoryWindow ( )
private

Definition at line 372 of file NoiseRemoval.cpp.

373 {
374  for(size_t i = 0; i < mWindowSize; i++)
375  mFFTBuffer[i] = mInWaveBuffer[i];
376  RealFFTf(mFFTBuffer.get(), hFFT.get());
377  for(size_t i = 1; i + 1 < mSpectrumSize; i++) {
378  mRealFFTs[0][i] = mFFTBuffer[hFFT->BitReversed[i] ];
379  mImagFFTs[0][i] = mFFTBuffer[hFFT->BitReversed[i]+1];
380  mSpectrums[0][i] = mRealFFTs[0][i]*mRealFFTs[0][i] + mImagFFTs[0][i]*mImagFFTs[0][i];
381  mGains[0][i] = mNoiseAttenFactor;
382  }
383  // DC and Fs/2 bins need to be handled specially
384  mSpectrums[0][0] = mFFTBuffer[0]*mFFTBuffer[0];
386  mGains[0][0] = mNoiseAttenFactor;
388 }

References hFFT, mFFTBuffer, mGains, mImagFFTs, mInWaveBuffer, mNoiseAttenFactor, mRealFFTs, mSpectrums, mSpectrumSize, mWindowSize, and RealFFTf().

Referenced by ProcessSamples().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FinishTrack()

void EffectNoiseRemoval::FinishTrack ( )
private

Definition at line 410 of file NoiseRemoval.cpp.

411 {
412  // Keep flushing empty input buffers through the history
413  // windows until we've output exactly as many samples as
414  // were input.
415  // Well, not exactly, but not more than mWindowSize/2 extra samples at the end.
416  // We'll DELETE them later in ProcessOne.
417 
418  Floats empty{ mWindowSize / 2 };
419  for(size_t i = 0; i < mWindowSize / 2; i++)
420  empty[i] = 0.0;
421 
422  while (mOutSampleCount < mInSampleCount) {
423  ProcessSamples(mWindowSize / 2, empty.get());
424  }
425 }

References mInSampleCount, mOutSampleCount, mWindowSize, and ProcessSamples().

Referenced by ProcessOne().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetDescription()

TranslatableString EffectNoiseRemoval::GetDescription ( )
overridevirtual

Reimplemented from Effect.

Definition at line 121 of file NoiseRemoval.cpp.

122 {
123  return XO("Removes constant background noise such as fans, tape noise, or hums");
124 }

References XO.

◆ GetProfile()

void EffectNoiseRemoval::GetProfile ( )
private

Definition at line 427 of file NoiseRemoval.cpp.

428 {
429  // The noise threshold for each frequency is the maximum
430  // level achieved at that frequency for a minimum of
431  // mMinSignalBlocks blocks in a row - the max of a min.
432 
433  int start = mHistoryLen - mMinSignalBlocks;
434  int finish = mHistoryLen;
435  int i;
436 
437  for (size_t j = 0; j < mSpectrumSize; j++) {
438  float min = mSpectrums[start][j];
439  for (i = start+1; i < finish; i++) {
440  if (mSpectrums[i][j] < min)
441  min = mSpectrums[i][j];
442  }
443  if (min > mNoiseThreshold[j])
444  mNoiseThreshold[j] = min;
445  }
446 
447  mOutSampleCount += mWindowSize / 2; // what is this for? Not used when we are getting the profile?
448 }

References mHistoryLen, min(), mMinSignalBlocks, mNoiseThreshold, mOutSampleCount, mSpectrums, mSpectrumSize, and mWindowSize.

Referenced by ProcessSamples().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetSymbol()

ComponentInterfaceSymbol EffectNoiseRemoval::GetSymbol ( )
overridevirtual

Reimplemented from Effect.

Definition at line 116 of file NoiseRemoval.cpp.

117 {
118  return Symbol;
119 }

References Symbol.

◆ GetType()

EffectType EffectNoiseRemoval::GetType ( )
overridevirtual

Reimplemented from Effect.

Definition at line 128 of file NoiseRemoval.cpp.

129 {
130  return EffectTypeProcess;
131 }

References EffectTypeProcess.

◆ Init()

bool EffectNoiseRemoval::Init ( )
overridevirtual

Reimplemented from Effect.

Definition at line 141 of file NoiseRemoval.cpp.

142 {
143  mLevel = gPrefs->Read(wxT("/Effects/NoiseRemoval/Noise_Level"), 3L);
144  if ((mLevel < 0) || (mLevel > MAX_NOISE_LEVEL)) { // corrupted Prefs?
145  mLevel = 0; //Off-skip
146  gPrefs->Write(wxT("/Effects/NoiseRemoval/Noise_Level"), mLevel);
147  }
148  return gPrefs->Flush();
149 }

References FileConfig::Flush(), gPrefs, MAX_NOISE_LEVEL, and mLevel.

Referenced by EffectNoiseRemoval().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Initialize()

void EffectNoiseRemoval::Initialize ( )
private

Definition at line 263 of file NoiseRemoval.cpp.

264 {
267  mAttackDecayBlocks = 1 +
268  (int)(mAttackDecayTime * mSampleRate / (mWindowSize / 2));
271  // Applies to power, divide by 10:
272  mSensitivityFactor = pow(10.0, mSensitivity/10.0);
274  (int)(mMinSignalTime * mSampleRate / (mWindowSize / 2));
275  if( mMinSignalBlocks < 1 )
276  mMinSignalBlocks = 1;
277  mHistoryLen = (2 * mAttackDecayBlocks) - 1;
278 
281 
286 
287  // Initialize the FFT
289 
294 
295  // Create a Hann window function
296  for(size_t i=0; i<mWindowSize; i++)
297  mWindow[i] = 0.5 - 0.5 * cos((2.0*M_PI*i) / mWindowSize);
298 
299  if (mDoProfile) {
300  for (size_t i = 0; i < mSpectrumSize; i++)
301  mNoiseThreshold[i] = float(0);
302  }
303 }

References DB_TO_LINEAR(), GetFFT(), hFFT, M_PI, mAttackDecayBlocks, mAttackDecayTime, mDoProfile, mFFTBuffer, mFreqSmoothingBins, mFreqSmoothingHz, mGains, mHistoryLen, mImagFFTs, mInWaveBuffer, mMinSignalBlocks, mMinSignalTime, mNoiseAttenFactor, mNoiseGain, mNoiseThreshold, mOneBlockAttackDecay, mOutOverlapBuffer, Effect::mProjectRate, mRealFFTs, mSampleRate, mSensitivity, mSensitivityFactor, mSpectrums, mSpectrumSize, mWindow, mWindowSize, ArraysOf< X >::reinit(), and ArrayOf< X >::reinit().

Referenced by Process().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Process()

bool EffectNoiseRemoval::Process ( )
overridevirtual

Reimplemented from Effect.

Definition at line 206 of file NoiseRemoval.cpp.

207 {
208  Initialize();
209 
210  // This same code will both remove noise and profile it,
211  // depending on 'mDoProfile'
212  this->CopyInputTracks(); // Set up mOutputTracks.
213  bool bGoodResult = true;
214 
215  int count = 0;
216  for( auto track : mOutputTracks->Selected< WaveTrack >() ) {
217  double trackStart = track->GetStartTime();
218  double trackEnd = track->GetEndTime();
219  double t0 = mT0 < trackStart? trackStart: mT0;
220  double t1 = mT1 > trackEnd? trackEnd: mT1;
221 
222  if (t1 > t0) {
223  auto start = track->TimeToLongSamples(t0);
224  auto end = track->TimeToLongSamples(t1);
225  auto len = end - start;
226 
227  if (!ProcessOne(count, track, start, len)) {
228  bGoodResult = false;
229  break;
230  }
231  }
232  count++;
233  }
234 
235  if (bGoodResult && mDoProfile) {
236  mHasProfile = true;
237  mDoProfile = false;
238  }
239 
240  this->ReplaceProcessedTracks(bGoodResult);
241  return bGoodResult;
242 }

References Effect::CopyInputTracks(), Initialize(), mDoProfile, mHasProfile, Effect::mOutputTracks, Effect::mT0, Effect::mT1, ProcessOne(), and Effect::ReplaceProcessedTracks().

Here is the call graph for this function:

◆ ProcessOne()

bool EffectNoiseRemoval::ProcessOne ( int  count,
WaveTrack track,
sampleCount  start,
sampleCount  len 
)
private

Definition at line 525 of file NoiseRemoval.cpp.

527 {
528  if (track == NULL)
529  return false;
530 
531  StartNewTrack();
532 
533  if (!mDoProfile)
534  mOutputTrack = track->EmptyCopy();
535 
536  auto bufferSize = track->GetMaxBlockSize();
537  Floats buffer{ bufferSize };
538 
539  bool bLoopSuccess = true;
540  auto samplePos = start;
541  while (samplePos < start + len) {
542  //Get a blockSize of samples (smaller than the size of the buffer)
543  //Adjust the block size if it is the final block in the track
544  const auto blockSize = limitSampleBufferSize(
545  track->GetBestBlockSize(samplePos),
546  start + len - samplePos
547  );
548 
549  //Get the samples from the track and put them in the buffer
550  track->Get((samplePtr)buffer.get(), floatSample, samplePos, blockSize);
551 
552  mInSampleCount += blockSize;
553  ProcessSamples(blockSize, buffer.get());
554 
555  samplePos += blockSize;
556 
557  // Update the Progress meter
558  if (TrackProgress(count, (samplePos - start).as_double() / len.as_double())) {
559  bLoopSuccess = false;
560  break;
561  }
562  }
563 
564  FinishTrack();
565 
566  if (!mDoProfile) {
567  // Flush the output WaveTrack (since it's buffered)
568  mOutputTrack->Flush();
569 
570  // Take the output track and insert it in place of the original
571  // sample data (as operated on -- this may not match mT0/mT1)
572  if (bLoopSuccess) {
573  double t0 = mOutputTrack->LongSamplesToTime(start);
574  double tLen = mOutputTrack->LongSamplesToTime(len);
575  // Filtering effects always end up with more data than they started with. Delete this 'tail'.
576  mOutputTrack->HandleClear(tLen, mOutputTrack->GetEndTime(), false, false);
577  track->ClearAndPaste(t0, t0 + tLen, mOutputTrack.get(), true, false);
578  }
579  }
580 
581  return bLoopSuccess;
582 }

References sampleCount::as_double(), WaveTrack::ClearAndPaste(), WaveTrack::EmptyCopy(), FinishTrack(), floatSample, WaveTrack::Get(), WaveTrack::GetBestBlockSize(), WaveTrack::GetMaxBlockSize(), limitSampleBufferSize(), mDoProfile, mInSampleCount, mOutputTrack, ProcessSamples(), StartNewTrack(), and Effect::TrackProgress().

Referenced by Process().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ProcessSamples()

void EffectNoiseRemoval::ProcessSamples ( size_t  len,
float *  buffer 
)
private

Definition at line 345 of file NoiseRemoval.cpp.

346 {
347  while(len && mOutSampleCount < mInSampleCount) {
348  size_t avail = wxMin(len, mWindowSize - mInputPos);
349  for(size_t i = 0; i < avail; i++)
350  mInWaveBuffer[mInputPos + i] = buffer[i];
351  buffer += avail;
352  len -= avail;
353  mInputPos += avail;
354 
355  if (mInputPos == int(mWindowSize)) {
357  if (mDoProfile)
358  GetProfile();
359  else
360  RemoveNoise();
362 
363  // Rotate halfway for overlap-add
364  for(size_t i = 0; i < mWindowSize / 2; i++) {
366  }
367  mInputPos = mWindowSize / 2;
368  }
369  }
370 }

References FillFirstHistoryWindow(), GetProfile(), mDoProfile, mInputPos, mInSampleCount, mInWaveBuffer, mOutSampleCount, mWindowSize, RemoveNoise(), and RotateHistoryWindows().

Referenced by FinishTrack(), and ProcessOne().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RemoveNoise()

void EffectNoiseRemoval::RemoveNoise ( )
private

Definition at line 450 of file NoiseRemoval.cpp.

451 {
452  size_t center = mHistoryLen / 2;
453  size_t start = center - mMinSignalBlocks/2;
454  size_t finish = start + mMinSignalBlocks;
455 
456  // Raise the gain for elements in the center of the sliding history
457  for (size_t j = 0; j < mSpectrumSize; j++) {
458  float min = mSpectrums[start][j];
459  for (size_t i = start+1; i < finish; i++) {
460  if (mSpectrums[i][j] < min)
461  min = mSpectrums[i][j];
462  }
463  if (min > mSensitivityFactor * mNoiseThreshold[j] && mGains[center][j] < 1.0) {
464  if (mbLeaveNoise) mGains[center][j] = 0.0;
465  else mGains[center][j] = 1.0;
466  } else {
467  if (mbLeaveNoise) mGains[center][j] = 1.0;
468  }
469  }
470 
471  // Decay the gain in both directions;
472  // note that mOneBlockAttackDecay is less than 1.0
473  // of linear attenuation per block
474  for (size_t j = 0; j < mSpectrumSize; j++) {
475  for (size_t i = center + 1; i < mHistoryLen; i++) {
476  if (mGains[i][j] < mGains[i - 1][j] * mOneBlockAttackDecay)
477  mGains[i][j] = mGains[i - 1][j] * mOneBlockAttackDecay;
478  if (mGains[i][j] < mNoiseAttenFactor)
479  mGains[i][j] = mNoiseAttenFactor;
480  }
481  for (size_t i = center; i--;) {
482  if (mGains[i][j] < mGains[i + 1][j] * mOneBlockAttackDecay)
483  mGains[i][j] = mGains[i + 1][j] * mOneBlockAttackDecay;
484  if (mGains[i][j] < mNoiseAttenFactor)
485  mGains[i][j] = mNoiseAttenFactor;
486  }
487  }
488 
489 
490  // Apply frequency smoothing to output gain
491  int out = mHistoryLen - 1; // end of the queue
492 
493  ApplyFreqSmoothing(mGains[out].get());
494 
495  // Apply gain to FFT
496  for (size_t j = 0; j < (mSpectrumSize-1); j++) {
497  mFFTBuffer[j*2 ] = mRealFFTs[out][j] * mGains[out][j];
498  mFFTBuffer[j*2+1] = mImagFFTs[out][j] * mGains[out][j];
499  }
500  // The Fs/2 component is stored as the imaginary part of the DC component
501  mFFTBuffer[1] = mRealFFTs[out][mSpectrumSize-1] * mGains[out][mSpectrumSize-1];
502 
503  // Invert the FFT into the output buffer
504  InverseRealFFTf(mFFTBuffer.get(), hFFT.get());
505 
506  // Overlap-add
507  for(size_t j = 0; j < (mSpectrumSize-1); j++) {
508  mOutOverlapBuffer[j*2 ] += mFFTBuffer[hFFT->BitReversed[j] ] * mWindow[j*2 ];
509  mOutOverlapBuffer[j*2+1] += mFFTBuffer[hFFT->BitReversed[j]+1] * mWindow[j*2+1];
510  }
511 
512  // Output the first half of the overlap buffer, they're done -
513  // and then shift the next half over.
514  if (mOutSampleCount >= 0) { // ...but not if it's the first half-window
516  mWindowSize / 2);
517  }
519  for(size_t j = 0; j < mWindowSize / 2; j++) {
521  mOutOverlapBuffer[j + (mWindowSize / 2)] = 0.0;
522  }
523 }

References ApplyFreqSmoothing(), floatSample, hFFT, InverseRealFFTf(), mbLeaveNoise, mFFTBuffer, mGains, mHistoryLen, mImagFFTs, min(), mMinSignalBlocks, mNoiseAttenFactor, mNoiseThreshold, mOneBlockAttackDecay, mOutOverlapBuffer, mOutputTrack, mOutSampleCount, mRealFFTs, mSensitivityFactor, mSpectrums, mSpectrumSize, mWindow, and mWindowSize.

Referenced by ProcessSamples().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RotateHistoryWindows()

void EffectNoiseRemoval::RotateHistoryWindows ( )
private

Definition at line 401 of file NoiseRemoval.cpp.

402 {
403  // Remember the last window so we can reuse it
408 }

References mGains, mHistoryLen, mImagFFTs, mRealFFTs, mSpectrums, and anonymous_namespace{NoiseRemoval.cpp}::Rotate().

Referenced by ProcessSamples().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ShowInterface()

bool EffectNoiseRemoval::ShowInterface ( wxWindow &  parent,
const EffectDialogFactory factory,
bool  forceModal = false 
)
overridevirtual

Reimplemented from Effect.

Definition at line 156 of file NoiseRemoval.cpp.

158 {
159  // to do: use forceModal correctly
160  NoiseRemovalDialog dlog(this, &parent);
161  dlog.mSensitivity = mSensitivity;
162  dlog.mGain = -mNoiseGain;
163  dlog.mFreq = mFreqSmoothingHz;
164  dlog.mTime = mAttackDecayTime;
165  dlog.mbLeaveNoise = mbLeaveNoise;
166  dlog.mKeepSignal->SetValue(!mbLeaveNoise);
167  dlog.mKeepNoise->SetValue(mbLeaveNoise);
168 
169  // We may want to twiddle the levels if we are setting
170  // from an automation dialog
171  bool bAllowTwiddleSettings = forceModal;
172 
173  if (mHasProfile || bAllowTwiddleSettings) {
174  dlog.m_pButton_Preview->Enable(GetNumWaveTracks() != 0);
175  dlog.m_pButton_RemoveNoise->SetDefault();
176  } else {
177  dlog.m_pButton_Preview->Enable(false);
178  dlog.m_pButton_RemoveNoise->Enable(false);
179  }
180 
181  dlog.TransferDataToWindow();
182  dlog.mKeepNoise->SetValue(dlog.mbLeaveNoise);
183  dlog.CentreOnParent();
184  dlog.ShowModal();
185 
186  if (dlog.GetReturnCode() == 0) {
187  return false;
188  }
189 
190  mSensitivity = dlog.mSensitivity;
191  mNoiseGain = -dlog.mGain;
192  mFreqSmoothingHz = dlog.mFreq;
193  mAttackDecayTime = dlog.mTime;
194  mbLeaveNoise = dlog.mbLeaveNoise;
195 
196  gPrefs->Write(wxT("/Effects/NoiseRemoval/NoiseSensitivity"), mSensitivity);
197  gPrefs->Write(wxT("/Effects/NoiseRemoval/NoiseGain"), mNoiseGain);
198  gPrefs->Write(wxT("/Effects/NoiseRemoval/NoiseFreqSmoothing"), mFreqSmoothingHz);
199  gPrefs->Write(wxT("/Effects/NoiseRemoval/NoiseAttackDecayTime"), mAttackDecayTime);
200  gPrefs->Write(wxT("/Effects/NoiseRemoval/NoiseLeaveNoise"), mbLeaveNoise);
201 
202  mDoProfile = (dlog.GetReturnCode() == 1);
203  return gPrefs->Flush();
204 }

References FileConfig::Flush(), Effect::GetNumWaveTracks(), gPrefs, NoiseRemovalDialog::m_pButton_Preview, NoiseRemovalDialog::m_pButton_RemoveNoise, mAttackDecayTime, mbLeaveNoise, NoiseRemovalDialog::mbLeaveNoise, mDoProfile, NoiseRemovalDialog::mFreq, mFreqSmoothingHz, NoiseRemovalDialog::mGain, mHasProfile, NoiseRemovalDialog::mKeepNoise, NoiseRemovalDialog::mKeepSignal, mNoiseGain, mSensitivity, NoiseRemovalDialog::mSensitivity, NoiseRemovalDialog::mTime, and NoiseRemovalDialog::TransferDataToWindow().

Here is the call graph for this function:

◆ StartNewTrack()

void EffectNoiseRemoval::StartNewTrack ( )
private

Definition at line 326 of file NoiseRemoval.cpp.

327 {
328  for(size_t i = 0; i < mHistoryLen; i++) {
329  for(size_t j = 0; j < mSpectrumSize; j++) {
330  mSpectrums[i][j] = 0;
331  mGains[i][j] = mNoiseAttenFactor;
332  mRealFFTs[i][j] = 0.0;
333  mImagFFTs[i][j] = 0.0;
334  }
335  }
336 
337  for(size_t j = 0; j < mWindowSize; j++)
338  mOutOverlapBuffer[j] = 0.0;
339 
340  mInputPos = 0;
341  mInSampleCount = 0;
342  mOutSampleCount = -(int)((mWindowSize / 2) * (mHistoryLen - 1));
343 }

References mGains, mHistoryLen, mImagFFTs, mInputPos, mInSampleCount, mNoiseAttenFactor, mOutOverlapBuffer, mOutSampleCount, mRealFFTs, mSpectrums, mSpectrumSize, and mWindowSize.

Referenced by ProcessOne().

Here is the caller graph for this function:

◆ SupportsAutomation()

bool EffectNoiseRemoval::SupportsAutomation ( )
overridevirtual

Reimplemented from Effect.

Definition at line 133 of file NoiseRemoval.cpp.

134 {
135  return false;
136 }

Friends And Related Function Documentation

◆ NoiseRemovalDialog

friend class NoiseRemovalDialog
friend

Definition at line 122 of file NoiseRemoval.h.

Member Data Documentation

◆ hFFT

HFFT EffectNoiseRemoval::hFFT
private

Definition at line 104 of file NoiseRemoval.h.

Referenced by End(), FillFirstHistoryWindow(), Initialize(), and RemoveNoise().

◆ mAttackDecayBlocks

int EffectNoiseRemoval::mAttackDecayBlocks
private

Definition at line 109 of file NoiseRemoval.h.

Referenced by Initialize().

◆ mAttackDecayTime

double EffectNoiseRemoval::mAttackDecayTime
private

◆ mbLeaveNoise

bool EffectNoiseRemoval::mbLeaveNoise
private

◆ mDoProfile

bool EffectNoiseRemoval::mDoProfile
private

◆ mFFTBuffer

Floats EffectNoiseRemoval::mFFTBuffer
private

Definition at line 105 of file NoiseRemoval.h.

Referenced by End(), FillFirstHistoryWindow(), Initialize(), and RemoveNoise().

◆ mFreqSmoothingBins

int EffectNoiseRemoval::mFreqSmoothingBins
private

Definition at line 108 of file NoiseRemoval.h.

Referenced by ApplyFreqSmoothing(), and Initialize().

◆ mFreqSmoothingHz

double EffectNoiseRemoval::mFreqSmoothingHz
private

◆ mGains

ArraysOf<float> EffectNoiseRemoval::mGains
private

◆ mHasProfile

bool EffectNoiseRemoval::mHasProfile
private

Definition at line 64 of file NoiseRemoval.h.

Referenced by EffectNoiseRemoval(), Process(), and ShowInterface().

◆ mHistoryLen

size_t EffectNoiseRemoval::mHistoryLen
private

◆ mImagFFTs

ArraysOf<float> EffectNoiseRemoval::mImagFFTs
private

◆ mInputPos

int EffectNoiseRemoval::mInputPos
private

Definition at line 102 of file NoiseRemoval.h.

Referenced by ProcessSamples(), and StartNewTrack().

◆ mInSampleCount

sampleCount EffectNoiseRemoval::mInSampleCount
private

Definition at line 100 of file NoiseRemoval.h.

Referenced by FinishTrack(), ProcessOne(), ProcessSamples(), and StartNewTrack().

◆ mInWaveBuffer

Floats EffectNoiseRemoval::mInWaveBuffer
private

Definition at line 115 of file NoiseRemoval.h.

Referenced by End(), FillFirstHistoryWindow(), Initialize(), and ProcessSamples().

◆ mLevel

int EffectNoiseRemoval::mLevel
private

Definition at line 65 of file NoiseRemoval.h.

Referenced by CheckWhetherSkipEffect(), and Init().

◆ mMinSignalBlocks

size_t EffectNoiseRemoval::mMinSignalBlocks
private

Definition at line 113 of file NoiseRemoval.h.

Referenced by GetProfile(), Initialize(), and RemoveNoise().

◆ mMinSignalTime

float EffectNoiseRemoval::mMinSignalTime
private

Definition at line 71 of file NoiseRemoval.h.

Referenced by EffectNoiseRemoval(), and Initialize().

◆ mNoiseAttenFactor

float EffectNoiseRemoval::mNoiseAttenFactor
private

Definition at line 111 of file NoiseRemoval.h.

Referenced by FillFirstHistoryWindow(), Initialize(), RemoveNoise(), and StartNewTrack().

◆ mNoiseGain

double EffectNoiseRemoval::mNoiseGain
private

◆ mNoiseThreshold

Floats EffectNoiseRemoval::mNoiseThreshold
private

Definition at line 75 of file NoiseRemoval.h.

Referenced by EffectNoiseRemoval(), End(), GetProfile(), Initialize(), and RemoveNoise().

◆ mOneBlockAttackDecay

float EffectNoiseRemoval::mOneBlockAttackDecay
private

Definition at line 110 of file NoiseRemoval.h.

Referenced by Initialize(), and RemoveNoise().

◆ mOutOverlapBuffer

Floats EffectNoiseRemoval::mOutOverlapBuffer
private

Definition at line 116 of file NoiseRemoval.h.

Referenced by End(), Initialize(), RemoveNoise(), and StartNewTrack().

◆ mOutputTrack

std::shared_ptr<WaveTrack> EffectNoiseRemoval::mOutputTrack
private

Definition at line 99 of file NoiseRemoval.h.

Referenced by End(), ProcessOne(), and RemoveNoise().

◆ mOutSampleCount

sampleCount EffectNoiseRemoval::mOutSampleCount
private

Definition at line 101 of file NoiseRemoval.h.

Referenced by FinishTrack(), GetProfile(), ProcessSamples(), RemoveNoise(), and StartNewTrack().

◆ mRealFFTs

ArraysOf<float> EffectNoiseRemoval::mRealFFTs
private

◆ mSampleRate

double EffectNoiseRemoval::mSampleRate
private

Definition at line 68 of file NoiseRemoval.h.

Referenced by Initialize().

◆ mSensitivity

double EffectNoiseRemoval::mSensitivity
private

◆ mSensitivityFactor

float EffectNoiseRemoval::mSensitivityFactor
private

Definition at line 112 of file NoiseRemoval.h.

Referenced by Initialize(), and RemoveNoise().

◆ mSpectrums

ArraysOf<float> EffectNoiseRemoval::mSpectrums
private

◆ mSpectrumSize

size_t EffectNoiseRemoval::mSpectrumSize
private

◆ mWindow

Floats EffectNoiseRemoval::mWindow
private

Definition at line 106 of file NoiseRemoval.h.

Referenced by End(), Initialize(), and RemoveNoise().

◆ mWindowSize

size_t EffectNoiseRemoval::mWindowSize
private

◆ Symbol

const ComponentInterfaceSymbol EffectNoiseRemoval::Symbol { XO("Noise Removal") }
static

Definition at line 37 of file NoiseRemoval.h.

Referenced by GetSymbol().


The documentation for this class was generated from the following files:
EffectNoiseRemoval::mFFTBuffer
Floats mFFTBuffer
Definition: NoiseRemoval.h:105
WaveTrack
A Track that contains audio waveform data.
Definition: WaveTrack.h:69
EffectTypeProcess
@ EffectTypeProcess
Definition: EffectInterface.h:59
DB_TO_LINEAR
const double MIN_Threshold_Linear DB_TO_LINEAR(MIN_Threshold_dB)
EffectNoiseRemoval::mDoProfile
bool mDoProfile
Definition: NoiseRemoval.h:63
EffectNoiseRemoval::mNoiseAttenFactor
float mNoiseAttenFactor
Definition: NoiseRemoval.h:111
MAX_NOISE_LEVEL
#define MAX_NOISE_LEVEL
Definition: NoiseRemoval.cpp:140
EffectNoiseRemoval::mMinSignalTime
float mMinSignalTime
Definition: NoiseRemoval.h:71
EffectNoiseRemoval::mMinSignalBlocks
size_t mMinSignalBlocks
Definition: NoiseRemoval.h:113
gPrefs
FileConfig * gPrefs
Definition: Prefs.cpp:70
Effect::CopyInputTracks
void CopyInputTracks(bool allSyncLockSelected=false)
Definition: Effect.cpp:2071
EffectNoiseRemoval::Initialize
void Initialize()
Definition: NoiseRemoval.cpp:263
RealFFTf
void RealFFTf(fft_type *buffer, const FFTParam *h)
Definition: RealFFTf.cpp:162
Effect::mT1
double mT1
Definition: Effect.h:467
ArrayOf::reinit
void reinit(Integral count, bool initialize=false)
Definition: MemoryX.h:57
EffectNoiseRemoval::mWindowSize
size_t mWindowSize
Definition: NoiseRemoval.h:69
XO
#define XO(s)
Definition: Internat.h:31
EffectNoiseRemoval::ProcessSamples
void ProcessSamples(size_t len, float *buffer)
Definition: NoiseRemoval.cpp:345
EffectNoiseRemoval::mOutputTrack
std::shared_ptr< WaveTrack > mOutputTrack
Definition: NoiseRemoval.h:99
EffectNoiseRemoval::mOneBlockAttackDecay
float mOneBlockAttackDecay
Definition: NoiseRemoval.h:110
EffectNoiseRemoval::mOutOverlapBuffer
Floats mOutOverlapBuffer
Definition: NoiseRemoval.h:116
WaveTrack::ClearAndPaste
void ClearAndPaste(double t0, double t1, const Track *src, bool preserve=true, bool merge=true, const TimeWarper *effectWarper=NULL)
Definition: WaveTrack.cpp:847
WaveTrack::EmptyCopy
Holder EmptyCopy(const SampleBlockFactoryPtr &pFactory={}) const
Definition: WaveTrack.cpp:666
EffectNoiseRemoval::mInWaveBuffer
Floats mInWaveBuffer
Definition: NoiseRemoval.h:115
EffectNoiseRemoval::mInputPos
int mInputPos
Definition: NoiseRemoval.h:102
EffectNoiseRemoval::mInSampleCount
sampleCount mInSampleCount
Definition: NoiseRemoval.h:100
WaveTrack::Get
bool Get(samplePtr buffer, sampleFormat format, sampleCount start, size_t len, fillFormat fill=fillZero, bool mayThrow=true, sampleCount *pNumWithinClips=nullptr) const
Retrieve samples from a track in a specified format.
Definition: WaveTrack.cpp:1993
EffectNoiseRemoval::ProcessOne
bool ProcessOne(int count, WaveTrack *track, sampleCount start, sampleCount len)
Definition: NoiseRemoval.cpp:525
floatSample
@ floatSample
Definition: SampleFormat.h:34
ArraysOf::reinit
void reinit(Integral count)
Definition: MemoryX.h:109
Effect::mProjectRate
double mProjectRate
Definition: Effect.h:458
EffectNoiseRemoval::mHasProfile
bool mHasProfile
Definition: NoiseRemoval.h:64
Effect::mT0
double mT0
Definition: Effect.h:466
sampleCount::as_double
double as_double() const
Definition: SampleCount.h:45
EffectNoiseRemoval::mFreqSmoothingBins
int mFreqSmoothingBins
Definition: NoiseRemoval.h:108
EffectNoiseRemoval::mbLeaveNoise
bool mbLeaveNoise
Definition: NoiseRemoval.h:83
EffectNoiseRemoval::GetProfile
void GetProfile()
Definition: NoiseRemoval.cpp:427
Effect::ReplaceProcessedTracks
void ReplaceProcessedTracks(const bool bGoodResult)
Definition: Effect.cpp:2193
EffectNoiseRemoval::mAttackDecayTime
double mAttackDecayTime
Definition: NoiseRemoval.h:82
EffectNoiseRemoval::mWindow
Floats mWindow
Definition: NoiseRemoval.h:106
EffectNoiseRemoval::mSensitivity
double mSensitivity
Definition: NoiseRemoval.h:79
EffectNoiseRemoval::Symbol
static const ComponentInterfaceSymbol Symbol
Definition: NoiseRemoval.h:37
EffectNoiseRemoval::mNoiseThreshold
Floats mNoiseThreshold
Definition: NoiseRemoval.h:75
EffectNoiseRemoval::RemoveNoise
void RemoveNoise()
Definition: NoiseRemoval.cpp:450
EffectNoiseRemoval::FinishTrack
void FinishTrack()
Definition: NoiseRemoval.cpp:410
EffectNoiseRemoval::mLevel
int mLevel
Definition: NoiseRemoval.h:65
InverseRealFFTf
void InverseRealFFTf(fft_type *buffer, const FFTParam *h)
Definition: RealFFTf.cpp:264
Effect::mOutputTracks
std::shared_ptr< TrackList > mOutputTracks
Definition: Effect.h:465
EffectNoiseRemoval::mOutSampleCount
sampleCount mOutSampleCount
Definition: NoiseRemoval.h:101
EffectNoiseRemoval::mGains
ArraysOf< float > mGains
Definition: NoiseRemoval.h:118
samplePtr
char * samplePtr
Definition: SampleFormat.h:49
EffectNoiseRemoval::mHistoryLen
size_t mHistoryLen
Definition: NoiseRemoval.h:114
WaveTrack::GetMaxBlockSize
size_t GetMaxBlockSize() const
Definition: WaveTrack.cpp:1669
min
int min(int a, int b)
Definition: CompareAudioCommand.cpp:106
EffectNoiseRemoval::mImagFFTs
ArraysOf< float > mImagFFTs
Definition: NoiseRemoval.h:120
FileConfig::Flush
virtual bool Flush(bool bCurrentOnly=false) wxOVERRIDE
Definition: FileConfig.cpp:143
EffectNoiseRemoval::mAttackDecayBlocks
int mAttackDecayBlocks
Definition: NoiseRemoval.h:109
EffectNoiseRemoval::ApplyFreqSmoothing
void ApplyFreqSmoothing(float *spec)
Definition: NoiseRemoval.cpp:244
EffectNoiseRemoval::mSpectrumSize
size_t mSpectrumSize
Definition: NoiseRemoval.h:70
EffectNoiseRemoval::hFFT
HFFT hFFT
Definition: NoiseRemoval.h:104
EffectNoiseRemoval::mFreqSmoothingHz
double mFreqSmoothingHz
Definition: NoiseRemoval.h:80
anonymous_namespace{NoiseRemoval.cpp}::Rotate
void Rotate(ArraysOf< float > &arrays, size_t historyLen)
Definition: NoiseRemoval.cpp:391
EffectNoiseRemoval::StartNewTrack
void StartNewTrack()
Definition: NoiseRemoval.cpp:326
M_PI
#define M_PI
Definition: Distortion.cpp:29
Effect::GetNumWaveTracks
int GetNumWaveTracks()
Definition: Effect.h:345
GetFFT
HFFT GetFFT(size_t fftlen)
Definition: RealFFTf.cpp:105
WaveTrack::GetBestBlockSize
size_t GetBestBlockSize(sampleCount t) const
Definition: WaveTrack.cpp:1651
EffectNoiseRemoval::mNoiseGain
double mNoiseGain
Definition: NoiseRemoval.h:81
EffectNoiseRemoval::mSpectrums
ArraysOf< float > mSpectrums
Definition: NoiseRemoval.h:117
NoiseRemovalDialog
Dialog used with EffectNoiseRemoval.
Definition: NoiseRemoval.h:134
EffectNoiseRemoval::RotateHistoryWindows
void RotateHistoryWindows()
Definition: NoiseRemoval.cpp:401
limitSampleBufferSize
size_t limitSampleBufferSize(size_t bufferSize, sampleCount limit)
Definition: SampleCount.cpp:23
Effect::TrackProgress
bool TrackProgress(int whichTrack, double frac, const TranslatableString &={})
Definition: Effect.cpp:2025
EffectNoiseRemoval::mRealFFTs
ArraysOf< float > mRealFFTs
Definition: NoiseRemoval.h:119
ArrayOf< float >
EffectNoiseRemoval::FillFirstHistoryWindow
void FillFirstHistoryWindow()
Definition: NoiseRemoval.cpp:372
EffectNoiseRemoval::Init
bool Init() override
Definition: NoiseRemoval.cpp:141
EffectNoiseRemoval::mSensitivityFactor
float mSensitivityFactor
Definition: NoiseRemoval.h:112
EffectNoiseRemoval::mSampleRate
double mSampleRate
Definition: NoiseRemoval.h:68