Main Archive Specials Wiki | FAQ Links Submit Forum


Bit quantization/reduction effect

Type : Bit-level noise-generating effect
References : Posted by Jon Watte

Notes :
This function, run on each sample, will emulate half the effect of running your signal through a Speak-N-Spell or similar low-bit-depth circuitry.

The other half would come from downsampling with no aliasing control, i e replicating every N-th sample N times in the output signal.


Code :
short keep_bits_from_16( short input, int keepBits ) {
return (input & (-1 << (16-keepBits)));
}




Comments


Added on : 30/05/05 by illdoc[ AT ]gmail[ DOT ]com
Comment :
I add some code to prevent offset.

Code :
short keep_bits_from_16( short input, int keepBits ) {
short prevent_offset = static_cast<unsigned short>(-1) >> keepBits+1;
input &= (-1 << (16-keepBits)));
return input + prevent_offset
}





Added on : 26/07/09 by isac[ AT ]op[ DOT ]pl
Comment :
              



Added on : 03/07/12 by info[ AT ]leon[ DOT ]vankammen[ DOT ]eu
Comment :
Im having trouble how to use this on floats..any example would be great              



Add your own comment
Comments are displayed in fixed width, no HTML code allowed!
Email:

Comment:

Are you human?



Site created and maintained by Bram
Graphic design by line.out | Server sponsered by fxpansion