Hi Sir ,

Now we got question for a Filter part , as attatched , could you please help to solve ?

Thanks .

Best regards,

Windy

Hi Sir ,

Now we got question for a Filter part , as attatched , could you please help to solve ?

Thanks .

Best regards,

Windy

Hi Windy,

The VisualAudio tools were discontinued and is no longer supported by ADI.

The support route for questions regarding VisualAudio is now through the engineers at DSP Concepts available at the following link.

**http://www.dspconcepts.com/contact**Thanks,

Divya

Hi Divya,

Is not concerned VisualAudio , we can download many example of cascade filter from your website , and now we just want to feagure out its coefficient , could you give us the related information ?

VisualAudio framework is made by DSPconcept , but the source code is assemble program which marked from ADI , we use VisualAudio in shor-term , because it's good tool for us to understand ADI's DSP , and we used it develop our products .

Best regards,

Windy

Hi Windy,

In reference to the stereo cascaded biquads(IIR) you have pointed, the four coefficients (a1, a2, b1, b2)are as following as per the transfer function.

a1*z^-1 + a2*z^-2

H(z) = A * -------------------

b1*z^-1 + b2*z^-2which is

w[n] = x[n] + a1*w[n-1] + a2*w[n-2]

y[n] = w[n] + b1*w[n-1] + b2*w[n-2]So for each channel you have four coefficients per biquad. For stereo pair, you have eight coefficients combined (four for each channel)

Now the example code uses 3 cascaded biquads for IIR filtering.

Regarding your question of why 8 coefficients are required. The filtering algorithm uses SIMD and operates on two channels of stereo pair simultaneously. Hence requries 8 coefficients per biquad provided as follows.

a2(channel 1), a2(channel 2), a1(channel 1), a1(channel2), b2(channel1), b2(channel2), b1(channel1), b1(channel2).

Since you will perform same kind of filtering, the values of channel 1 and channel 2 will be identical ie a2(channel 1) will be the same as a2(channel 2)

If there is more than one biquad the 8 coefficients of the second biquad in the cascade will follow the first biquad coefficients having the same order as above.

Hope this clarifies.

Edited by Divya - The above explanation has the wrong transfer function .

The right transfer function is as given in the post below.

Thanks,

Divya

1 + b1*z^-1 + b2'*z^-2

H(z) =A ----------------------------------- ,

1 + a1*z^-1 + a2*z^-2

Hi Windy, Thomas,

The transfer function is the normalized transfer function as per the reference code stereo cascaded IIR filter which was requested by Windy. Since the reference code had the normalized transfer function and its derivation I didn't give the steps to the final transfer funtion.

To avoid any further confusion see below on how it was derived.

Following are the steps how the transfer function is acheived.

The initial transfer function is a direct form II cascaded IIR filter.

Given the most general biquadratic (second order rational polynomial)

b0 + b1'*z^-1 + b2'*z^-2

H(z) = -------------------------- ,

a0 + a1'*z^-1 + a2'*z^-2we may factor out the gain of the transfer function,

b0 (b1'/a0)*z^-1 + (b2'/a0)*z^-2

H(z) = ---- * -------------------------------

a0 (a1'/b0)*z^-1 + (a2'/b0)*z^-2and normalize the coefficients, such that

a1*z^-1 + a2*z^-2

H(z) = A * -------------------

b1*z^-1 + b2*z^-2Hope this clarifies. Please let me know if you have any further questions.

Edited: by Divya

NOTE:- IGNORE The above derivation. The right derivation is in the posts below.

Thanks,

Divya

Hi Divya!

Do you want to confuse us before the weekend? I do not understand how, you factor out the gain. And since your transfer function is a first order filter, it can not be correct!

a1*z^-1 + a2*z^-2 z a1 + a2*z^-1

H(z) = A * ------------------------- * ------ = A -----------------------------

b1*z^-1 + b2*z^-2 z b1 + b2*z^-1I would do it this way:

b0 + b1'*z^-1 + b2'*z^-2

H(z) = -------------------------- ,

a0 + a1'*z^-1 + a2'*z^-2we may factor out the gain (b0/a0)of the transfer function,

b0 b0/b0 + b1'/b0*z^-1 + b2'/b0*z^-2

H(z) = --* --------------------------------------------=

