AnalogTapeModel

Physical modelling signal processing for analog tape recording
Log | Files | Refs | Submodules | README | LICENSE

commit 14c63c416367535e63a70d24a0adca23a712b4f8
parent f382931d34fddb5a8d28c50e842f9343f0b2d42b
Author: jatinchowdhury18 <jatinchowdhury18@gmail.com>
Date:   Tue, 18 Aug 2020 10:36:10 -0700

Adjustments to Newton-Raphson solver (#72)

Co-authored-by: jatinchowdhury18 <jatinchowdhury18@users.noreply.github.com>
Diffstat:
MCHANGELOG.md | 2+-
MPlugin/Bench/Source/Main.cpp | 2+-
MPlugin/Source/GUI/Assets/gui.xml | 2+-
MPlugin/Source/Processors/Hysteresis/HysteresisProcessing.cpp | 16+++++-----------
MPlugin/Source/Processors/Hysteresis/HysteresisProcessing.h | 4++--
MPlugin/Source/Processors/Hysteresis/HysteresisProcessor.cpp | 2+-
6 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md @@ -5,7 +5,7 @@ this file. ## [UNRELEASED] - Updated delay lines in wow/flutter processing to use 3-point Lagrange interpolation. -- Improved Newton-Raphson solver performance. +- Change Newton-Raphson solver to use 4 or 8 iterations, in unrolled loop. - Improved loss filter sliders. - Fixed tooltip name sometimes not appearing. - Fixed save/load bug for VST3 in Ableton. diff --git a/Plugin/Bench/Source/Main.cpp b/Plugin/Bench/Source/Main.cpp @@ -44,7 +44,7 @@ int main (int argc, char* argv[]) param->setValue (3.0f / 4.0f); // 8x if (param->getName (10) == "Mode") - param->setValue (3.0f / 5.0f); // NR5 + param->setValue (3.0f / 5.0f); // NR4 } // process audio diff --git a/Plugin/Source/GUI/Assets/gui.xml b/Plugin/Source/GUI/Assets/gui.xml @@ -128,7 +128,7 @@ <ComboBox lookAndFeel="ComboBoxLNF" padding="0" border="0" background-color="00000000" name="Hysteresis Mode" caption="Hysteresis Mode" caption-size="0" combo-text="FFEAA92C" caption-color="FFFFFFFF" max-height="100" - margin="" parameter="mode" combo-background="00000000" tooltip="Selects the mode to use for hysteresis processing. Choose between 2nd/4th order Runge-Kutta method, 5 or 10 Newton-Raphson iterations, or revert to version 1.0."/> + margin="" parameter="mode" combo-background="00000000" tooltip="Selects the mode to use for hysteresis processing. Choose between 2nd/4th order Runge-Kutta method, 4 or 8 Newton-Raphson iterations, or revert to version 1.0."/> <presets margin="5" padding="0" background-color="00000000" border-color="595C6B" radius="" border="" lookAndFeel="ComboBoxLNF" tooltip="Selects a preset for the plugin." flex-grow="1.8" max-height="100"/> diff --git a/Plugin/Source/Processors/Hysteresis/HysteresisProcessing.cpp b/Plugin/Source/Processors/Hysteresis/HysteresisProcessing.cpp @@ -72,12 +72,12 @@ void HysteresisProcessing::setSolver (SolverType solverType) solver = &HysteresisProcessing::RK4; return; - case SolverType::NR5: - numIter = 5; + case SolverType::NR4: + numIter = 4; return; - case SolverType::NR10: - numIter = 10; + case SolverType::NR8: + numIter = 8; return; default: // RK2 @@ -170,7 +170,7 @@ inline double HysteresisProcessing::NR (double H, double H_d) noexcept const double last_dMdt = hysteresisFunc (M_n1, H_n1, H_d_n1); double dMdt, dMdtPrime, deltaNR; - for (int n = 0; n < numIter; n += 5) + for (int n = 0; n < numIter; n += 4) { // loop #1 dMdt = hysteresisFunc (M, H, H_d); @@ -195,12 +195,6 @@ inline double HysteresisProcessing::NR (double H, double H_d) noexcept dMdtPrime = hysteresisFuncPrime (H_d, dMdt); deltaNR = (M - M_n1 - Talpha * (dMdt + last_dMdt)) / (1.0 - Talpha * dMdtPrime); M -= deltaNR; - - // loop #5 - dMdt = hysteresisFunc (M, H, H_d); - dMdtPrime = hysteresisFuncPrime (H_d, dMdt); - deltaNR = (M - M_n1 - Talpha * (dMdt + last_dMdt)) / (1.0 - Talpha * dMdtPrime); - M -= deltaNR; } return M; diff --git a/Plugin/Source/Processors/Hysteresis/HysteresisProcessing.h b/Plugin/Source/Processors/Hysteresis/HysteresisProcessing.h @@ -7,8 +7,8 @@ enum SolverType { RK2 = 0, RK4, - NR5, - NR10, + NR4, + NR8, }; /* diff --git a/Plugin/Source/Processors/Hysteresis/HysteresisProcessor.cpp b/Plugin/Source/Processors/Hysteresis/HysteresisProcessor.cpp @@ -32,7 +32,7 @@ void HysteresisProcessor::createParameterLayout (std::vector<std::unique_ptr<Ran params.push_back (std::make_unique<AudioParameterFloat> ("sat", "Saturation", 0.0f, 1.0f, 0.5f)); params.push_back (std::make_unique<AudioParameterFloat> ("width", "Bias", 0.0f, 1.0f, 0.5f)); - params.push_back (std::make_unique<AudioParameterChoice> ("mode", "Mode", StringArray ({"RK2", "RK4", "NR5", "NR10", "V1"}), 0)); + params.push_back (std::make_unique<AudioParameterChoice> ("mode", "Mode", StringArray ({"RK2", "RK4", "NR4", "NR8", "V1"}), 0)); params.push_back (std::make_unique<AudioParameterChoice> ("os", "Oversampling", StringArray ({"1x", "2x", "4x", "8x", "16x"}), 1)); }