Main Archive Specials Wiki | FAQ Links Submit Forum


DFT

Type : fourier transform
References : Posted by Andy Mucho
Code :
AnalyseWaveform(float *waveform, int framesize)
{
float aa[MaxPartials];
float bb[MaxPartials];
for(int i=0;i {
aa[i]=0;
bb[i]=0;
}

int hfs=framesize/2;
float pd=pi/hfs;
for (i=0;i {
float w=waveform[i];
int im = i-hfs;
for(int h=0;h {
float th=(pd*(h+1))*im;
aa[h]+=w*cos(th);
bb[h]+=w*sin(th);
}
}
for (int h=0;h amp[h]= sqrt(aa[h]*aa[h]+bb[h]*bb[h])/hfs;
}



Comments


Added on : 21/09/09 by mahboudz[ AT ]gmail[ DOT ]com
Comment :
does anyone comment their code anymore?

Is amp the return value?              




Added on : 01/07/13 by slh352[ AT ]drexel[ DOT ]edu
Comment :
This is nearly impossible to read!

As Mahboudz asks... what does this return? Also, what is the variable "MaxPartials"?




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