Audacity  3.2.0
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
 Type determines how it behaves. More...
 
bool SupportsAutomation () override
 Whether the effect can be used without the UI, in a macro. More...
 
int ShowHostInterface (wxWindow &parent, const EffectDialogFactory &factory, bool forceModal=false) override
 An override still here for historical reasons, ignoring the factory. More...
 
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
 Report identifier and user-visible name of the effect protocol. More...
 
bool IsInteractive () override
 Whether the effect needs a dialog for entry of settings. More...
 
bool IsDefault () override
 Whether the effect sorts "above the line" in the menus. More...
 
bool IsLegacy () override
 
bool SupportsRealtime () override
 Whether the effect supports realtime previewing (while audio is playing). More...
 
bool GetAutomationParameters (CommandParameters &parms) override
 Save current settings into parms. More...
 
bool SetAutomationParameters (CommandParameters &parms) override
 Change settings to those stored in parms. More...
 
bool LoadUserPreset (const RegistryPath &name) override
 Change settings to a user-named preset. More...
 
bool SaveUserPreset (const RegistryPath &name) override
 Save current settings as a user-named preset. More...
 
RegistryPaths GetFactoryPresets () override
 Report names of factory presets. More...
 
bool LoadFactoryPreset (int id) override
 Change settings to the preset whose name is GetFactoryPresets()[id] More...
 
bool LoadFactoryDefaults () override
 Change settings back to "factory default". More...
 
bool SetHost (EffectHostInterface *host) override
 
unsigned GetAudioInCount () override
 
unsigned GetAudioOutCount () override
 
int GetMidiInCount () override
 
int GetMidiOutCount () override
 
sampleCount GetLatency () override
 Called for destructive, non-realtime effect computation. More...
 
size_t GetTailSize () override
 
void SetSampleRate (double rate) override
 
size_t SetBlockSize (size_t maxBlockSize) override
 
size_t GetBlockSize () const override
 
bool ProcessInitialize (sampleCount totalLen, ChannelNames chanMap=NULL) override
 Called for destructive, non-realtime effect computation. More...
 
bool ProcessFinalize () override
 Called for destructive, non-realtime effect computation. More...
 
size_t ProcessBlock (float **inBlock, float **outBlock, size_t blockLen) override
 Called for destructive, non-realtime effect computation. More...
 
bool RealtimeInitialize () override
 
bool RealtimeAddProcessor (unsigned numChannels, float sampleRate) override
 
bool RealtimeFinalize () override
 
bool RealtimeSuspend () override
 
bool RealtimeResume () noexcept override
 
bool RealtimeProcessStart () override
 
size_t RealtimeProcess (int group, float **inbuf, float **outbuf, size_t numSamples) override
 
bool RealtimeProcessEnd () noexcept override
 
int ShowClientInterface (wxWindow &parent, wxDialog &dialog, bool forceModal=false) override
 
bool PopulateUI (ShuttleGui &S) final
 Adds controls to a panel that is given as the parent window of S More...
 
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
 
EffectDefinitionInterfaceGetDefinition () 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 ()
 
unsigned TestUIFlags (unsigned mask)
 
void SetPresetParameters (const wxArrayString *Names, const wxArrayString *Values)
 
virtual bool Startup (EffectUIClientInterface *client)
 
virtual bool GetAutomationParametersAsString (wxString &parms)
 
virtual bool SetAutomationParametersFromString (const wxString &parms)
 
virtual bool IsBatchProcessing ()
 
virtual void SetBatchProcessing (bool start)
 
bool DoEffect (double projectRate, TrackList *list, WaveTrackFactory *factory, NotifyingSelectedRegion &selectedRegion, unsigned flags, wxWindow *pParent=nullptr, const EffectDialogFactory &dialogFactory={})
 
bool Delegate (Effect &delegate, wxWindow &parent, const EffectDialogFactory &factory)
 
int MessageBox (const TranslatableString &message, long style=DefaultMessageBoxStyle, const TranslatableString &titleStr={})
 
virtual bool Startup ()
 
- Public Member Functions inherited from EffectUIClientInterface
virtual ~EffectUIClientInterface ()
 
