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 () const override
 Type determines how it behaves. More...
 
bool SupportsAutomation () const override
 Whether the effect has any automatable controls. More...
 
int ShowHostInterface (EffectPlugin &plugin, wxWindow &parent, const EffectDialogFactory &factory, std::shared_ptr< EffectInstance > &pInstance, EffectSettingsAccess &access, bool forceModal=false) override
 
bool Init () override
 
bool CheckWhetherSkipEffect (const EffectSettings &settings) const override
 After Init(), tell whether Process() should be skipped. More...
 
bool Process (EffectInstance &instance, EffectSettings &settings) override
 
void End () override
 
- Public Member Functions inherited from StatefulEffect
 ~StatefulEffect () override
 
std::shared_ptr< EffectInstanceMakeInstance () const override
 Make an object maintaining short-term state of an Effect. More...
 
- Public Member Functions inherited from StatefulEffectBase
virtual bool Init ()
 
virtual bool Process (EffectInstance &instance, EffectSettings &settings)=0
 
virtual bool RealtimeInitialize (EffectSettings &settings, double sampleRate)
 
virtual bool RealtimeAddProcessor (EffectSettings &settings, EffectOutputs *pOutputs, unsigned numChannels, float sampleRate)
 
virtual bool RealtimeSuspend ()
 
virtual bool RealtimeResume ()
 
virtual bool RealtimeProcessStart (MessagePackage &package)
 settings are possibly changed, since last call, by an asynchronous dialog More...
 
virtual size_t RealtimeProcess (size_t group, EffectSettings &settings, const float *const *inBuf, float *const *outBuf, size_t numSamples)
 
virtual bool RealtimeProcessEnd (EffectSettings &settings) noexcept
 settings can be updated to let a dialog change appearance at idle More...
 
virtual bool RealtimeFinalize (EffectSettings &settings) noexcept
 
virtual size_t SetBlockSize (size_t maxBlockSize)
 
virtual size_t GetBlockSize () const
 
virtual unsigned GetAudioInCount () const
 How many input buffers to allocate at once. More...
 
virtual unsigned GetAudioOutCount () const
 How many output buffers to allocate at once. More...
 
virtual sampleCount GetLatency () const
 
virtual bool NeedsDither () const
 
virtual bool ProcessInitialize (EffectSettings &settings, double sampleRate, ChannelNames chanMap=nullptr)
 
virtual bool ProcessFinalize () noexcept
 
- Public Member Functions inherited from Effect
 Effect ()
 
virtual ~Effect ()
 
PluginPath GetPath () const override
 
bool VisitSettings (SettingsVisitor &visitor, EffectSettings &settings) override
 
bool VisitSettings (ConstSettingsVisitor &visitor, const EffectSettings &settings) const override
 
ComponentInterfaceSymbol GetSymbol () const override
 
VendorSymbol GetVendor () const override
 
wxString GetVersion () const override
 
TranslatableString GetDescription () const override
 
EffectType GetType () const override
 Type determines how it behaves. More...
 
EffectFamilySymbol GetFamily () const override
 Report identifier and user-visible name of the effect protocol. More...
 
bool IsInteractive () const override
 Whether the effect needs a dialog for entry of settings. More...
 
bool IsDefault () const override
 Whether the effect sorts "above the line" in the menus. More...
 
RealtimeSince RealtimeSupport () const override
 Since which version of Audacity has the effect supported realtime? More...
 
bool SupportsAutomation () const override
 Whether the effect has any automatable controls. More...
 
bool SaveSettings (const EffectSettings &settings, CommandParameters &parms) const override
 Store settings as keys and values. More...
 
bool LoadSettings (const CommandParameters &parms, EffectSettings &settings) const override
 Restore settings from keys and values. More...
 
OptionalMessage LoadUserPreset (const RegistryPath &name, EffectSettings &settings) const override
 
bool SaveUserPreset (const RegistryPath &name, const EffectSettings &settings) const override
 Save settings in the configuration file as a user-named preset. More...
 
RegistryPaths GetFactoryPresets () const override
 Report names of factory presets. More...
 
OptionalMessage LoadFactoryPreset (int id, EffectSettings &settings) const override
 
OptionalMessage LoadFactoryDefaults (EffectSettings &settings) const override
 
virtual const EffectParameterMethodsParameters () const
 
bool CanExportPresets () const override
 Whether the effect supports export of presets to files, and importing too. More...
 
bool HasOptions () const override
 
const EffectSettingsManagerGetDefinition () const override
 
