airwindows dither in snex
-
Ive been trying to re-write this dither code from airwindows in snex
//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_MAX7.737125245533627e+25))*pow(2,expon+62);
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
//end 32 bit ditheris there a rand() function? like math.random or something.
-
ah, I see the SNEX awesomeness begins. Can't help you with the code unfortunately... anyway, I have to learn snex and dsp eventually.
-
The SNEX Math API is almost identical to the Javascript Math object:
https://docs.hise.audio/scripting/scripting-api/math/index.html
The only difference is that the functions which do not have an argument have two different function names (because you can‘t overload functions which only differ by return type).
This is the case for the random function so it‘s called randomFloat() or randomDouble() dependending on what number type you need.
-
@Christoph-Hart thanks man (∩ ` -´)⊃━━☆゚.*・。゚