diff options
author | Chris Johnson <jinx6568@sover.net> | 2019-01-27 21:13:54 -0500 |
---|---|---|
committer | Chris Johnson <jinx6568@sover.net> | 2019-01-27 21:13:54 -0500 |
commit | 966f2d253cd2ee6ce140ad68095a20a9d2b63052 (patch) | |
tree | b0400d95bd06512531ade6ddf55190a58b6a5623 /plugins/WinVST/SingleEndedTriode | |
parent | 0887543349dbbec0721a1fc8b1c7deba9afefa8b (diff) | |
download | airwindows-lv2-port-966f2d253cd2ee6ce140ad68095a20a9d2b63052.tar.gz airwindows-lv2-port-966f2d253cd2ee6ce140ad68095a20a9d2b63052.tar.bz2 airwindows-lv2-port-966f2d253cd2ee6ce140ad68095a20a9d2b63052.zip |
Floating Point Dither For All
Diffstat (limited to 'plugins/WinVST/SingleEndedTriode')
-rwxr-xr-x | plugins/WinVST/SingleEndedTriode/.vs/VSTProject/v14/.suo | bin | 25600 -> 23040 bytes | |||
-rwxr-xr-x | plugins/WinVST/SingleEndedTriode/SingleEndedTriodeProc.cpp | 54 |
2 files changed, 18 insertions, 36 deletions
diff --git a/plugins/WinVST/SingleEndedTriode/.vs/VSTProject/v14/.suo b/plugins/WinVST/SingleEndedTriode/.vs/VSTProject/v14/.suo Binary files differindex 43b7f80..bb9d2da 100755 --- a/plugins/WinVST/SingleEndedTriode/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/SingleEndedTriode/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/SingleEndedTriode/SingleEndedTriodeProc.cpp b/plugins/WinVST/SingleEndedTriode/SingleEndedTriodeProc.cpp index 5781165..ef6694c 100755 --- a/plugins/WinVST/SingleEndedTriode/SingleEndedTriodeProc.cpp +++ b/plugins/WinVST/SingleEndedTriode/SingleEndedTriodeProc.cpp @@ -127,18 +127,14 @@ void SingleEndedTriode::processReplacing(float **inputs, float **outputs, VstInt inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 32-bit floating point - float fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -148,12 +144,6 @@ void SingleEndedTriode::processReplacing(float **inputs, float **outputs, VstInt *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } void SingleEndedTriode::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames) @@ -276,18 +266,16 @@ void SingleEndedTriode::processDoubleReplacing(double **inputs, double **outputs inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 64-bit floating point - double fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -297,10 +285,4 @@ void SingleEndedTriode::processDoubleReplacing(double **inputs, double **outputs *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. }
\ No newline at end of file |