hi all,
here i am puttin a code for a function
in which WAV_SIGNAL is an structure.
can any body give me a code that will look like a well professional code and will do the same thing but more efficiently.
Code:
float *EnergyOnset(WAV_SIGNAL *WDat,short *FrameState,float *FramePitch)
{
int i,j;
float *Frame;
int NumFrame=(WDat->DataSize/FRAME_SIZE)+1;
int SamplingRate=WDat->SampleRate;
Frame=(float *) malloc(sizeof(float)*FRAME_SIZE);
for(i=0;i<NumFrame;i++) {
if(FrameState[i] != 0) {
for(j=0;j<FRAME_SIZE;j++) Frame[j]=WDat->Data[FRAME_SIZE*i+j];
FramePitch[i]=PitchACRCalc(Frame,SamplingRate);
}
else FramePitch[i]=0;
}
free(Frame);
Frame=(float *)NULL;
return FramePitch;
}