21 #include "../fft/realFFT.H" 27 for (
int i=0;i<fCount;i++)
28 if (outputGT[i])
delete [] outputGT[i];
36 double **outputGT=NULL;
37 if (!(outputGT=
new double*[fCount])){
38 cerr<<
"filter bank malloc error initial"<<endl;
41 for (
int i=0;i<fCount;i++)
43 for (
int i=0;i<fCount;i++)
44 if (!(outputGT[i]=
new double[sCount])){
45 cerr<<
"filter bank malloc error secondary"<<endl;
54 int sampleCount=4096, halfSampleCount=(int)
rint((
double)sampleCount/2.0);
55 int count=75;
int lowFreq=100;
int sampleFreq=8192;
56 double input[sampleCount], **outputGT, **output;
58 powOutput=
FBMalloc(count, halfSampleCount);
59 bzero(input, sampleCount*
sizeof(
double));
61 outputGT=
FBMalloc(count, sampleCount);
62 for (
int i=0;i<count;i++)
63 bzero(outputGT[i], sampleCount*
sizeof(
double));
66 for (
int i=0;i<count;i++)
67 bzero(output[i], sampleCount*
sizeof(
double));
72 GTFB gtfb(lowFreq, sampleFreq, count);
73 for (
int i=1; i<=count;i++)
74 gtfb.grab(i)->filter(input, &outputGT[i-1][0], sampleCount);
77 realFFTData fftData(sampleCount);
78 realFFT fft(&fftData);
79 for (
int i=0;i<count;i++){
80 for (
int j=0; j<sampleCount;j++)
81 fftData.in[j]=outputGT[i][j];
83 fftData.compPowerSpec();
84 for (
int j=0; j<halfSampleCount;j++){
85 powOutput[i][j]=fftData.power_spectrum[j];
96 for (
int i=0; i<count;i++)
97 spreadFn.
setCFreq(i, gtfb.prev()->cf);
100 spreadFn.
excite(powOutput, sampleCount, sampleFreq);
void excite(double **filterBankOutput, int sampleCount, int sampleFreq)
void FBDeMalloc(double **outputGT, int fCount)
void setCFreq(int which, double value)
Method for setting the centre freqs.
double ** FBMalloc(int fCount, int sCount)