This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Algorithm to calculate the coefficients of Parametric Equaliser of PPS

Other Parts Discussed in Thread: TAS3204

I want to add to a product the Parametric Equaliser, the user will have the option to change Fc, Q and Gain. I normally create a table and keep it in the microcontroller and then send the coeficients B0,B1,B2, A1 via I2C to the TAS3204. In this case it will not work for my application, the table would have to be greater than 32k Flash of the uController. So in order to solve this i need to have the equations to calculate the coeficients of the PEQ and then convert the number to a HEX format (32bits) that the TAS3204 can accept. Please advice.
  •  

    I  found this paper on the internet, see if it can help. 

    Susan

  • Hi Susan, thank you for the information, i have solved the point of calculating the coeficients. Now i need to convert the coeficient to hex, do you have information?
  •  

    Hector,

    Please let me know in a bit detail what you plan to do.  If you calculate the coefs in DAP in real time, you don't need to convert it.  How did you calculate the coefs?

    Susan

  • Hi Susan, I have a microcontroller from another manufacturer. I use this microcontroller to work as the interface of the user (GUI), all the parameters are entered thru a keyboard and displayed on a LCD. On this microcontroller i am calculating the coefs, my problem now is that the format of the float variables on this microcontroller is differente from the format Pure Path Studio has. Thats why i need to know the format PPS use for the float variables. After your comments you have placed things on a different perspective, you say that i can calculate the coefs on the DAP, well, my question also will be how can i create an interface with the DAP and have it calculate the coefs, is there a object on PPS that allows me to do so? Best Regards
  • Hector,

    If you calculate the coefs in your micro and need to transfer the value through I2C, then you need to convert it to 5.23 format which is the format of the coef memory in DAP. For example, if the coef is 0.12345, then the number would be  0x00FCD35, since I2C is 8bit, we need to add another 4 bit at front, so the 32bit hex would be 0x000FCD35.

    If you want to calculate the coefs in DAP, then you need to pass the user input through I2C to DAP and make a component in DAP using the user input.

    I think you calculating the coefs in micro probably is the easier way.

    let me know if I didn't answer your question.

    Susan

  • Hi Susan, I have made the code on the microcontoller, also took the algorithms for the PEQ (non constant Q) from another user of this site: http://e2e.ti.com/support/applications/audio/f/22/p/77346/277665.aspx#277665 Q = 1 Fs = 48000 F0 = 1000 Dbgain = 12 A = 10 ^ (Dbgain/40) W0 = 2*pi*(f0/fs) Cosw0 = Cos(w0) Sinw0 = Sin(w0) Alpha = Sinw0 / 2*Q B0 = 1 + (Alpha * A) B1 = -2 * Cosw0 B2 = 1 - (Alpha * A) A0 = 1 + (Alpha / A) A1 = -2 * Cosw0 A2 = 1 - (Alpha/A) B0 = B0 / A0 B1 = B1 / A0 B2= B2 / A0 A1 = A1 / A0 A2 = A2 / A0 The code of the microcontroller is working and the coeficient calculation is also correct, the coeficients i tested on Matlab and the 5.23 format i made is correct, but still the output is not what i was expecting (the output signal is totaly bad). If the coeficients work on Matlab and i have confirmed that i have changed correctly the coeficients format to 5.23, why dont they work on TAS3204?. Do you have a different algorithm i can test? The coeficients that PPS give me are different from the one calculated by the the algorithm shown, but still, on Matlab this algorithm works, why doesn't it work on the TAS3204? BR
  • Hector,

    First, let's check whether you do have the correct coefficient in DAP memory:  after you built your project, there is a dsp_main.lst file, in which all the address allocation are listed.  Using the I2C memory tool, peek the memory location that the coefficients should be and check whether they're the value expected.

    Susan

  • Hi Susan, thanks for the quick response. I am working on my own board, NOT THE EVM of the TAS3204. I have made some test with my code, when i send the coefficients given by PPS it works ok, when i send the values calculated by the algorithm shown above, then it does not work. I will make a test on the EVM and i will let you know the result of the peak and poke. Can you provide the algorithm that TI uses to calculate the coefficients for the Equalizer (Q factor)?
  • Hector,

    Can you send me the two sets of coeffs calculated by you and PPS and also the parameters you used?  If it works in Matlab, it should work in DAP.  There're many ways of calculating coeffs, I feel that the method of calculating is not the problem.

    Susan

  • Hi Susan, here is what you have requested Q = 1; FS = 48000; F = 15000; Dbgain = 12; Algorithm implemented on my side: Coefs TAS FORMAT 5.23 b0 1.560424 0x00C7BBF9 b1 0.62148112 0x004F8CB1 b2 0.063587599 0x000823A3 a1 0.62148112 0x004F8CB1 a2 0.62401152 0X004FDF9C PPS b0 2.74028110504150390625 0x15EC188 b1 0.3185632228851318359 0x028C6AE b2 -1.907835483551025390625 0xF0BCC0C a1 -0.3185632228851318359375 0xFD73952 a2 0.16755402088165283203125 0x0157269 Q = 1; FS = 48000; F = 15000; Dbgain = 6; Algorithm implemented on my side: Coefs TAS FORMAT 5.23 b0 1.2452688 0x009F64F8 b1 0.57675135 0x0049D2FD b2 0.26185787 0x0021848E a1 0.57675135 0x0049D2FD a2 0.50712687 0X0040E988 PPS b0 1.5120116472244262695 0x0C18999 b1 0.37162458896636962890625 0x02F9165 b2 -0.5409095287322998046875 0xFBAC37A a1 -0.37162458896636962890625 0xFD06E9B a2 0.028897762298583984375 0x003B2EC Best Regards
  • Hector,

    I looked at your numbers.  I guess I may have failed to remind you, for all the "a" coefficients, you need to negate the number, then send to TAS.  For example, from your results: where  a1=0.62148112 , then you need to send a1=-0.62148112  to TAS, that is 0xFFB0734F.

    Please let me know  if it didn't solve your problem.

    Susan

  • Hi Susan, Have tested your recommendation, the system is working, thank you for the help. Regards
  • Hi, Hector,

    Can you do me a favor, log into the forum and mark Susan's answer as "Answer Verified" so we know you're happy?

    -d2