ao a0/a0 + a1'/a0*z^-1 + a2'a0/*z^-2and normalize the coefficients, such that

1 + b1*z^-1 + b2'*z^-2

H(z) =A -------------------------- ,

1 + a1*z^-1 + a2*z^-2best regards,

Thomas

Dear Divya ,

the one with Stereo one is correct for us . that's what we need .

Now we are finished our development for SHARC , and ADI China just been our office yesterday and affirmed that we are the first company developed SHARC successfully in China . we are appriciate your support for us in DSP Support Forum , your support for us is very important . and thanks Linda for the application's support . DSP Support Forum is a very good platform for engineers , and we wish it can be developed more strong .

Could you develop your DSPs more connected with MATLAB ? now just your 2136x can support MATLAB . at this point , TI is better than yours , all of their DSP can support MATLAB.

Thanks very much .

Best regards,

Windy

DSP Lab of Huadi

86-20-85665279

- 1 person found this helpful
Hi Windy,

I am not sure what exactly you are looking for here. Why are you looking to convert Matlab code to C language for calculating filter coefficients. Can't you directly use the coefficients generated from the Matlab for your filter implementation. Am I missing something here.

Thanks,

Divya

Hi Divya ,

The machine we designed allow users to change the parameters , like changing the frequency from 20Hz to 20KHz , and the Gain from +15 to -15 , as well as the Q value can be changed depend on user's setting . we are not clear if these parameter should be calculated by DSP in real-time , or other mathods ? could you give us your suggestions ?

Thanks .

Best regards,

Windy

Hi Windy,

I am not sure if it is a good idea to calculate the coefficients real time by DSP each time the mode is selected. . May be you could store the coeffients for each parameter in memory and based on the user input point to the right parameters for filter implementation. This would require more memory but I think it would be more efficient.

Thanks,

Divya

Hi Divya ,

Thanks for your information .

Users need to debug the frequency from 20hz to 20khz , also the Q value of filter and gain can be adjusted . we are take great interest in the method you suggested , and agreed with you that real-time calculate is not a good way , but we have not idea on how make the parameter inside of memory , could you give us some reference ? such as , user adjust the Q , Gain or order of filter in different frequencies .

Please advise , Thanks .

Best regards,

Windy

Hi Windy,

Have you had a chance to look at SigmaStudio software provided by Analog devices which allows the user to graphically configure a custom signal processing flow using blocks, such as biquad filters, dynamics processors, level controls, and GPIO interface controls. It also includes tools for intuitively setting control registers, calculating tables of filter coefficients, visualizing filter magnitude and phase responses, generating C header files, and sequencing a series of controls to ease your transition from SigmaStudio to system implementation on your DSP. Thought this might be of some help for your project.

Thanks,

Divya

Hi Windy,

In reference to the stereo cascaded biquads(IIR) you have pointed, the four coefficients (a1, a2, b1, b2)are as following as per the transfer function.

a1*z^-1 + a2*z^-2

H(z) = A * -------------------

b1*z^-1 + b2*z^-2

which is

w[n] = x[n] + a1*w[n-1] + a2*w[n-2]

y[n] = w[n] + b1*w[n-1] + b2*w[n-2]

So for each channel you have four coefficients per biquad. For stereo pair, you have eight coefficients combined (four for each channel)

Now the example code uses 3 cascaded biquads for IIR filtering.

Regarding your question of why 8 coefficients are required. The filtering algorithm uses SIMD and operates on two channels of stereo pair simultaneously. Hence requries 8 coefficients per biquad provided as follows.

a2(channel 1), a2(channel 2), a1(channel 1), a1(channel2), b2(channel1), b2(channel2), b1(channel1), b1(channel2).

Since you will perform same kind of filtering, the values of channel 1 and channel 2 will be identical ie a2(channel 1) will be the same as a2(channel 2)

If there is more than one biquad the 8 coefficients of the second biquad in the cascade will follow the first biquad coefficients having the same order as above.

Hope this clarifies.

Edited by Divya - The above explanation has the wrong transfer function .

The right transfer function is as given in the post below.

Thanks,

Divya

1 + b1*z^-1 + b2'*z^-2

H(z) =A ----------------------------------- ,

1 + a1*z^-1 + a2*z^-2