- Public Member Functions inherited from EffectProcessor
virtual ~EffectProcessor ()
 
- Public Member Functions inherited from EffectDefinitionInterface
virtual ~EffectDefinitionInterface ()
 
virtual EffectType GetClassification ()
 Determines which menu it appears in; default same as GetType(). More...
 
virtual bool EnablesDebug ()
 Whether the effect dialog should have a Debug button; default, always false. More...
 
virtual ManualPageID ManualPage ()
 Name of a page in the Audacity alpha manual, default is empty. More...
 
virtual FilePath HelpPage ()
 Fully qualified local help file name, default is empty. More...
 
virtual bool IsHiddenFromMenus ()
 Default is false. More...
 
- Public Member Functions inherited from ComponentInterface
virtual ~ComponentInterface ()
 
TranslatableString GetName ()
 
virtual bool DefineParams (ShuttleParams &WXUNUSED(S))
 
- Public Member Functions inherited from EffectUIHostInterface
virtual ~EffectUIHostInterface ()
 
- Public Member Functions inherited from EffectHostInterface
virtual ~EffectHostInterface ()
 

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 }
 
- Static Public Member Functions inherited from Effect
static void IncEffectCounter ()
 
- Static Public Member Functions inherited from EffectDefinitionInterface
static Identifier GetSquashedName (const Identifier &ident)
 A utility that strips spaces and CamelCases a name. More...
 
- Protected Member Functions inherited from Effect
bool EnableApply (bool enable=true)
 
bool EnablePreview (bool enable=true)
 
virtual bool ProcessPass ()
 
virtual bool InitPass1 ()
 
virtual bool InitPass2 ()
 
virtual double CalcPreviewInputLength (double previewLength)
 
virtual void Preview (bool dryOnly)
 
virtual void PopulateOrExchange (ShuttleGui &S)
 
virtual bool TransferDataToWindow ()
 
virtual bool TransferDataFromWindow ()
 
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
BasicUI::ProgressDialogmProgress = nullptr
 
double mProjectRate
 
double mSampleRate
 
WaveTrackFactorymFactory
 
std::shared_ptr< TrackListmOutputTracks
 
double mT0
 
double mT1
 
wxArrayString mPresetNames
 
wxArrayString mPresetValues
 
int mPass
 
wxWeakRef< wxDialog > mHostUIDialog
 This smart pointer tracks the lifetime of the dialog. More...
 
wxWeakRef< wxDialog > mUIDialog
 This weak pointer may be the same as the above, or null. More...
 
wxWindow * mUIParent
 
unsigned mUIFlags { 0 }
 
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 251 of file NoiseRemoval.cpp.

252 {
253  Floats tmp{ mSpectrumSize };
254  int j, j0, j1;
255 
256  for(int i = 0; i < mSpectrumSize; i++) {
257  j0 = wxMax(0, i - mFreqSmoothingBins);
258  j1 = wxMin(mSpectrumSize-1, i + mFreqSmoothingBins);
259  tmp[i] = 0.0;
260  for(j = j0; j <= j1; j++) {
261  tmp[i] += spec[j];
262  }
263  tmp[i] /= (j1 - j0 + 1);
264  }
265 
266  for(size_t i = 0; i < mSpectrumSize; i++)
267  spec[i] = tmp[i];
268 }

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 312 of file NoiseRemoval.cpp.

313 {
314  hFFT.reset();
315 
316  if (mDoProfile) {
318  }
319 
320  mSpectrums.reset();
321  mGains.reset();
322  mRealFFTs.reset();
323  mImagFFTs.reset();
324 
325  mFFTBuffer.reset();
326  mInWaveBuffer.reset();
327  mWindow.reset();
328  mOutOverlapBuffer.reset();
329 
330  mOutputTrack.reset();
331 }

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 379 of file NoiseRemoval.cpp.

