parallel_wet = 1 - series_wet; hard_gain = 10; %SERIES DISTORTIONS %bit reduction bit_depth = 2; bit_out = bitCrusher(x, bit_depth); %full-wave rectification series_out = fullWaveRectification(bit_out); %PARALLEL DISTORTIONS parallel_out = clipper(hard_gain * x, "hard", 0.2, 0.2, 1); %OUTPUT y = level * (series_wet * series_out + parallel_wet * parallel_out);
The variables in the code that have to be changed manually in the MATLAB script are made user controllable via a JUCE plugin GUI in C++, these include:Β§ Β§ Β§ Β§ Β§ Β§ Β§ Β§
level series_wet/parallel_wet hard_gain bit_depth alpha upperClipLevel lowerClipLevel type
For a more detailed explanation of the transition made from hard coded values to user controllable parameters see below.
JUCE PLUGIN User controllable parameters and the distortion values they modify:Clipping Button Γ clipButton (Allows the user to switch between soft arctangent clipping and hard clipping) The button itself is implemented as type juce::TextButton. The virtual function void buttonClicked(juce::Button *button) of the inherited juce::Button::Listener class is overridden with a condition that checks whether the pointer passed into the function holds the address of the clipButton text button. If this condition is met another if statement checks whether the current value of the scoped enumeration clipState is currently equal to hard or soft. if (button == &clipButton) { if (clipState == ClipState::hard) { { clipButton.onClick = [this]() { soft();
}
};
}else if (clipState == ClipState::soft) { clipButton.onClick = [this]() { hard(); }; }