commit cc357a1dd6a3b686fd4eb77a0eb8a9c20e6d2b82 parent 5df254b530ea53662b48aae435dada1c526aa799 Author: jatinchowdhury18 <jatinchowdhury18@gmail.com> Date: Sat, 12 Sep 2020 23:29:11 -0700 Add chew variance parameter (#86) Co-authored-by: jatinchowdhury18 <jatinchowdhury18@users.noreply.github.com> Diffstat:
9 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/Plugin/Source/GUI/Assets/gui.xml b/Plugin/Source/GUI/Assets/gui.xml @@ -106,10 +106,12 @@ padding="0" margin="0" tooltip="Sets the variance of the tape degradation. Use lower values for uniform degradation, or higher values for variation across different sections of tape."/> </View> <View tab-caption="CHEW" padding="0" flex-direction="column" background-color="FF31323A"> - <Slider parameter="chew_depth" caption="Depth" max-height="150" class="Slider" + <Slider parameter="chew_depth" caption="Depth" padding="0" margin="0" class="Slider" name="Chew Depth" tooltip="Controls how intensely the tape has been chewed up."/> - <Slider caption="Frequency" parameter="chew_freq" max-height="150" class="Slider" + <Slider caption="Frequency" parameter="chew_freq" padding="0" margin="0" class="Slider" name="Chew Frequency" tooltip="Controls the amount of time in between chewed-up sections of tape."/> + <Slider caption="Variance" parameter="chew_var" padding="0" margin="0" class="Slider" + name="Chew Variance" tooltip="Controls the amount of variance in the chew frequency."/> </View> </View> <View display="tabbed" padding="0" background-color="FF31323A" lookAndFeel="MyLNF"> diff --git a/Plugin/Source/Presets/PresetConfigs/Default.xml b/Plugin/Source/Presets/PresetConfigs/Default.xml @@ -4,6 +4,7 @@ <Parameters> <PARAM id="chew_depth" value="0.0"/> <PARAM id="chew_freq" value="0.0"/> + <PARAM id="chew_var" value="0.0"/> <PARAM id="deg_amt" value="0.0"/> <PARAM id="deg_depth" value="0.0"/> <PARAM id="deg_var" value="0.0"/> diff --git a/Plugin/Source/Presets/PresetConfigs/LoFi.xml b/Plugin/Source/Presets/PresetConfigs/LoFi.xml @@ -4,6 +4,7 @@ <Parameters> <PARAM id="chew_depth" value="0.0"/> <PARAM id="chew_freq" value="0.0"/> + <PARAM id="chew_var" value="0.0"/> <PARAM id="deg_amt" value="0.0"/> <PARAM id="deg_depth" value="0.0"/> <PARAM id="deg_var" value="0.0"/> diff --git a/Plugin/Source/Presets/PresetConfigs/OldTape.xml b/Plugin/Source/Presets/PresetConfigs/OldTape.xml @@ -4,6 +4,7 @@ <Parameters> <PARAM id="chew_depth" value="0.0"/> <PARAM id="chew_freq" value="0.0"/> + <PARAM id="chew_var" value="0.0"/> <PARAM id="deg_amt" value="0.1499999910593033"/> <PARAM id="deg_depth" value="0.199999988079071"/> <PARAM id="deg_var" value="0.25"/> diff --git a/Plugin/Source/Presets/PresetConfigs/TC260.xml b/Plugin/Source/Presets/PresetConfigs/TC260.xml @@ -4,6 +4,7 @@ <Parameters> <PARAM id="chew_depth" value="0.0"/> <PARAM id="chew_freq" value="0.0"/> + <PARAM id="chew_var" value="0.0"/> <PARAM id="deg_amt" value="0.0"/> <PARAM id="deg_depth" value="0.0"/> <PARAM id="deg_var" value="0.0"/> diff --git a/Plugin/Source/Presets/PresetConfigs/Underbiased.xml b/Plugin/Source/Presets/PresetConfigs/Underbiased.xml @@ -4,6 +4,7 @@ <Parameters> <PARAM id="chew_depth" value="0.0"/> <PARAM id="chew_freq" value="0.0"/> + <PARAM id="chew_var" value="0.0"/> <PARAM id="deg_amt" value="0.0"/> <PARAM id="deg_depth" value="0.0"/> <PARAM id="deg_var" value="0.0"/> diff --git a/Plugin/Source/Presets/PresetConfigs/WoozyChorus.xml b/Plugin/Source/Presets/PresetConfigs/WoozyChorus.xml @@ -4,6 +4,7 @@ <Parameters> <PARAM id="chew_depth" value="0.25"/> <PARAM id="chew_freq" value="0.5999999642372131"/> + <PARAM id="chew_var" value="0.3"/> <PARAM id="deg_amt" value="0.0"/> <PARAM id="deg_depth" value="0.0"/> <PARAM id="deg_var" value="0.0"/> diff --git a/Plugin/Source/Processors/Chew/ChewProcessor.cpp b/Plugin/Source/Processors/Chew/ChewProcessor.cpp @@ -4,12 +4,14 @@ ChewProcessor::ChewProcessor (AudioProcessorValueTreeState& vts) { depth = vts.getRawParameterValue ("chew_depth"); freq = vts.getRawParameterValue ("chew_freq"); + var = vts.getRawParameterValue ("chew_var"); } void ChewProcessor::createParameterLayout (std::vector<std::unique_ptr<RangedAudioParameter>>& params) { - params.push_back (std::make_unique<AudioParameterFloat> ("chew_depth", "Depth", 0.0f, 1.0f, 0.0f)); - params.push_back (std::make_unique<AudioParameterFloat> ("chew_freq", "Freq", 0.0f, 1.0f, 0.0f)); + params.push_back (std::make_unique<AudioParameterFloat> ("chew_depth", "Depth", 0.0f, 1.0f, 0.0f)); + params.push_back (std::make_unique<AudioParameterFloat> ("chew_freq", "Freq", 0.0f, 1.0f, 0.0f)); + params.push_back (std::make_unique<AudioParameterFloat> ("chew_var", "Variance", 0.0f, 1.0f, 0.0f)); } void ChewProcessor::prepare (double sr) diff --git a/Plugin/Source/Processors/Chew/ChewProcessor.h b/Plugin/Source/Processors/Chew/ChewProcessor.h @@ -18,6 +18,7 @@ public: private: std::atomic<float>* depth = nullptr; std::atomic<float>* freq = nullptr; + std::atomic<float>* var = nullptr; float mix = 0.0f; float power = 0.0f; @@ -34,8 +35,9 @@ private: inline int getDryTime() { auto tScale = pow (*freq, 0.1f); - return random.nextInt (Range<int> ((int) ((1.0 - tScale) * sampleRate), - (int) ((2 - 1.99 * tScale) * sampleRate))); + auto varScale = pow (random.nextFloat() * 2.0f, var->load()); + return random.nextInt (Range<int> ((int) ((1.0 - tScale) * sampleRate * varScale), + (int) ((2 - 1.99 * tScale) * sampleRate * varScale))); } inline int getWetTime() @@ -43,9 +45,10 @@ private: auto tScale = pow (*freq, 0.1f); auto start = 0.2 + 0.8 * *depth; auto end = start - (0.001 + 0.01 * *depth); + auto varScale = pow (random.nextFloat() * 2.0f, var->load()); - return random.nextInt (Range<int> ((int) ((1.0 - tScale) * sampleRate), - (int) (((1.0 - tScale) + start - end * tScale) * sampleRate))); + return random.nextInt (Range<int> ((int) ((1.0 - tScale) * sampleRate * varScale), + (int) (((1.0 - tScale) + start - end * tScale) * sampleRate * varScale))); } JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ChewProcessor)