51#include "../SpectrumTransformer.h"
55#include "../widgets/valnum.h"
61#if defined(__WXMSW__) && !defined(__CYGWIN__)
63#define finite(x) _finite(x)
68#include <wx/radiobut.h>
70#include <wx/valtext.h>
71#include <wx/textctrl.h>
75#undef EXPERIMENTAL_SPECTRAL_EDITING
108 {
XO(
"Second greatest") },
135 {
Verbatim(
"none, Hann (2.0.6 behavior)"), 2 },
139 {
Verbatim(
"Hann, Hann (default)"), 4 },
170 Statistics(
size_t spectrumSize,
double rate,
int windowTypes)
176 ,
mSums( spectrumSize )
178#ifdef OLD_METHOD_AVAILABLE
179 , mNoiseThreshold( spectrumSize )
194#ifdef OLD_METHOD_AVAILABLE
213 wxWindow &parent,
bool bHasProfile,
bool bAllowTwiddleSettings);
265#ifdef EXPERIMENTAL_SPECTRAL_EDITING
266 ,
double f0,
double f1
274 : Window{ windowSize }
276 ,
mGains(windowSize / 2 + 1)
288 std::unique_ptr<Window>
NewWindow(
size_t windowSize)
override;
296 inline bool Classify(
unsigned nWindows,
int band);
349 wxWindow *parent,
bool bHasProfile,
350 bool bAllowTwiddleSettings);
362#ifdef ADVANCED_SETTINGS
363 void EnableDisableSensitivityControls();
369#ifdef ADVANCED_SETTINGS
370 void OnMethodChoice(wxCommandEvent &);
372 void OnPreview(wxCommandEvent &event)
override;
374 void OnCancel( wxCommandEvent &event );
375 void OnHelp( wxCommandEvent &event );
377 void OnText(wxCommandEvent &event);
378 void OnSlider(wxCommandEvent &event);
394 wxRadioButton *mKeepNoise;
401 DECLARE_EVENT_TABLE()
405{
XO(
"Noise Reduction") };
427 return XO(
"Removes background noise such as fans, tape noise, or hums");
457 return mSettings->PromptUser(
this, access, parent,
463 bool bHasProfile,
bool bAllowTwiddleSettings)
466 this, &parent, bHasProfile, bAllowTwiddleSettings);
468 dlog.CentreOnParent();
471 const auto returnCode = dlog.GetReturnCode();
484 template <
typename StructureType,
typename FieldType>
493 template <
typename StructureType,
typename FieldType>
495 StructureType *structure,
const wxString &prefix,
498 for (
size_t ii = 0; ii < numFields; ++ii) {
505 template <
typename StructureType,
typename FieldType>
507 const StructureType *structure,
const wxString &prefix,
510 for (
size_t ii = 0; ii < numFields; ++ii) {
519 static const double DEFAULT_OLD_SENSITIVITY = 0.0;
521 static const PrefsTableEntry<Settings, double> doubleTable[] = {
531 static auto doubleTableSize =
sizeof(doubleTable) /
sizeof(doubleTable[0]);
533 static const PrefsTableEntry<Settings, int> intTable[] = {
542 static auto intTableSize =
sizeof(intTable) /
sizeof(intTable[0]);
544 static const wxString prefix(
wxT(
"/Effects/NoiseReduction/"));
547 readPrefs(
this, prefix, doubleTable, doubleTableSize);
548 readPrefs(
this, prefix, intTable, intTableSize);
551#if !(defined(RESIDUE_CHOICE) || defined (ISOLATE_CHOICE))
553#elif !(defined(RESIDUE_CHOICE))
556#elif !(defined(ISOLATE_CHOICE))
561#ifndef ADVANCED_SETTINGS
567 mOldSensitivity = DEFAULT_OLD_SENSITIVITY;
570#ifndef OLD_METHOD_AVAILABLE
578 writePrefs(
this, prefix, doubleTable, doubleTableSize);
579 writePrefs(
this, prefix, intTable, intTableSize);
588 XO(
"Steps per block are too few for the window types.") );
592 if (StepsPerWindow() > WindowSize()) {
594 XO(
"Steps per block cannot exceed the window size.") );
598 if (mMethod ==
DM_MEDIAN && StepsPerWindow() > 4) {
601"Median method is not implemented for more than four steps per window.") );
609 -> std::unique_ptr<Window>
611 return std::make_unique<MyWindow>(windowSize);
631 size_t spectrumSize = 1 +
mSettings->WindowSize() / 2;
633 (spectrumSize, track->GetRate(),
mSettings->mWindowTypes);
638 XO(
"You must specify the same window size for steps 1 and 2.") );
644 XO(
"Warning: window types are not the same as for profiling.") );
676 Worker worker{ inWindowType, outWindowType,
678#ifdef EXPERIMENTAL_SPECTRAL_EDITING
698 TrackList &tracks,
double inT0,
double inT1)
700 mProgressTrackCount = 0;
702 mProgressWindowCount = 0;
706 XO(
"All noise profile data must have the same sample rate.") );
710"The sample rate of the noise profile must match that of the sound to be processed.") );
714 double trackStart = track->GetStartTime();
715 double trackEnd = track->GetEndTime();
716 double t0 = std::max(trackStart, inT0);
717 double t1 =
std::min(trackEnd, inT1);
720 auto start = track->TimeToLongSamples(t0);
721 auto end = track->TimeToLongSamples(t1);
722 const auto len =
end - start;
724 const auto extra = (mStepsPerWindow - 1) * mStepSize;
734 Processor, track, mHistoryLen, start, len ))
737 ++mProgressTrackCount;
743 XO(
"Selected noise profile is too short."));
757 if (mFreqSmoothingBins == 0)
761 auto pScratch = mFreqSmoothingScratch.data();
762 std::fill(pScratch, pScratch + mSpectrumSize, 0.0f);
765 for (
size_t ii = 0; ii < mSpectrumSize; ++ii)
766 gains[ii] = log(gains[ii]);
769 for (
int ii = 0; ii < (int)mSpectrumSize; ++ii) {
770 const int j0 = std::max(0, ii - (
int)mFreqSmoothingBins);
771 const int j1 =
std::min(mSpectrumSize - 1, ii + mFreqSmoothingBins);
772 for(
int jj = j0; jj <= j1; ++jj) {
773 mFreqSmoothingScratch[ii] += gains[jj];
775 mFreqSmoothingScratch[ii] /= (j1 - j0 + 1);
778 for (
size_t ii = 0; ii < mSpectrumSize; ++ii)
779 gains[ii] = exp(mFreqSmoothingScratch[ii]);
786#ifdef EXPERIMENTAL_SPECTRAL_EDITING
787 ,
double f0,
double f1
799, mFreqSmoothingScratch( mSpectrumSize )
800, mFreqSmoothingBins{ size_t(
std::max(0.0,
settings.mFreqSmoothingBands)) }
802, mBinHigh{ mSpectrumSize }
804, mNoiseReductionChoice{
settings.mNoiseReductionChoice }
808, mNewSensitivity{
settings.mNewSensitivity * log(10.0) }
812#ifdef EXPERIMENTAL_SPECTRAL_EDITING
844#ifdef OLD_METHOD_AVAILABLE
859 for (
size_t ii = 0, nn = TotalQueueSize(); ii < nn; ++ii) {
862 std::fill(record.
mGains.begin(), record.
mGains.end(), mNoiseAttenFactor);
869 auto &worker =
static_cast<Worker &
>(transformer);
872 MyWindow &record = worker.NthWindow(0);
874 const double dc = record.mRealFFTs[0];
875 *pSpectrum++ = dc * dc;
876 float *pReal = &record.mRealFFTs[1], *pImag = &record.mImagFFTs[1];
877 for (
size_t nn = worker.mSpectrumSize - 2; nn--;) {
878 const double re = *pReal++, im = *pImag++;
879 *pSpectrum++ = re * re + im * im;
881 const double nyquist = record.mImagFFTs[0];
882 *pSpectrum = nyquist * nyquist;
885 if (worker.mDoProfile)
886 worker.GatherStatistics();
888 worker.ReduceNoise();
891 return !worker.mEffect.TrackProgress(worker.mProgressTrackCount,
893 ((++worker.mProgressWindowCount).as_double() * worker.mStepSize)
894 / worker.mLen.as_double()));
904 const auto denom = windows + multiplier;
905 for (
size_t ii = 0, nn =
mStatistics.mMeans.size(); ii < nn; ++ii) {
908 mean = (mean * multiplier + sum) / denom;
924 auto pPower = NthWindow(0).mSpectrums.data();
926 for (
size_t jj = 0; jj < mSpectrumSize; ++jj) {
927 *pSum++ += *pPower++;
931#ifdef OLD_METHOD_AVAILABLE
936 auto finish = mHistoryLen;
940 auto pPower = NthWindow(0).mSpectrums.data();
941 auto pThreshold =
mStatistics.mNoiseThreshold.data();
942 for (
size_t jj = 0; jj < mSpectrumSize; ++jj) {
943 float min = *pPower++;
944 for (
unsigned ii = 1; ii < finish; ++ii)
946 *pThreshold = std::max(*pThreshold,
min);
959#ifdef OLD_METHOD_AVAILABLE
962 float min = NthWindow(0).mSpectrums[band];
963 for (
unsigned ii = 1; ii < nWindows; ++ii)
986 else if (nWindows <= 5)
988 float greatest = 0.0, second = 0.0, third = 0.0;
989 for (
unsigned ii = 0; ii < nWindows; ++ii) {
990 const float power = NthWindow(ii).mSpectrums[band];
991 if (
power >= greatest)
992 third = second, second = greatest, greatest =
power;
993 else if (
power >= second)
994 third = second, second =
power;
995 else if (
power >= third)
998 return third <= mNewSensitivity *
mStatistics.mMeans[band];
1011 float greatest = 0.0, second = 0.0;
1012 for (
unsigned ii = 0; ii < nWindows; ++ii) {
1013 const float power = NthWindow(ii).mSpectrums[band];
1014 if (
power >= greatest)
1015 second = greatest, greatest =
power;
1016 else if (
power >= second)
1019 return second <= mNewSensitivity *
mStatistics.mMeans[band];
1029 auto historyLen = CurrentQueueSize();
1030 auto nWindows = std::min<unsigned>(mNWindowsToExamine, historyLen);
1037 float *pGain = &record.
mGains[0];
1038 std::fill(pGain, pGain + mSpectrumSize, mNoiseAttenFactor);
1043 if (nWindows > mCenter)
1045 auto pGain = NthWindow(mCenter).mGains.data();
1048 std::fill(pGain, pGain + mBinLow, 0.0f);
1049 std::fill(pGain + mBinHigh, pGain + mSpectrumSize, 0.0f);
1051 for (
size_t jj = mBinLow; jj < mBinHigh; ++jj) {
1052 const bool isNoise = Classify(nWindows, jj);
1053 *pGain++ = isNoise ? 1.0 : 0.0;
1058 std::fill(pGain, pGain + mBinLow, 1.0f);
1059 std::fill(pGain + mBinHigh, pGain + mSpectrumSize, 1.0f);
1061 for (
size_t jj = mBinLow; jj < mBinHigh; ++jj) {
1062 const bool isNoise = Classify(nWindows, jj);
1078 for (
size_t jj = 0; jj < mSpectrumSize; ++jj) {
1079 for (
unsigned ii = mCenter + 1; ii < historyLen; ++ii) {
1080 const float minimum =
1081 std::max(mNoiseAttenFactor,
1082 NthWindow(ii - 1).mGains[jj] * mOneBlockAttack);
1083 float &gain = NthWindow(ii).mGains[jj];
1097 auto pNextGain = NthWindow(mCenter - 1).mGains.data();
1098 auto pThisGain = NthWindow(mCenter).mGains.data();
1099 for (
auto nn = mSpectrumSize; nn--;) {
1101 std::max(*pNextGain,
1102 std::max(mNoiseAttenFactor,
1103 *pThisGain++ * mOneBlockRelease));
1110 if (QueueIsFull()) {
1111 auto &record = NthWindow(historyLen - 1);
1112 const auto last = mSpectrumSize - 1;
1117 ApplyFreqSmoothing(record.mGains);
1121 const float *pGain = &record.mGains[1];
1122 float *pReal = &record.mRealFFTs[1];
1123 float *pImag = &record.mImagFFTs[1];
1124 auto nn = mSpectrumSize - 2;
1129 const double gain = *pGain++ - 1.0;
1133 record.mRealFFTs[0] *= (record.mGains[0] - 1.0);
1135 record.mImagFFTs[0] *= (record.mGains[last] - 1.0);
1139 const double gain = *pGain++;
1143 record.mRealFFTs[0] *= record.mGains[0];
1145 record.mImagFFTs[0] *= record.mGains[last];
1154 FinishTrackStatistics();
1165#ifdef ISOLATE_CHOICE
1168#ifdef RESIDUE_CHOICE
1172#ifdef ADVANCED_SETTINGS
1183#ifdef ATTACK_AND_RELEASE
1184 ID_ATTACK_TIME_SLIDER,
1185 ID_ATTACK_TIME_TEXT,
1187 ID_RELEASE_TIME_SLIDER,
1188 ID_RELEASE_TIME_TEXT,
1196#ifdef ADVANCED_SETTINGS
1198 ID_OLD_SENSITIVITY_TEXT,
1200 END_OF_ADVANCED_SLIDERS,
1218 (double(sliderSetting) / sliderMax) * (valueMax - valueMin);
1223 return std::clamp<long>(
1224 0.5 + sliderMax * (value - valueMin) / (valueMax - valueMin),
1231 return wxString::Format(
format, (
int)(value));
1233 return wxString::Format(
format, value);
1238 wxTextCtrl *
const text =
S.Id(
id + 1)
1239 .Validator<FloatingPointValidator<double>>(
1240 formatAsInt ? 0 : 2,
1242 NumValidatorStyle::DEFAULT,
1245 .AddTextBox(textBoxCaption,
wxT(
""), 0);
1247 wxSlider *
const slider =
1250 .Style(wxSL_HORIZONTAL)
1251 .MinSize( { 150, -1 } )
1252 .AddSlider( {}, 0, sliderMax);
1267 :
field(f), valueMin(vMin), valueMax(vMax), sliderMax(sMax),
format(fmt), formatAsInt(fAsInt)
1268 , textBoxCaption(caption), sliderName(
name)
1276 0.0, 48.0, 48,
wxT(
"%d"),
true,
1277 XXO(
"&Noise reduction (dB):"),
XO(
"Noise reduction")),
1279 0.0, 24.0, 48,
wxT(
"%.2f"),
false,
1280 XXO(
"&Sensitivity:"),
XO(
"Sensitivity")),
1281#ifdef ATTACK_AND_RELEASE
1283 0, 1.0, 100,
wxT(
"%.2f"),
false,
1284 XXO(
"Attac&k time (secs):"),
XO(
"Attack time")),
1286 0, 1.0, 100,
wxT(
"%.2f"),
false,
1287 XXO(
"R&elease time (secs):"),
XO(
"Release time")),
1290 0, 12, 12,
wxT(
"%d"),
true,
1291 XXO(
"&Frequency smoothing (bands):"),
XO(
"Frequency smoothing")),
1293#ifdef ADVANCED_SETTINGS
1295 -20.0, 20.0, 4000,
wxT(
"%.2f"),
false,
1296 XXO(
"Sensiti&vity (dB):"),
XO(
"Old Sensitivity")),
1315#ifdef ISOLATE_CHOICE
1318#ifdef RESIDUE_CHOICE
1322#ifdef ADVANCED_SETTINGS
1323 EVT_CHOICE(ID_CHOICE_METHOD, EffectNoiseReduction::Dialog::OnMethodChoice)
1335#ifdef ATTACK_AND_RELEASE
1344#ifdef ADVANCED_SETTINGS
1353 wxWindow *parent,
bool bHasProfile,
bool bAllowTwiddleSettings)
1359 , mbHasProfile(bHasProfile)
1360 , mbAllowTwiddleSettings(bAllowTwiddleSettings)
1363#ifdef ISOLATE_CHOICE
1366#ifdef RESIDUE_CHOICE
1372 wxButton *
const pButtonPreview =
1374 wxButton *
const pButtonReduceNoise =
1375 (wxButton *)wxWindow::FindWindowById(wxID_OK,
this);
1377 if (mbHasProfile || mbAllowTwiddleSettings) {
1378 pButtonPreview->Enable(!mbAllowTwiddleSettings);
1379 pButtonReduceNoise->SetFocus();
1382 pButtonPreview->Enable(
false);
1383 pButtonReduceNoise->Enable(
false);
1398 static const int toDisable[] = {
1405#ifdef ATTACK_AND_RELEASE
1406 ID_ATTACK_TIME_SLIDER,
1407 ID_ATTACK_TIME_TEXT,
1409 ID_RELEASE_TIME_SLIDER,
1410 ID_RELEASE_TIME_TEXT,
1413 static const auto nToDisable =
sizeof(toDisable) /
sizeof(toDisable[0]);
1416#ifdef ISOLATE_CHOICE
1417 mKeepNoise->GetValue();
1421 for (
auto ii = nToDisable; ii--;)
1422 wxWindow::FindWindowById(toDisable[ii],
this)->Enable(!bIsolating);
1425#ifdef ADVANCED_SETTINGS
1426void EffectNoiseReduction::Dialog::EnableDisableSensitivityControls()
1428 wxChoice *
const pChoice =
1429 static_cast<wxChoice*
>(wxWindow::FindWindowById(ID_CHOICE_METHOD,
this));
1430 const bool bOldMethod =
1432 wxWindow::FindWindowById(ID_OLD_SENSITIVITY_SLIDER,
this)->Enable(bOldMethod);
1433 wxWindow::FindWindowById(ID_OLD_SENSITIVITY_TEXT,
this)->Enable(bOldMethod);
1454 if (mKeepSignal->GetValue())
1456#ifdef ISOLATE_CHOICE
1457 else if (mKeepNoise->GetValue())
1460#ifdef RESIDUE_CHOICE
1464 DisableControlsIfIsolating();
1467#ifdef ADVANCED_SETTINGS
1468void EffectNoiseReduction::Dialog::OnMethodChoice(wxCommandEvent &)
1470 EnableDisableSensitivityControls();
1481 *m_pSettings = mTempSettings;
1482 m_pSettings->mDoProfile =
false;
1484 m_pEffect->Preview(mAccess,
1510 S.StartStatic(
XO(
"Step 1"));
1512 S.AddVariableText(
XO(
1513"Select a few seconds of just noise so Audacity knows what to filter out,\nthen click Get Noise Profile:"));
1519 S.StartStatic(
XO(
"Step 2"));
1521 S.AddVariableText(
XO(
1522"Select all of the audio you want filtered, choose how much noise you want\nfiltered out, and then click 'OK' to reduce noise.\n"));
1524 S.StartMultiColumn(3, wxEXPAND);
1525 S.SetStretchyCol(2);
1539#ifdef ISOLATE_CHOICE
1543 wxALIGN_CENTER_HORIZONTAL);
1545 S.AddPrompt(
XXO(
"Noise:"));
1548 .AddRadioButton(
XXO(
"Re&duce"));
1549#ifdef ISOLATE_CHOICE
1551 .AddRadioButtonToGroup(
XXO(
"&Isolate"));
1553#ifdef RESIDUE_CHOICE
1556 .AddRadioButtonToGroup(
XXO(
"Resid&ue"));
1564#ifdef ADVANCED_SETTINGS
1565 S.StartStatic(
XO(
"Advanced Settings"));
1567 S.StartMultiColumn(2);
1569 S.TieChoice(
XXO(
"&Window types:"),
1570 mTempSettings.mWindowTypes,
1575 return windowTypeChoices;
1579 S.TieChoice(
XXO(
"Window si&ze:"),
1580 mTempSettings.mWindowSizeChoice,
1590 XO(
"2048 (default)") ,
1597 S.TieChoice(
XXO(
"S&teps per window:"),
1598 mTempSettings.mStepsPerWindowChoice,
1609 S.Id(ID_CHOICE_METHOD)
1610 .TieChoice(
XXO(
"Discrimination &method:"),
1611 mTempSettings.mMethod,
1615#ifndef OLD_METHOD_AVAILABLE
1618 for (
auto ii = 0; ii < nn; ++ii)
1620 return methodChoices;
1625 S.StartMultiColumn(3, wxEXPAND);
1626 S.SetStretchyCol(2);
1647 static_cast<wxSlider*
>(wxWindow::FindWindowById(
id,
this));
1649 static_cast<wxTextCtrl*
>(wxWindow::FindWindowById(
id + 1,
this));
1651 const double field = mTempSettings.*(info.field);
1652 text->SetValue(info.Text(
field));
1653 slider->SetValue(info.SliderSetting(
field));
1656 mKeepSignal->SetValue(mTempSettings.mNoiseReductionChoice ==
NRC_REDUCE_NOISE);
1657#ifdef ISOLATE_CHOICE
1660#ifdef RESIDUE_CHOICE
1665 DisableControlsIfIsolating();
1666#ifdef ADVANCED_SETTINGS
1667 EnableDisableSensitivityControls();
1675 if( !wxWindow::Validate() )
1681 wxCommandEvent dummy;
1682 OnNoiseReductionChoice(dummy);
1684 return mTempSettings.Validate(m_pEffect);
1689 int id =
event.GetId();
1693 static_cast<wxTextCtrl*
>(wxWindow::FindWindowById(
id,
this));
1695 static_cast<wxSlider*
>(wxWindow::FindWindowById(
id - 1,
this));
1696 double &
field = mTempSettings.*(info.field);
1698 text->GetValue().ToDouble(&
field);
1699 slider->SetValue(info.SliderSetting(
field));
1704 int id =
event.GetId();
1708 static_cast<wxSlider*
>(wxWindow::FindWindowById(
id,
this));
1710 static_cast<wxTextCtrl*
>(wxWindow::FindWindowById(
id + 1,
this));
1711 double &
field = mTempSettings.*(info.field);
1713 field = info.Value(slider->GetValue());
1714 text->SetValue(info.Text(
field));
EVT_BUTTON(wxID_NO, DependencyDialog::OnNo) EVT_BUTTON(wxID_YES
const TranslatableString name
#define ID_EFFECT_PREVIEW
std::function< DialogFactoryResults(wxWindow &parent, EffectPlugin &, EffectUIServices &, EffectSettingsAccess &) > EffectDialogFactory
Type of function that creates a dialog for an effect.
XXO("&Cut/Copy/Paste Toolbar")
ValueRestorer< T > valueRestorer(T &var)
inline functions provide convenient parameter type deduction
std::vector< float > FloatVector
@ ID_NEW_SENSITIVITY_SLIDER
@ ID_NEW_SENSITIVITY_TEXT
@ ID_RADIOBUTTON_KEEPSIGNAL
@ ID_RADIOBUTTON_KEEPNOISE
static ProjectFileIORegistry::AttributeWriterEntry entry
static Settings & settings()
TranslatableString Verbatim(wxString str)
Require calls to the one-argument constructor to go through this distinct global function name.
std::vector< TranslatableString > TranslatableStrings
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
std::shared_ptr< TrackList > mOutputTracks
void ReplaceProcessedTracks(const bool bGoodResult)
bool TransferDataToWindow() override
bool TransferDataFromWindow() override
void CopyInputTracks(bool allSyncLockSelected=false)
bool IsBatchProcessing() const override
Performs effect computation.
void SetSkipStateFlag(bool flag)
static EffectManager & Get()
Dialog used with EffectNoiseReduction.
const Settings & GetTempSettings() const
void OnNoiseReductionChoice(wxCommandEvent &event)
void DisableControlsIfIsolating()
void OnSlider(wxCommandEvent &event)
void OnHelp(wxCommandEvent &event)
bool TransferDataToWindow() override
EffectNoiseReduction::Settings mTempSettings
EffectSettingsAccess & mAccess
This dialog is modal, so mAccess will live long enough for it.
void PopulateOrExchange(ShuttleGui &S) override
void OnText(wxCommandEvent &event)
Dialog(EffectNoiseReduction *effect, EffectSettingsAccess &access, Settings *settings, wxWindow *parent, bool bHasProfile, bool bAllowTwiddleSettings)
wxRadioButton * mKeepSignal
void OnReduceNoise(wxCommandEvent &event)
void OnPreview(wxCommandEvent &event) override
EffectNoiseReduction * m_pEffect
bool mbAllowTwiddleSettings
void OnGetProfile(wxCommandEvent &event)
void OnCancel(wxCommandEvent &event)
EffectNoiseReduction::Settings * m_pSettings
bool TransferDataFromWindow() override
size_t WindowSize() const
double mFreqSmoothingBands
int PromptUser(EffectNoiseReduction *effect, EffectSettingsAccess &access, wxWindow &parent, bool bHasProfile, bool bAllowTwiddleSettings)
int mStepsPerWindowChoice
int mNoiseReductionChoice
unsigned StepsPerWindow() const
bool Validate(EffectNoiseReduction *effect) const
Statistics(size_t spectrumSize, double rate, int windowTypes)
Worker(eWindowFunctions inWindowType, eWindowFunctions outWindowType, EffectNoiseReduction &effect, const Settings &settings, Statistics &statistics)
unsigned mProgressTrackCount
EffectNoiseReduction::Settings Settings
MyWindow & NthWindow(int nn)
void FinishTrackStatistics()
bool Process(TrackList &tracks, double mT0, double mT1)
FloatVector mFreqSmoothingScratch
const size_t mFreqSmoothingBins
static bool Processor(SpectrumTransformer &transformer)
void ApplyFreqSmoothing(FloatVector &gains)
unsigned mNWindowsToExamine
EffectNoiseReduction & mEffect
bool DoStart() override
Called before any calls to ProcessWindow.
bool Classify(unsigned nWindows, int band)
bool DoFinish() override
Called after the last call to ProcessWindow().
EffectNoiseReduction::Statistics Statistics
sampleCount mProgressWindowCount
const int mNoiseReductionChoice
const double mNewSensitivity
float mOldSensitivityFactor
std::unique_ptr< Window > NewWindow(size_t windowSize) override
Allocates a window to place in the queue.
A two-pass effect to reduce background noise.
static const ComponentInterfaceSymbol Symbol
TranslatableString GetDescription() const override
ComponentInterfaceSymbol GetSymbol() const override
std::unique_ptr< Settings > mSettings
int ShowHostInterface(EffectPlugin &plugin, wxWindow &parent, const EffectDialogFactory &factory, std::shared_ptr< EffectInstance > &pInstance, EffectSettingsAccess &access, bool forceModal=false) override
bool Process(EffectInstance &instance, EffectSettings &settings) override
virtual ~EffectNoiseReduction()
EffectType GetType() const override
Type determines how it behaves.
std::unique_ptr< Statistics > mStatistics
Factory of instances of an effect.
static int DoMessageBox(const EffectPlugin &plugin, const TranslatableString &message, long style=DefaultMessageBoxStyle, const TranslatableString &titleStr={})
virtual bool Flush(bool bCurrentOnly=false) wxOVERRIDE
static void ShowHelp(wxWindow *parent, const FilePath &localFileName, const URLString &remoteURL, bool bModal=false, bool alwaysDefaultBrowser=false)
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
std::shared_ptr< EffectInstance > MakeInstance() const override
Make an object maintaining short-term state of an Effect.
virtual bool TransferDataFromWindow(EffectSettings &settings)
A flat linked list of tracks supporting Add, Remove, Clear, and Contains, serialization of the list o...
auto Selected() -> TrackIterRange< TrackType >
Holds a msgid for the translation catalog; may also bind format arguments.
A Track that contains audio waveform data.
Positions or offsets within audio files need a wide type.
auto end(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
void writePrefs(const StructureType *structure, const wxString &prefix, const PrefsTableEntry< StructureType, FieldType > *fields, size_t numFields)
void readPrefs(StructureType *structure, const wxString &prefix, const PrefsTableEntry< StructureType, FieldType > *fields, size_t numFields)
const ControlInfo * controlInfo()
BuiltinEffectsModule::Registration< EffectNoiseReduction > reg
@ DEFAULT_STEPS_PER_WINDOW_CHOICE
@ DEFAULT_WINDOW_SIZE_CHOICE
const struct anonymous_namespace{NoiseReduction.cpp}::DiscriminationMethodInfo discriminationMethodInfo[DM_N_METHODS]
@ WT_DEFAULT_WINDOW_TYPES
const float minSignalTime
const struct anonymous_namespace{NoiseReduction.cpp}::WindowTypesInfo windowTypesInfo[WT_N_WINDOW_TYPES]
constexpr fastfloat_really_inline int32_t power(int32_t q) noexcept
MyWindow(size_t windowSize)
Externalized state of a plug-in.
long SliderSetting(double value) const
wxString Text(double value) const
void CreateControls(int id, ShuttleGui &S) const
const TranslatableString textBoxCaption
doubleEffectNoiseReduction::Settings::* MemberPointer
ControlInfo(MemberPointer f, double vMin, double vMax, long sMax, const wxChar *fmt, bool fAsInt, const TranslatableString &caption, const TranslatableString &name)
double Value(long sliderSetting) const
const TranslatableString sliderName
const TranslatableString name
FieldTypeStructureType::* MemberPointer
const TranslatableString name