Audio compressor and filtering


#1

Hello everyone!

I have encountered on a weird problem while programming my first plugin, I will try to explain it as clearer as I can for anyone who wants to try and help me with it.

Lets start from beginning. I have written a simple Filter class that reads coefficients from a text file where I wrote a couple of coefficients that I got through Matlab. That class reads one of them and process input signal in processBlock method of my processor, and that works well for a start.

Then I have written a Compressor class where I divide spectrum 20Hz -20kHz on three parts,where every part has a different gain. I calculate coefficients of that filter with algorithm I wrote which is based on frequency sampling FIR filter design, or fir2 function in Matlab. And that works fine too since I get same coefficients as ones I get with Matlab for same filter parameters.
After that I have process method in the Compressor class where I have just copied a process method from my Filter class, but when I actually process input with Compressor I get really low volume on output but the output should gain in its magnitude.
When I process same signal in Matlab with Matlab coefficients and the ones I get from my Compressor calculate algorithm, the output is the same.
Then I also tried to take the coefficients I got from my Compressor method and write them down in a text file, which after I read through my Filter class and do the processing, the output is okay,it gains magnitude where it should.I really tried a lot of combinations for that but I couldnt figure out solution.

All of my coefficients are Array type and input is float type. I have tested those coefficients on couple different ways and they are okay, filter process method is also okay since it works when called from Filter class,but I dont really know why it wont work when called from Compressor class.
I also had trouble with Array.set function while implementing circular shifting of coefficients but I have managed to bypass that with getRawDataPointer from my array and then change values,but as I said coefficients should be fine here.

I hope I didnt mess this up even more with my poor description of a problem. If someone needs more details or some part of code I would gladly share here, since I didnt share now because I dont know which part of code is causing problems.

Thanks in advance,
Cila.