380 {
381  for(size_t i = 0; i < mWindowSize; i++)
382  mFFTBuffer[i] = mInWaveBuffer[i];
383  RealFFTf(mFFTBuffer.get(), hFFT.get());
384  for(size_t i = 1; i + 1 < mSpectrumSize; i++) {
385  mRealFFTs[0][i] = mFFTBuffer[hFFT->BitReversed[i] ];
386  mImagFFTs[0][i] = mFFTBuffer[hFFT->BitReversed[i]+1];
387  mSpectrums[0][i] = mRealFFTs[0][i]*mRealFFTs[0][i] + mImagFFTs[0][i]*mImagFFTs[0][i];
388  mGains[0][i] = mNoiseAttenFactor;
389  }
390  // DC and Fs/2 bins need to be handled specially
391  mSpectrums[0][0] = mFFTBuffer[0]*mFFTBuffer[0];
393  mGains[0][0] = mNoiseAttenFactor;
395 }

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 417 of file NoiseRemoval.cpp.

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

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 434 of file NoiseRemoval.cpp.

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

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

Type determines how it behaves.

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 270 of file NoiseRemoval.cpp.

271 {
274  mAttackDecayBlocks = 1 +
275  (int)(mAttackDecayTime * mSampleRate / (mWindowSize / 2));
278  // Applies to power, divide by 10:
279  mSensitivityFactor = pow(10.0, mSensitivity/10.0);
281  (int)(mMinSignalTime * mSampleRate / (mWindowSize / 2));
282  if( mMinSignalBlocks < 1 )
283  mMinSignalBlocks = 1;
284  mHistoryLen = (2 * mAttackDecayBlocks) - 1;
285 
288 
293 
294  // Initialize the FFT
296 
301 
302  // Create a Hann window function
303  for(size_t i=0; i<mWindowSize; i++)
304  mWindow[i] = 0.5 - 0.5 * cos((2.0*M_PI*i) / mWindowSize);
305 
306  if (mDoProfile) {
307  for (size_t i = 0; i < mSpectrumSize; i++)
308  mNoiseThreshold[i] = float(0);
309  }
310 }

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

If Process() is not overridden, it uses ProcessInitialize(), ProcessBlock(), and ProcessFinalize() methods of EffectProcessor, and also GetLatency() to determine how many leading output samples to discard and how many extra samples to produce.

Reimplemented from Effect.

Definition at line 213 of file NoiseRemoval.cpp.

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

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 532 of file NoiseRemoval.cpp.

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

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 352 of file NoiseRemoval.cpp.

353 {
354  while(len && mOutSampleCount < mInSampleCount) {
355  size_t avail = wxMin(len, mWindowSize - mInputPos);
356  for(size_t i = 0; i < avail; i++)
357  mInWaveBuffer[mInputPos + i] = buffer[i];
358  buffer += avail;
359  len -= avail;
360  mInputPos += avail;
361 
362  if (mInputPos == int(mWindowSize)) {
364  if (mDoProfile)
365  GetProfile();
366  else
367  RemoveNoise();
369 
370  // Rotate halfway for overlap-add
371  for(size_t i = 0; i < mWindowSize / 2; i++) {
373  }
374  mInputPos = mWindowSize / 2;
375  }
376  }
377 }

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 457 of file NoiseRemoval.cpp.

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

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 408 of file NoiseRemoval.cpp.

409 {
410  // Remember the last window so we can reuse it
415 }

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:

◆ ShowHostInterface()

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

An override still here for historical reasons, ignoring the factory.

We would like to make this effect behave more like others, but it does have its unusual two-pass nature. First choose and analyze an example of noise, then apply noise reduction to another selection. That is difficult to fit into the framework for managing settings of other effects.

Reimplemented from Effect.

Definition at line 161 of file NoiseRemoval.cpp.

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

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 333 of file NoiseRemoval.cpp.

334 {
335  for(size_t i = 0; i < mHistoryLen; i++) {
336  for(size_t j = 0; j < mSpectrumSize; j++) {
337  mSpectrums[i][j] = 0;
338  mGains[i][j] = mNoiseAttenFactor;
339  mRealFFTs[i][j] = 0.0;
340  mImagFFTs[i][j] = 0.0;
341  }
342  }
343 
344  for(size_t j = 0; j < mWindowSize; j++)
345  mOutOverlapBuffer[j] = 0.0;
346 
347  mInputPos = 0;
348  mInSampleCount = 0;
349  mOutSampleCount = -(int)((mWindowSize / 2) * (mHistoryLen - 1));
350 }

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