virtual NumericFormatSymbol GetSelectionFormat ()
 
bool SaveSettingsAsString (const EffectSettings &settings, wxString &parms) const override
 
OptionalMessage LoadSettingsFromString (const wxString &parms, EffectSettings &settings) const override
 
bool IsBatchProcessing () const override
 
void SetBatchProcessing () override
 
void UnsetBatchProcessing () override
 
unsigned TestUIFlags (unsigned mask)
 
bool Delegate (Effect &delegate, EffectSettings &settings)
 Re-invoke DoEffect on another Effect object that implements the work. More...
 
- Public Member Functions inherited from EffectBase
 EffectBase ()
 
 ~EffectBase () override
 
void SetTracks (TrackList *pTracks)
 
bool DoEffect (EffectSettings &settings, const InstanceFinder &finder, double projectRate, TrackList *list, WaveTrackFactory *factory, NotifyingSelectedRegion &selectedRegion, unsigned flags, const EffectSettingsAccessPtr &pAccess) override
 
- Public Member Functions inherited from EffectPlugin
EffectPluginoperator= (EffectPlugin &)=delete
 
virtual ~EffectPlugin ()
 
virtual bool HasOptions () const =0
 
virtual bool CanExportPresets () const =0
 Whether the effect supports export of presets to files, and importing too. More...
 
virtual const EffectSettingsManagerGetDefinition () const =0
 
virtual void Preview (EffectSettingsAccess &access, std::function< void()> updateUI, bool dryOnly)=0
 Calculate temporary tracks of limited length with effect applied and play. More...
 
virtual bool SaveSettingsAsString (const EffectSettings &settings, wxString &parms) const =0
 
virtual OptionalMessage LoadSettingsFromString (const wxString &parms, EffectSettings &settings) const =0
 
virtual bool IsBatchProcessing () const =0
 
virtual void SetBatchProcessing ()=0
 
virtual void UnsetBatchProcessing ()=0
 
virtual bool DoEffect (EffectSettings &settings, const InstanceFinder &finder, double projectRate, TrackList *list, WaveTrackFactory *factory, NotifyingSelectedRegion &selectedRegion, unsigned flags, const EffectSettingsAccessPtr &pAccess=nullptr)=0
 
- Public Member Functions inherited from EffectInstanceFactory
virtual ~EffectInstanceFactory ()
 
virtual std::shared_ptr< EffectInstanceMakeInstance () const =0
 Make an object maintaining short-term state of an Effect. More...
 
- Public Member Functions inherited from EffectSettingsManager
virtual ~EffectSettingsManager ()
 
virtual bool VisitSettings (SettingsVisitor &visitor, EffectSettings &settings)
 
virtual bool VisitSettings (ConstSettingsVisitor &visitor, const EffectSettings &settings) const
 
virtual EffectSettings MakeSettings () const
 
virtual bool CopySettingsContents (const EffectSettings &src, EffectSettings &dst) const
 Update one settings object from another. More...
 
virtual std::unique_ptr< EffectOutputsMakeOutputs () const
 Produce an object to hold values to send to effect output meters. More...
 
- Public Member Functions inherited from EffectDefinitionInterface
virtual ~EffectDefinitionInterface ()
 
virtual EffectType GetType () const =0
 Type determines how it behaves. More...
 
virtual EffectType GetClassification () const
 Determines which menu it appears in; default same as GetType(). More...
 
virtual EffectFamilySymbol GetFamily () const =0
 Report identifier and user-visible name of the effect protocol. More...
 
virtual bool IsInteractive () const =0
 Whether the effect needs a dialog for entry of settings. More...
 
virtual bool IsDefault () const =0
 Whether the effect sorts "above the line" in the menus. More...
 
virtual RealtimeSince RealtimeSupport () const =0
 Since which version of Audacity has the effect supported realtime? More...
 
bool SupportsRealtime () const
 
virtual bool SupportsAutomation () const =0
 Whether the effect has any automatable controls. More...
 
virtual bool EnablesDebug () const
 Whether the effect dialog should have a Debug button; default, always false. More...
 
virtual ManualPageID ManualPage () const
 Name of a page in the Audacity alpha manual, default is empty. More...
 
virtual FilePath HelpPage () const
 Fully qualified local help file name, default is empty. More...
 
virtual bool IsHiddenFromMenus () const
 Default is false. More...
 
- Public Member Functions inherited from ComponentInterface
virtual ~ComponentInterface ()
 
virtual PluginPath GetPath () const =0
 
