Stereo energy compensation
This commit is contained in:
parent
4782f1ff32
commit
2908a8b56f
10
chorus.h
10
chorus.h
@ -97,8 +97,14 @@ struct ChorusSTFX : public BaseEffect {
|
||||
std::array<Sample, 6> multiIn, multiOut;
|
||||
std::array<Sample, 6> delaySamples;
|
||||
|
||||
auto dry = block.smooth(mix, [](double m){return 1 - m*m;});
|
||||
auto wet = block.smooth(mix, [](double m){return m*(2 - m)/std::sqrt(Sample(6));});
|
||||
auto wetDryFn = [](double mix, double width, bool isWet){
|
||||
// Equal-power wet/dry fade
|
||||
double m = isWet ? std::sin(M_PI*mix/2) : std::cos(M_PI*mix/2);
|
||||
// Compensate for extra energy from stereo
|
||||
return m/std::sqrt(6*(1 + width*width/2));
|
||||
};
|
||||
auto dry = block.smooth(wetDryFn(mix.from(), stereo.from(), false), wetDryFn(mix.to(), stereo.to(), false));
|
||||
auto wet = block.smooth(wetDryFn(mix.from(), stereo.from(), true), wetDryFn(mix.to(), stereo.to(), true));
|
||||
bool notMono = (config.outputChannels > 1);
|
||||
auto width = block.smooth(stereo);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user