Whether the effect can be used without the UI, in a macro.

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 ShowHostInterface().

◆ 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:75
EffectTypeProcess
@ EffectTypeProcess
Definition: EffectInterface.h:56
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:71
Effect::CopyInputTracks
void CopyInputTracks(bool allSyncLockSelected=false)
Definition: Effect.cpp:1834
EffectNoiseRemoval::Initialize
void Initialize()
Definition: NoiseRemoval.cpp:270
RealFFTf
void RealFFTf(fft_type *buffer, const FFTParam *h)
Definition: RealFFTf.cpp:162
Effect::mT1
double mT1
Definition: Effect.h:424
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
WaveTrack::GetBestBlockSize
size_t GetBestBlockSize(sampleCount t) const override
This returns a nonnegative number of samples meant to size a memory buffer.
Definition: WaveTrack.cpp:1793
EffectNoiseRemoval::ProcessSamples
void ProcessSamples(size_t len, float *buffer)
Definition: NoiseRemoval.cpp:352
WaveTrack::Get
bool Get(samplePtr buffer, sampleFormat format, sampleCount start, size_t len, fillFormat fill=fillZero, bool mayThrow=true, sampleCount *pNumWithinClips=nullptr) const override
Definition: WaveTrack.cpp:2111
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:917
WaveTrack::EmptyCopy
Holder EmptyCopy(const SampleBlockFactoryPtr &pFactory={}) const
Definition: WaveTrack.cpp:709
EffectNoiseRemoval::mInWaveBuffer
Floats mInWaveBuffer
Definition: NoiseRemoval.h:115
EffectNoiseRemoval::mInputPos
int mInputPos
Definition: NoiseRemoval.h:102
EffectNoiseRemoval::mInSampleCount
sampleCount mInSampleCount
Definition: NoiseRemoval.h:100
EffectNoiseRemoval::ProcessOne
bool ProcessOne(int count, WaveTrack *track, sampleCount start, sampleCount len)
Definition: NoiseRemoval.cpp:532
floatSample
@ floatSample
Definition: SampleFormat.h:34
ArraysOf::reinit
void reinit(Integral count)
Definition: MemoryX.h:109
Effect::mProjectRate
double mProjectRate
Definition: Effect.h:416
EffectNoiseRemoval::mHasProfile
bool mHasProfile
Definition: NoiseRemoval.h:64
Effect::mT0
double mT0
Definition: Effect.h:423
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:434
Effect::ReplaceProcessedTracks
void ReplaceProcessedTracks(const bool bGoodResult)
Definition: Effect.cpp:1956
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:457
EffectNoiseRemoval::FinishTrack
void FinishTrack()
Definition: NoiseRemoval.cpp:417
EffectNoiseRemoval::mLevel
int mLevel
Definition: NoiseRemoval.h:65
InverseRealFFTf
void InverseRealFFTf(fft_type *buffer, const FFTParam *h)
Definition: RealFFTf.cpp:264
WaveTrack::GetMaxBlockSize
size_t GetMaxBlockSize() const override
This returns a nonnegative number of samples meant to size a memory buffer.
Definition: WaveTrack.cpp:1811
Effect::mOutputTracks
std::shared_ptr< TrackList > mOutputTracks
Definition: Effect.h:422
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
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:251
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:398
EffectNoiseRemoval::StartNewTrack
void StartNewTrack()
Definition: NoiseRemoval.cpp:333
M_PI
#define M_PI
Definition: Distortion.cpp:29
Effect::GetNumWaveTracks
int GetNumWaveTracks()
Definition: Effect.h:304
GetFFT
HFFT GetFFT(size_t fftlen)
Definition: RealFFTf.cpp:105
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:408
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:1788
EffectNoiseRemoval::mRealFFTs
ArraysOf< float > mRealFFTs
Definition: NoiseRemoval.h:119
ArrayOf< float >
EffectNoiseRemoval::FillFirstHistoryWindow
void FillFirstHistoryWindow()
Definition: NoiseRemoval.cpp:379
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