virtual ComponentInterfaceSymbol GetSymbol () const =0
 
virtual VendorSymbol GetVendor () const =0
 
virtual wxString GetVersion () const =0
 
virtual TranslatableString GetDescription () const =0
 
TranslatableString GetName () const
 
- Public Member Functions inherited from StatefulEffectUIServices
 ~StatefulEffectUIServices () override
 
std::unique_ptr< EffectEditorPopulateUI (const EffectPlugin &plugin, ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access, const EffectOutputs *pOutputs) const override
 Allows PopulateOrExchange to return null. More...
 
virtual std::unique_ptr< EffectEditorPopulateOrExchange (ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access, const EffectOutputs *pOutputs)
 Add controls to effect panel; always succeeds. More...
 
virtual bool TransferDataToWindow (const EffectSettings &settings)
 
virtual bool TransferDataFromWindow (EffectSettings &settings)
 
- Public Member Functions inherited from BasicEffectUIServices
int ShowClientInterface (const EffectPlugin &plugin, wxWindow &parent, wxDialog &dialog, EffectEditor *pEditor, bool forceModal) const override
 
void ExportPresets (const EffectPlugin &plugin, const EffectSettings &settings) const override
 
OptionalMessage ImportPresets (const EffectPlugin &plugin, EffectSettings &settings) const override
 
void ShowOptions (const EffectPlugin &plugin) const override
 
bool ValidateUI (const EffectPlugin &context, EffectSettings &) const override
 
bool CloseUI () const override
 
- Public Member Functions inherited from EffectUIServices
virtual ~EffectUIServices ()
 
virtual int ShowHostInterface (EffectPlugin &plugin, wxWindow &parent, const EffectDialogFactory &factory, std::shared_ptr< EffectInstance > &pInstance, EffectSettingsAccess &access, bool forceModal=false)
 
virtual int ShowClientInterface (const EffectPlugin &plugin, wxWindow &parent, wxDialog &dialog, EffectEditor *pEditor, bool forceModal=false) const =0
 
virtual std::unique_ptr< EffectEditorPopulateUI (const EffectPlugin &plugin, ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access, const EffectOutputs *pOutputs) const =0
 Adds controls to a panel that is given as the parent window of S More...
 
virtual void ExportPresets (const EffectPlugin &plugin, const EffectSettings &settings) const =0
 
virtual OptionalMessage ImportPresets (const EffectPlugin &plugin, EffectSettings &settings) const =0
 
virtual void ShowOptions (const EffectPlugin &plugin) const =0
 
virtual bool ValidateUI (const EffectPlugin &context, EffectSettings &settings) const =0
 
virtual bool CloseUI () const =0
 

Static Public Attributes

static const ComponentInterfaceSymbol Symbol { XO("Noise Removal") }
 
- Static Public Attributes inherited from EffectPlugin
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 StatefulEffectBase
using MessagePackage = EffectInstance::MessagePackage
 
- Public Types inherited from EffectPlugin
using EffectSettingsAccessPtr = std::shared_ptr< EffectSettingsAccess >
 
using InstancePointer = std::shared_ptr< EffectInstanceEx >
 
using InstanceFinder = std::function< std::optional< InstancePointer >(EffectSettings &settings) >
 
- Public Types inherited from EffectDefinitionInterface
enum class  RealtimeSince : unsigned { Never , After_3_1 , Always }
 In which versions of Audacity was an effect realtime capable? More...
 
- Public Types inherited from EffectUIServices
enum  : long { DefaultMessageBoxStyle = wxOK | wxCENTRE }
 
- Static Public Member Functions inherited from Effect
static EffectFetchParameters (Effect &e, EffectSettings &)
 
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...
 
- Static Public Member Functions inherited from EffectUIServices
static int DoMessageBox (const EffectPlugin &plugin, const TranslatableString &message, long style=DefaultMessageBoxStyle, const TranslatableString &titleStr={})
 
- Public Attributes inherited from EffectBase
TrackListmTracks {}
 
- Protected Member Functions inherited from Effect
bool CheckWhetherSkipEffect (const EffectSettings &settings) const override
 Default implementation returns false. More...
 
double CalcPreviewInputLength (const EffectSettings &settings, double previewLength) const override
 Default implementation returns previewLength More...
 
bool TotalProgress (double frac, const TranslatableString &={}) const
 
bool TrackProgress (int whichTrack, double frac, const TranslatableString &={}) const
 
