Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

BiQuad calculation

DSP related issues, mathematics, processing and techniques

BiQuad calculation

Postby Rocko » Fri Mar 11, 2016 2:20 am

Hi all,

I'm interested in creating an EQ which should be dynamic (offers the ability to change the F,G,Q parameters fast) as well as draw the 'frequency response' graph on the screen.

Naturally, I'll need access to these BiQuads for each case (LPF, HPF, Peak, etc.) for two reasons:
A. For the recursive IIR filter itself
B. For the graphic representation -[in Green math - to fit the 'GraphLinesCL' module which is so handy for this mission].

Which method should I use for such a task, Green math, Blue DSP or Ruby?

From what I know:

Green math - can give me lower CPU (calculation only when param is changed), but no sync (between BiQuads) and 'funny timing'. I think the 'no sync' issue might cause 'glitches' between the calculation of all 5 BiQuads which will cause momentary 'clicks and scratch' noise [not all 5 biquads are calculated at the same time].

DSP Code - perfect timing & sync, can be manipulated to 'make calculation only when param is changed' (on ASM level). But, I'll still need to convert from 'Blue to Green' for the 'GraphicLinesCS' module. This is done with constant 'TICK' and is CPU heavy.
Also 'if' and 'case' statements are not there.

RUBY - Perfect sync and easy implementation (if, case, etc.)
Shouldn't this be the best way?
Is there a chance for 'Sync issues between the 5 BiQuads' if all 5 are calculated in a single RUBY module but output is dedicated (in case of a single green math output for each of the 5 BiQuads)?

Isn't there a way to use 'monoin' or 'streamin' into a RUBY module? Or just green input and output?
Rocko
 
Posts: 179
Joined: Tue May 15, 2012 12:42 pm

Re: BiQuad calculation

Postby MyCo » Fri Mar 11, 2016 11:04 am

If you don't need to manipulate the filter coeffs in realtime (eg. moving a peak around using an LFO), you should go for Green/Ruby. That can save a lot of CPU, especially when you can merge the biquad coeffs into higher order filters before passing them into stream. When you've got the the coeffs in green/Ruby you can draw it right away. So the only benefit of doing the coeff calculation in stream is the realtime manipulation of it.
User avatar
MyCo
 
Posts: 761
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany

Re: BiQuad calculation

Postby Rocko » Fri Mar 11, 2016 1:43 pm

Hi,

Thanks for the answer. It is meant to be a users EQ (no LFO/modulation, just mouse moves).

Let me ask more specifically:

1. Let's assume that I build the 'BiQuads calculator' in RUBY (Input = G,F,Q, SampleRate : output : 5 BiQuads). Upon changing of the input (let's say F) all 5 biquads will change, but not at the same time. During this transition time, the whole filter gets 'garbage' Biquads, even for a very short time. Isn't it so? I mean the 5 outputs are not synced.
Should I simply use a 'Array output' for all 5 biquads. Will that change anything?
Any other method of syncing them, or is there no need?

2. Could you elaborate upon this statement:
especially when you can merge the biquad coeffs into higher order filters before passing them into stream
?
Rocko
 
Posts: 179
Joined: Tue May 15, 2012 12:42 pm

Re: BiQuad calculation

Postby MyCo » Fri Mar 11, 2016 2:15 pm

Rocko wrote:1. Let's assume that I build the 'BiQuads calculator' in RUBY (Input = G,F,Q, SampleRate : output : 5 BiQuads). Upon changing of the input (let's say F) all 5 biquads will change, but not at the same time. During this transition time, the whole filter gets 'garbage' Biquads, even for a very short time. Isn't it so? I mean the 5 outputs are not synced.
Should I simply use a 'Array output' for all 5 biquads. Will that change anything?
Any other method of syncing them, or is there no need?


Yes and No! Yes, the outputs don't get updated at exactly the same time. But No it won't affect the Stream processing. The Streams run in a different thread and process data in chunks, so by the time the next stream chunk gets processed all green outputs already got updated.

Rocko wrote:2. Could you elaborate upon this statement:
especially when you can merge the biquad coeffs into higher order filters before passing them into stream
?


You can merge biquad coeffs into a single higher order filter. You can have a look here: http://www.dsprobotics.com/support/view ... f=3&t=1234

There is a module that does the cascading in the kit, and in the documentation there is chapter 4 which describes how it's done.
User avatar
MyCo
 
Posts: 761
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany

Re: BiQuad calculation

Postby martinvicanek » Sat Mar 12, 2016 6:04 pm

MyCo wrote:You can merge biquad coeffs into a single higher order filter.
Note, however, that higher order filters tend to be more prone to numerical error than cascaded biquads. This is particularly relevant to resonant filters. For esample, the formant filter at music dsp will be unstable (= unusable) (in single precision) unless you factorise it into a biquad cascade.
User avatar
martinvicanek
 
Posts: 1017
Joined: Sat Jun 22, 2013 8:28 pm

Re: BiQuad calculation

Postby Rocko » Tue Mar 15, 2016 12:18 pm

Thanks, appreciated.
I'm reading all about it.
Rocko
 
Posts: 179
Joined: Tue May 15, 2012 12:42 pm

Re: BiQuad calculation

Postby Rocko » Wed Mar 30, 2016 1:28 pm

HI,

So, after quite a few experiments, I had decided to go for 'Blue DSP' for the BiQuad calculation and transfer from 'blue' to 'green' for the graph.
It seems more solid, albeit the inconvenience of code.
Note: This is only true for very fast 'wiggling around of the mouse' which is not the use case of EQ, but I still prefer it

My next question is if there is an intelligent way to run 'Case/Switch' functions in blue DSP. This is for different filter shapes. Example:

Code: Select all
Switch 'Mode' :
     
     Case 'LPF'
           ... here comed BiQuad calulation for LPF
     end

     Case 'HPF'
          ... here comes BiQuad calculation for HPF
     end
end


Is there something similar in Blue_DSP or Assembley ?

Thanks !
Rocko
 
Posts: 179
Joined: Tue May 15, 2012 12:42 pm


Return to DSP

Who is online

Users browsing this forum: No registered users and 1 guest