Main Archive Specials Wiki | FAQ Links Submit Forum


Type : Bit-reducer and sample&hold unit
References : Posted by tobyear[AT]web[DOT]de

Notes :
This is a simple bit and sample rate reduction code, maybe some of you can use it. The parameters are bits (1..32) and rate (0..1, 1 is the original samplerate).
Call the function like this:

A VST plugin implementing this algorithm (with full Delphi source code included) can be downloaded from here:

Comments/suggestions/improvements are welcome, send them to:

Code :
// bits: 1..32
// rate: 0..1 (1 is original samplerate)

********** Pascal source **********
var m:longint;

// call this at least once before calling
// decimate() the first time
procedure setparams(bits:integer;shrate:single);
m:=1 shl (bits-1);

function decimate(i:single):single;
if (cnt>1) then

********** C source **********
int bits=16;
float rate=0.5;

long int m=1<<(bits-1);
float y=0,cnt=0;

float decimate(float i)
if (cnt>=1)
y=(long int)(i*m)/(float)m;
return y;


Added on : 03/12/02 by kaleja[ AT ]estarcion[ DOT ]com
Comment :
Nothing wrong with that, but you can also do fractional-bit-depth decimations, allowing
smooth degradation from high bit depth to
low and back:

// something like this -- this is
// completely off the top of my head
// precalculate the quantization level
float bits; // effective bit depth
float quantum = powf( 2.0f, bits );

// per sample
y = floorf( x * quantum ) / quantum;


Added on : 14/02/03 by dr[ DOT ]kef[ AT ]spray[ DOT ]se
Comment :
it looks to me like the c-line

long int m=1<<(bits-1);

doesnt give the correct number of quantisation levels if the number of levels is defined as 2^bits. if bits=2 for instance, the above code line returns a bit pattern of 10 (3) and not 11 (2^2) like one would expect.

please, do correct me if im wrong.


Added on : 20/03/03 by resofactor[ AT ]hotmail[ DOT ]com
Comment :
just getting into coding, i've mainly been working with synthedit...but would really like to move on into the bigger arena? any pointers for a DSP newbie-totally not hip on structured programming...yet! :O)

Added on : 15/05/12 by gary[at]dmt uk
Comment :
              great algo, works fine.. many thanks

Added on : 27/08/13 by catena[ AT ]neostrada[ DOT ]pl
Comment :
Hey, kilelr job on that one you guys!

Added on : 28/08/13 by jacalyn[ DOT ]neely[ AT ]wybusiness[ DOT ]org
Comment :
You're the one with the brains here. I'm <a href="">wacntihg</a> for your posts.

Added on : 30/08/13 by akegley[ AT ]fbtlaw[ DOT ]com
Comment :
d8b3d984d8a7d985 d8afd988d8b3d8aad8a7d986 d985d986 d988d982d8aadb8c d985db8c d8aed988d8a7d987d985 d988d8a7d8b1d8af db8cdaa9 d8b3d8b1d988d8b1 d8a8d8b4d985 d8a8d8a7 d8a7d8b1d988d8b1 server<a href=""> coetncnion</a> time out d985d988d8a7d8acd987 d985db8c d8b4d985 d985d986 d8aad985d8a7d985 dlc d987d8a7 d988 daa9d8b1daa9 d8a8d8a7d8b2db8c d8b1d988 d8b7d8a8d982 d8b1d8a7d987d986d985d8a7 daa9d9bedb8c daa9d8b1d8afd985 d988 d8a7d9bed8afdb8cd8aa d987d985 daa9d8b1d8af d988d984db8c d8a8d8a7d8b2 d987d985 d8a8d8a7 d8a7db8cd986 d8a7d8b1d988d8b1 d985d988d8a7d8acd987 d985db8c d8b4d985 d985d986 d8b9daa9d8b3 d8a8d8a7d984d8a7 d8a7d8b2 d9bed988d8b4d987 main d8b1d988 d8a8d8a7 d9bed988d8b4d987 d8aed988d8afd985 d985d982d8a7db8cd8b3d987 daa9d8b1d8afd985 d8afdb8cd8afd985 d8aad8b9d8afd8a7d8af d981d8a7db8cd987d8a7db8c d9bed988d8b4d987 main d985d986 d8aedb8cd984db8c daa9d985 d987d8b3d8aad986 d8afd8b1 d8add8af dbb3dbb4 d8aad8a7 d988d984db8c da86d8b7d988d8b1 d8aad988 d8b9daa9d8b3 d8a8d8a7d984d8a7 d8a8db8cd8b4 d8a7d8b2 dbb6dbb0 d981d8a7db8cd984 d8a7d8b3d8aa d985d986 daa9d987 dlc d987d8a7 d8b1d988 daa9d9bedb8c daa9d8b1d8afd985 d988d984db8c da86d8b1d8a7 d8aad8b9d8afd8a7d8af d981d8a7db8cd984d987d8a7 daa9d985 d987d8b3d8aad986 d984d8b7d981d8a7 d985d986 d8b1d8a7 d8afd8b1 d8a8d8a7d8b1d987 d8a7db8cd986 d8a7d8b1d988d8b1 d8b1d8a7d987d986d985d8a7db8cdb8c daa9d986db8cd8af.

Added on : 07/09/13 by market[ AT ]ymcasting[ DOT ]com
Comment :
Fiaylln! This is just what I was looking for. [url=]kftggbg[/url] [link=]gxvbsjpvis[/link]

Added on : 03/03/14 by o1qtfhdq8p[ AT ]gmail[ DOT ]com
Comment :
Having defined the vital terms of the contract, the contract will set forth the exact terms of the agreement. Most policies are written in outline form and organized around sections. Each section of the QuotesChimp covers one specific topic of the agreement. For example, Section I of a homeowner's insurance policy deals with property coverages, and Section II with liability. Thus, each area of the contract that deals with property coverage in the policy will be labeled as "Section I" material and each part that sets forth the terms of liability coverage will be labeled as "Section II." Most policies have several sections within each insurance agreement.

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