bool TrackGroupProgress (int whichGroup, double frac, const TranslatableString &={}) const
 
int GetNumWaveTracks () const
 
int GetNumWaveGroups () const
 
void GetBounds (const WaveTrack &track, const WaveTrack *pRight, sampleCount *start, sampleCount *len)
 
void CopyInputTracks (bool allSyncLockSelected=false)
 
TrackAddToOutputTracks (const std::shared_ptr< Track > &t)
 
- Protected Member Functions inherited from EffectBase
virtual std::any BeginPreview (const EffectSettings &settings)
 Called when Preview() starts, to allow temporary effect state changes. More...
 
void Preview (EffectSettingsAccess &access, std::function< void()> updateUI, bool dryOnly) final
 Calculate temporary tracks of limited length with effect applied and play. More...
 
virtual bool CheckWhetherSkipEffect (const EffectSettings &settings) const =0
 After Init(), tell whether Process() should be skipped. More...
 
virtual double CalcPreviewInputLength (const EffectSettings &settings, double previewLength) const =0
 
void SetLinearEffectFlag (bool linearEffectFlag)
 
void SetPreviewFullSelectionFlag (bool previewDurationFlag)
 
bool IsPreviewing () const
 
void IncludeNotSelectedPreviewTracks (bool includeNotSelected)
 
void ReplaceProcessedTracks (const bool bGoodResult)
 
const TrackListinputTracks () const
 
const AudacityProjectFindProject () const
 
- Protected Attributes inherited from EffectBase
BasicUI::ProgressDialogmProgress {}
 
double mProjectRate {}
 
WaveTrackFactorymFactory {}
 
std::shared_ptr< TrackListmOutputTracks
 
double mT0 {}
 
double mT1 {}
 
wxArrayString mPresetNames
 
unsigned mUIFlags { 0 }
 
- Static Protected Attributes inherited from EffectBase
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 36 of file NoiseRemoval.h.

Constructor & Destructor Documentation

◆ EffectNoiseRemoval()

EffectNoiseRemoval::EffectNoiseRemoval ( )

Definition at line 80 of file NoiseRemoval.cpp.

81{
82 mWindowSize = 2048;
83 mSpectrumSize = 1 + mWindowSize / 2;
84
85 gPrefs->Read(wxT("/Effects/NoiseRemoval/NoiseSensitivity"),
86 &mSensitivity, 0.0);
87 gPrefs->Read(wxT("/Effects/NoiseRemoval/NoiseGain"),
88 &mNoiseGain, -24.0);
89 gPrefs->Read(wxT("/Effects/NoiseRemoval/NoiseFreqSmoothing"),
90 &mFreqSmoothingHz, 150.0);
91 gPrefs->Read(wxT("/Effects/NoiseRemoval/NoiseAttackDecayTime"),
92 &mAttackDecayTime, 0.15);
93 gPrefs->Read(wxT("/Effects/NoiseRemoval/NoiseLeaveNoise"),
94 &mbLeaveNoise, false);
95// mbLeaveNoise = false;
96
97
98 mMinSignalTime = 0.05f;
99 mHasProfile = false;
100 mDoProfile = true;
101
103
104 Init();
105}
wxT("CloseDown"))
FileConfig * gPrefs
Definition: Prefs.cpp:70
void reinit(Integral count, bool initialize=false)
Definition: MemoryX.h:57
bool Init() override

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

Here is the call graph for this function:

◆ ~EffectNoiseRemoval()

EffectNoiseRemoval::~EffectNoiseRemoval ( )
virtual

Definition at line 107 of file NoiseRemoval.cpp.

108{
109}

Member Function Documentation

◆ ApplyFreqSmoothing()

void EffectNoiseRemoval::ApplyFreqSmoothing ( float *  spec)
private

Definition at line 256 of file NoiseRemoval.cpp.

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

References mFreqSmoothingBins, and mSpectrumSize.

Referenced by End(), and RemoveNoise().

Here is the caller graph for this function:

◆ CheckWhetherSkipEffect()

bool EffectNoiseRemoval::CheckWhetherSkipEffect ( const EffectSettings settings) const
overridevirtual

After Init(), tell whether Process() should be skipped.

Implements EffectBase.

Definition at line 148 of file NoiseRemoval.cpp.

149{
150 return (mLevel == 0);
151}

References mLevel.

◆ End()

void EffectNoiseRemoval::End ( )
override

Definition at line 317 of file NoiseRemoval.cpp.

