So your example is leaving the exponent (YYYYYYY) in place, multiplied by only the first bit of the mantissa, I think.
Hope someone can show how to make this work - I've tried myself a couple times, but it quickly defeated my maths ability! - the other methods can be real CPU hogs.
exonerate ·
trogluddite wrote: The representation of floats is a bit hard to explain, but if I remember right the 32 bits of a float are...
SYYYYYYYXXXXXXXXXXXXXXXXXXXXXXXX - S=sign, YYYYYYY=exponent (representing -63 to 64) , XXX...=mantissa
So your example is leaving the exponent (YYYYYYY) in place, multiplied by only the first bit of the mantissa, I think.
Hope someone can show how to make this work - I've tried myself a couple times, but it quickly defeated my maths ability! - the other methods can be real CPU hogs.
Yeah thanks for that, my maths isn't so hot either. I know it's possible though there are a couple of plugins I know that do this. Guess I need to understand the representation of floats a bit better. 🙂
Cheers 😉
Exo
Disco_Steve ·
the dither module has a bit crusher in it. is that not fast enough?
trogluddite ·
The dither module uses the same technique that I've used myself before - the divide gets exteremely expensive on CPU. The project I wanted it for had several hundred lines of code running at sample rate - yet that one divide nearly doubled the CPU load! Never really got to the bottom of why that was - there are several other divides in the code, so it must depend on the range of the operands.
MichaelBenjamin ·
maybe you got some denormals.
Disco_Steve ·
why dont you do all the maths using the large numbers, and then do one divide at the end. that should be fast enough.
MegaHurtz ·
Srry but I think that dither is for dummies.
Dont know about the rounding though.. Was going to upp an attachment
but cant do that here.. sow.. If you pm me your email I might have a suggestion you like.
cheerio`s 😉
trogluddite ·
Disco_Steve wrote: why dont you do all the maths using the large numbers, and then do one divide at the end. that should be fast enough
That was my thinking too, to keep the numbers big for as long as possible - but it really made very little difference. Tried some of the usual anti-denormal techniques too with very little success.
MegaHurtz wrote: Srry but I think that dither is for dummies.
Yup, it is rather crude - I'll stick with my old uv22 plugin for now I think.
trogluddite ·
BTW the equations for the floating point representation that I gave aren't quite right. This thread got me thinking about the bitcrusher again after a long break, so I went back and checked my previous work. This Wiki article gives the correct IEE standards for 32bit floats...
http://en.wikipedia.org/wiki/IEEE_754-1985
P.S. Have a look at DigitalWhiteByte's binary-to-decimal and decimal-to-binary conversion modules, just posted in the developer's toolkit. I'm just doing some tests, but I think that if you feed the decimal to binary with an assemby module with the code...
streamin in;
streamout out;
movaps xmm0,in;
cvtdq2ps xmm0,xmm0; //pretend that the input was really an integer (cheating) and turn to float
movaps out xmm0;
...You should be able to peek at the actual layout of the bits in whatever float you feed to the code.
EDIT - posted the schematic on the developer's toolkit thread - still needs some experts to check that it is 100% correct.
Disco_Steve ·
I think you will find the dither works, and works well!
and you can use it in your code. so your plug-ins sound nice.
but a plug-in afterwards will not work, because the quantisation has happened and it is already too late.
if you can make a better dither. one that does more than work (however that is possible)
please upload so that I can use it in my projects
trogluddite ·
Disco_Steve wrote: I think you will find the dither works, and works well!
Sorry Disco, no offence meant - 'crude' wasn't the best choice of words - more that the assembly can be optimised quite a bit still. e.g. the rounding can use the cvtps2dq and cvtdq2ps commands instead of all the one channel floating point maths that the code expands to - it really does save a lot of CPU cycles. It's also quite possible I wasn't even looking at the most up to date version.
I'd be interested to know more about your thoughts on dithering within a plugin - I was always taught that dithering was somethihg that should only be done once (final output of a signal chain), so that dithering multiple times could not occur (which would bring the noise level above the last bit of resolution). AFAIK, most hosts keep all their maths in the floating point domain, so I would have expected dithering to not be an issue until D/A conversion - hence using my uv22 as the last process before the soundcard outputs.
As for using bitrate reduction as an effect - I personally don't want it to sound nice, I want to use it deliberately as a form of distortion (I'm one of those oddballs that quite likes a bit of aliasing too!)
MegaHurtz ·
If yr really into dither you`d only "need" it on your final buss.
There really is no need to dither a synth.
Wrote something here? To have a post removed or your name hidden, write to [email protected].