0
0

I have been trying to implement my own Infinite Impulse Respone filter but i cant seem to get correct. There is something im missing and its causing a few fuzzy stutter sounds.

Just wondering if anyone has already implemented it on FMOD or if there is a plug-in?

  • You must to post comments
0
0

have you looked at the dsp_gain example. You have to copy the input samples to the output pointer.

If you can do that, then inserting your own maths should not cause any problems unless there is a bug in your specific code implementation that we haven’t seen.

  • You must to post comments
0
0

The Input buffer and out buffer contain PCM samples which are 4 Bytes of data correct? Are the related to the amplitude?

Oh yeah i try to run the DSP_Gain project and it does not work? well it automatically open the User_Plugins and then closes very quickly and not play a sound when ever i select a plugin?

I was kinda wanting to manipulate 2Bytes of data

Well this is what I’m doing for FMOD.

[code:3rn5m9v7]
int order = 2;
double outGain = 0.01;
double inCoeffs[2] = {0.0,-1.0};
double outCoeffs[2] = {0.0};
double inZ[2] = {0.0};
double outZ[2] = {0.0};
long Num = 4000;
float value1 = 0.99f;

outCoeffs[0] = -2.0 * value1 * cos( (2.0 * M_PI ) * (float)Num / 8000.0 );
outCoeffs[1] = value1 * value1;

double output = 0;

int i = 0;

for (count = 0; count < length; count++)
{
/*
Feel free to unroll this.
*/
for (count2 = 0; count2 < outchannels; count2++)
{
output = inbuffer[ (count * outchannels) + count2 ];

//  for (i=order-1;i&gt;0;i--)
//  {
        output +=  (inCoeffs[1] * inZ[1]) - (outCoeffs[1] * outZ[1]);
        inZ[1] = inZ[0];
        outZ[1] = outZ[0];
//  }

    output +=  (inCoeffs[0] * inZ[0]) - (outCoeffs[0] * outZ[0]);

    inZ[0] = inbuffer[ (count * outchannels) + count2 ];
    outZ[0] = output;

    outbuffer[(count * outchannels) + count2] = output * outGain;
}       

}[/code:3rn5m9v7]

This is just on windows which works with out any problems and writes the new data into a new sound: Using the same outCoeffs and array transforms from above

[code:3rn5m9v7]
FILE *out_file = NULL;
FILE *in_file = NULL;

double output = 0.0;

const int BUFFER_SIZE = 1024;

short data[ BUFFER_SIZE ];

long numRead = fread(data,2,BUFFER_SIZE,in_file);

while (numRead>0)
{
printf(".");
for ( int j=0;j<numRead;j++)
{
output = inbuffer[ (count * outchannels) + count2 ];

//  for ( int i=order-1;i&gt;0;i--)
//  {
        output +=  (inCoeffs[1] * inZ[1]) - (outCoeffs[1] * outZ[1]);
        inZ[1] = inZ[0];
        outZ[1] = outZ[0];
//  }

    output +=  (inCoeffs[0] * inZ[0]) - (outCoeffs[0] * outZ[0]);

    inZ[0] = inbuffer[ (count * outchannels) + count2 ];
    outZ[0] = output;

          data[ j ] = output * outGain;
   }

  fwrite(data,2,numRead,out_file);
  numRead = fread(data,2,BUFFER_SIZE,in_file);

}

fclose(in_file);

// open sound at the end again

[/code:3rn5m9v7]

  • You must to post comments
0
0

For sound format information you should look at the very first tutorial in the docs ‘Terminology / basic concepts’.
The data is floating point (which is obviously 4 bytes), and interleaved LRLRLRLR if it is stereo, but it might not be stereo it depends on the speakermode you have set, it could be 5.1 (so data is interleaved 5 samples at a time).

  • You must to post comments
0
0

Thanks. Ill see how things go

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.