318{
319 hFFT.reset();
320
321 if (mDoProfile) {
323 }
324
325 mSpectrums.reset();
326 mGains.reset();
327 mRealFFTs.reset();
328 mImagFFTs.reset();
329
330 mFFTBuffer.reset();
331 mInWaveBuffer.reset();
332 mWindow.reset();
333 mOutOverlapBuffer.reset();
334
335 mOutputTrack.reset();
336}
ArraysOf< float > mImagFFTs
Definition: NoiseRemoval.h:124
std::shared_ptr< WaveTrack > mOutputTrack
Definition: NoiseRemoval.h:103
ArraysOf< float > mRealFFTs
Definition: NoiseRemoval.h:123
void ApplyFreqSmoothing(float *spec)
ArraysOf< float > mSpectrums
Definition: NoiseRemoval.h:121
ArraysOf< float > mGains
Definition: NoiseRemoval.h:122

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

385{
386 for(size_t i = 0; i < mWindowSize; i++)
388 RealFFTf(mFFTBuffer.get(), hFFT.get());
389 for(size_t i = 1; i + 1 < mSpectrumSize; i++) {
390 mRealFFTs[0][i] = mFFTBuffer[hFFT->BitReversed[i] ];
391 mImagFFTs[0][i] = mFFTBuffer[hFFT->BitReversed[i]+1];
392 mSpectrums[0][i] = mRealFFTs[0][i]*mRealFFTs[0][i] + mImagFFTs[0][i]*mImagFFTs[0][i];
394 }
395 // DC and Fs/2 bins need to be handled specially
396 mSpectrums[0][0] = mFFTBuffer[0]*mFFTBuffer[0];
400}
void RealFFTf(fft_type *buffer, const FFTParam *h)
Definition: RealFFTf.cpp:161

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

423{
424 // Keep flushing empty input buffers through the history
425 // windows until we've output exactly as many samples as
426 // were input.
427 // Well, not exactly, but not more than mWindowSize/2 extra samples at the end.
428 // We'll DELETE them later in ProcessOne.
429
430 Floats empty{ mWindowSize / 2 };
431 for(size_t i = 0; i < mWindowSize / 2; i++)
432 empty[i] = 0.0;
433
435 ProcessSamples(mWindowSize / 2, empty.get());
436 }
437}
void ProcessSamples(size_t len, float *buffer)
sampleCount mOutSampleCount
Definition: NoiseRemoval.h:105
sampleCount mInSampleCount
Definition: NoiseRemoval.h:104

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 ( )
override

Definition at line 118 of file NoiseRemoval.cpp.

119{
120 return XO("Removes constant background noise such as fans, tape noise, or hums");
121}
XO("Cut/Copy/Paste")

References XO().

Here is the call graph for this function:

◆ GetProfile()

void EffectNoiseRemoval::GetProfile ( )
private

Definition at line 439 of file NoiseRemoval.cpp.

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

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 ( )
override

Definition at line 113 of file NoiseRemoval.cpp.

114{
115 return Symbol;
116}
static const ComponentInterfaceSymbol Symbol
Definition: NoiseRemoval.h:39

References Symbol.

◆ GetType()

EffectType EffectNoiseRemoval::GetType ( ) const
overridevirtual

Type determines how it behaves.

Implements EffectDefinitionInterface.

Definition at line 125 of file NoiseRemoval.cpp.

126{
127 return EffectTypeProcess;
128}
@ EffectTypeProcess

References EffectTypeProcess.

◆ Init()

bool EffectNoiseRemoval::Init ( )
overridevirtual

Default implementation does nothing, returns true

Reimplemented from StatefulEffectBase.

Definition at line 138 of file NoiseRemoval.cpp.

139{
140 mLevel = gPrefs->Read(wxT("/Effects/NoiseRemoval/Noise_Level"), 3L);
141 if ((mLevel < 0) || (mLevel > MAX_NOISE_LEVEL)) { // corrupted Prefs?
142 mLevel = 0; //Off-skip
143 gPrefs->Write(wxT("/Effects/NoiseRemoval/Noise_Level"), mLevel);
144 }
145 return gPrefs->Flush();
146}
#define MAX_NOISE_LEVEL
virtual bool Flush(bool bCurrentOnly=false) wxOVERRIDE
Definition: FileConfig.cpp:143

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

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

