Main Archive Specials Wiki | FAQ Links Submit Forum

Lo-Fi Crusher

Type : Quantizer / Decimator with smooth control
References : Posted by David Lowenfels

Notes :
Yet another bitcrusher algorithm. But this one has smooth parameter control.

Normfreq goes from 0 to 1.0; (freq/samplerate)
Input is assumed to be between 0 and 1.
Output gain is greater than unity when bits < 1.0;

Code :
function output = crusher( input, normfreq, bits );
step = 1/2^(bits);
phasor = 0;
last = 0;

for i = 1:length(input)
phasor = phasor + normfreq;
if (phasor >= 1.0)
phasor = phasor - 1.0;
last = step * floor( input(i)/step + 0.5 ); %quantize
output(i) = last; %sample and hold


Added on : 16/06/04 by kk791231[ AT ]hotmail[ DOT ]com
Comment :
what's the "bits" here? I tried to run the code, it seems it's a dead loop here, can not figure out why

Added on : 26/10/05 by dfl
Comment :
bits goes from 1 to 16

Added on : 18/03/16 by 2SenseEntertainment[ AT ]gmail[ DOT ]com
Comment :
I'm having trouble with the code as well. Is there something I'm missing?

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


Are you human?

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