276{
283 // Applies to power, divide by 10:
284 mSensitivityFactor = pow(10.0, mSensitivity/10.0);
286 (int)(mMinSignalTime * mSampleRate / (mWindowSize / 2));
287 if( mMinSignalBlocks < 1 )
290
293
298
299 // Initialize the FFT
301
306
307 // Create a Hann window function
308 for(size_t i=0; i<mWindowSize; i++)
309 mWindow[i] = 0.5 - 0.5 * cos((2.0*M_PI*i) / mWindowSize);
310
311 if (mDoProfile) {
312 for (size_t i = 0; i < mSpectrumSize; i++)
313 mNoiseThreshold[i] = float(0);
314 }
315}
#define M_PI
Definition: Distortion.cpp:30
#define DB_TO_LINEAR(x)
Definition: MemoryX.h:560
HFFT GetFFT(size_t fftlen)
Definition: RealFFTf.cpp:104
void reinit(Integral count)
Definition: MemoryX.h:109
double mProjectRate
Definition: EffectBase.h:105

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, EffectBase::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 ( EffectInstance instance,
EffectSettings settings 
)
overridevirtual

Implements StatefulEffectBase.

Definition at line 218 of file NoiseRemoval.cpp.

219{
220 Initialize();
221
222 // This same code will both remove noise and profile it,
223 // depending on 'mDoProfile'
224 this->CopyInputTracks(); // Set up mOutputTracks.
225 bool bGoodResult = true;
226
227 int count = 0;
228 for( auto track : mOutputTracks->Selected< WaveTrack >() ) {
229 double trackStart = track->GetStartTime();
230 double trackEnd = track->GetEndTime();
231 double t0 = mT0 < trackStart? trackStart: mT0;
232 double t1 = mT1 > trackEnd? trackEnd: mT1;
233
234 if (t1 > t0) {
235 auto start = track->TimeToLongSamples(t0);
236 auto end = track->TimeToLongSamples(t1);
237 auto len = end - start;
238
239 if (!ProcessOne(count, track, start, len)) {
240 bGoodResult = false;
241 break;
242 }
243 }
244 count++;
245 }
246
247 if (bGoodResult && mDoProfile) {
248 mHasProfile = true;
249 mDoProfile = false;
250 }
251
252 this->ReplaceProcessedTracks(bGoodResult);
253 return bGoodResult;
254}
double mT1
Definition: EffectBase.h:113
std::shared_ptr< TrackList > mOutputTracks
Definition: EffectBase.h:111
double mT0
Definition: EffectBase.h:112
void ReplaceProcessedTracks(const bool bGoodResult)
Definition: EffectBase.cpp:232
void CopyInputTracks(bool allSyncLockSelected=false)
Definition: Effect.cpp:396
bool ProcessOne(int count, WaveTrack *track, sampleCount start, sampleCount len)
A Track that contains audio waveform data.
Definition: WaveTrack.h:51
auto end(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
Definition: PackedArray.h:159

References Effect::CopyInputTracks(), PackedArray::end(), Initialize(), mDoProfile, mHasProfile, EffectBase::mOutputTracks, EffectBase::mT0, EffectBase::mT1, ProcessOne(), and EffectBase::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 537 of file NoiseRemoval.cpp.

539{
540 if (track == NULL)
541 return false;
542
544
545 if (!mDoProfile)
546 mOutputTrack = track->EmptyCopy();
547
548 auto bufferSize = track->GetMaxBlockSize();
549 Floats buffer{ bufferSize };
550
551 bool bLoopSuccess = true;
552 auto samplePos = start;
553 while (samplePos < start + len) {
554 //Get a blockSize of samples (smaller than the size of the buffer)
555 //Adjust the block size if it is the final block in the track
556 const auto blockSize = limitSampleBufferSize(
557 track->GetBestBlockSize(samplePos),
558 start + len - samplePos
559 );
560
561 //Get the samples from the track and put them in the buffer
562 track->Get((samplePtr)buffer.get(), floatSample, samplePos, blockSize);
563
564 mInSampleCount += blockSize;
565 ProcessSamples(blockSize, buffer.get());
566
567 samplePos += blockSize;
568
569 // Update the Progress meter
570 if (TrackProgress(count, (samplePos - start).as_double() / len.as_double())) {
571 bLoopSuccess = false;
572 break;
573 }
574 }
575
576 FinishTrack();
577
578 if (!mDoProfile) {
579 // Flush the output WaveTrack (since it's buffered)
580 mOutputTrack->Flush();
581
582 // Take the output track and insert it in place of the original
583 // sample data (as operated on -- this may not match mT0/mT1)
584 if (bLoopSuccess) {
585 double t0 = mOutputTrack->LongSamplesToTime(start);
586 double tLen = mOutputTrack->LongSamplesToTime(len);
587 // Filtering effects always end up with more data than they started with. Delete this 'tail'.
588 mOutputTrack->HandleClear(tLen, mOutputTrack->GetEndTime(), false, false);
589 track->ClearAndPaste(t0, t0 + tLen, mOutputTrack.get(), true, false);
590 }
591 }
592
593 return bLoopSuccess;
594}
size_t limitSampleBufferSize(size_t bufferSize, sampleCount limit)
Definition: SampleCount.cpp:22
char * samplePtr
Definition: SampleFormat.h:55
bool TrackProgress(int whichTrack, double frac, const TranslatableString &={}) const
Definition: Effect.cpp:346
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:1919
size_t GetMaxBlockSize() const override
This returns a nonnegative number of samples meant to size a memory buffer.
Definition: WaveTrack.cpp:1611
size_t GetBestBlockSize(sampleCount t) const override
This returns a nonnegative number of samples meant to size a memory buffer.
Definition: WaveTrack.cpp:1593
void ClearAndPaste(double t0, double t1, const Track *src, bool preserve=true, bool merge=true, const TimeWarper *effectWarper=NULL)
Definition: WaveTrack.cpp:710
Holder EmptyCopy(const SampleBlockFactoryPtr &pFactory={}, bool keepLink=true) const
Definition: WaveTrack.cpp:574
double as_double() const
Definition: SampleCount.h:46

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

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

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

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

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

414{
415 // Remember the last window so we can reuse it
420}
void Rotate(ArraysOf< float > &arrays, size_t historyLen)

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 ( EffectPlugin plugin,
wxWindow &  parent,
const EffectDialogFactory factory,
std::shared_ptr< EffectInstance > &  pInstance,
EffectSettingsAccess access,
bool  forceModal = false 
)
overridevirtual

An override still here for historical reasons, ignoring the factory and the access

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 EffectUIServices.

Definition at line 159 of file NoiseRemoval.cpp.

163{
164 // Assign the out parameter
165 pInstance = MakeInstance();
166 if (pInstance && !pInstance->Init())
167 pInstance.reset();
168
169 // to do: use forceModal correctly
170 NoiseRemovalDialog dlog(this, access, &parent);
171 dlog.mSensitivity = mSensitivity;
172 dlog.mGain = -mNoiseGain;
173 dlog.mFreq = mFreqSmoothingHz;
174 dlog.mTime = mAttackDecayTime;
175 dlog.mbLeaveNoise = mbLeaveNoise;
176 dlog.mKeepSignal->SetValue(!mbLeaveNoise);
177 dlog.mKeepNoise->SetValue(mbLeaveNoise);
178
179 // We may want to twiddle the levels if we are setting
180 // from a macro editing dialog
181 bool bAllowTwiddleSettings = forceModal;
182
183 if (mHasProfile || bAllowTwiddleSettings) {
184 dlog.m_pButton_Preview->Enable(GetNumWaveTracks() != 0);
185 dlog.m_pButton_RemoveNoise->SetDefault();
186 } else {
187 dlog.m_pButton_Preview->Enable(false);
188 dlog.m_pButton_RemoveNoise->Enable(false);
189 }
190
191 dlog.TransferDataToWindow();
192 dlog.mKeepNoise->SetValue(dlog.mbLeaveNoise);
193 dlog.CentreOnParent();
194 dlog.ShowModal();
195
196 const auto returnCode = dlog.GetReturnCode();
197 if (!returnCode)
198 return 0;
199
200 mSensitivity = dlog.mSensitivity;
201 mNoiseGain = -dlog.mGain;
202 mFreqSmoothingHz = dlog.mFreq;
203 mAttackDecayTime = dlog.mTime;
204 mbLeaveNoise = dlog.mbLeaveNoise;
205
206 gPrefs->Write(wxT("/Effects/NoiseRemoval/NoiseSensitivity"), mSensitivity);
207 gPrefs->Write(wxT("/Effects/NoiseRemoval/NoiseGain"), mNoiseGain);
208 gPrefs->Write(wxT("/Effects/NoiseRemoval/NoiseFreqSmoothing"), mFreqSmoothingHz);
209 gPrefs->Write(wxT("/Effects/NoiseRemoval/NoiseAttackDecayTime"), mAttackDecayTime);
210 gPrefs->Write(wxT("/Effects/NoiseRemoval/NoiseLeaveNoise"), mbLeaveNoise);
211
212 mDoProfile = (dlog.GetReturnCode() == 1);
213 if (!gPrefs->Flush())
214 return 0;
215 return returnCode;
216}
int GetNumWaveTracks() const
Definition: Effect.h:140
Dialog used with EffectNoiseRemoval.
Definition: NoiseRemoval.h:138
std::shared_ptr< EffectInstance > MakeInstance() const override
Make an object maintaining short-term state of an Effect.

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

Here is the call graph for this function:

◆ StartNewTrack()

void EffectNoiseRemoval::StartNewTrack ( )
private

Definition at line 338 of file NoiseRemoval.cpp.

339{
340 for(size_t i = 0; i < mHistoryLen; i++) {
341 for(size_t j = 0; j < mSpectrumSize; j++) {
342 mSpectrums[i][j] = 0;
344 mRealFFTs[i][j] = 0.0;
345 mImagFFTs[i][j] = 0.0;
346 }
347 }
348
349 for(size_t j = 0; j < mWindowSize; j++)
350 mOutOverlapBuffer[j] = 0.0;
351
352 mInputPos = 0;
353 mInSampleCount = 0;
354 mOutSampleCount = -(int)((mWindowSize / 2) * (mHistoryLen - 1));
355}

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 ( ) const
overridevirtual

Whether the effect has any automatable controls.

Implements EffectDefinitionInterface.

Definition at line 130 of file NoiseRemoval.cpp.

131{
132 return false;
133}

Friends And Related Function Documentation

◆ NoiseRemovalDialog

friend class NoiseRemovalDialog
friend

Definition at line 126 of file NoiseRemoval.h.

Member Data Documentation

◆ hFFT

HFFT EffectNoiseRemoval::hFFT
private

Definition at line 108 of file NoiseRemoval.h.

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

◆ mAttackDecayBlocks

int EffectNoiseRemoval::mAttackDecayBlocks
private

Definition at line 113 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 109 of file NoiseRemoval.h.

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

◆ mFreqSmoothingBins

int EffectNoiseRemoval::mFreqSmoothingBins
private

Definition at line 112 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 68 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 106 of file NoiseRemoval.h.

Referenced by ProcessSamples(), and StartNewTrack().

◆ mInSampleCount

sampleCount EffectNoiseRemoval::mInSampleCount
private

Definition at line 104 of file NoiseRemoval.h.

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

◆ mInWaveBuffer

Floats EffectNoiseRemoval::mInWaveBuffer
private

Definition at line 119 of file NoiseRemoval.h.

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

◆ mLevel

int EffectNoiseRemoval::mLevel
private

Definition at line 69 of file NoiseRemoval.h.

Referenced by CheckWhetherSkipEffect(), and Init().

◆ mMinSignalBlocks

size_t EffectNoiseRemoval::mMinSignalBlocks
private

Definition at line 117 of file NoiseRemoval.h.

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

◆ mMinSignalTime

float EffectNoiseRemoval::mMinSignalTime
private

Definition at line 75 of file NoiseRemoval.h.

Referenced by EffectNoiseRemoval(), and Initialize().

◆ mNoiseAttenFactor

float EffectNoiseRemoval::mNoiseAttenFactor
private

Definition at line 115 of file NoiseRemoval.h.

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

◆ mNoiseGain

double EffectNoiseRemoval::mNoiseGain
private

◆ mNoiseThreshold

Floats EffectNoiseRemoval::mNoiseThreshold
private

Definition at line 79 of file NoiseRemoval.h.

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

◆ mOneBlockAttackDecay

float EffectNoiseRemoval::mOneBlockAttackDecay
private

Definition at line 114 of file NoiseRemoval.h.

Referenced by Initialize(), and RemoveNoise().

◆ mOutOverlapBuffer

Floats EffectNoiseRemoval::mOutOverlapBuffer
private

Definition at line 120 of file NoiseRemoval.h.

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

◆ mOutputTrack

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

Definition at line 103 of file NoiseRemoval.h.

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

◆ mOutSampleCount

sampleCount EffectNoiseRemoval::mOutSampleCount
private

Definition at line 105 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 72 of file NoiseRemoval.h.

Referenced by Initialize().

◆ mSensitivity

double EffectNoiseRemoval::mSensitivity
private

◆ mSensitivityFactor

float EffectNoiseRemoval::mSensitivityFactor
private

Definition at line 116 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 110 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 39 of file NoiseRemoval.h.

Referenced by GetSymbol().


The documentation for this class was generated from the following files: