Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 5 of 5

Thread: biquad bandpass Q value

  1. #1
    Junior Member
    Join Date
    Jun 2022
    Posts
    4

    biquad bandpass Q value

    Hello,

    Just a simple and short question, how is the Q (passband width) value in biquad,setBandpass defined? As in, what is the value in? Hz? The only documentation for the library that I'm aware of is the audio system design tool, which doesn't explain Q, and the example in the arduino IDE only shows lowpass which has a different use for its Q value.
    Thanks!

  2. #2
    Senior Member
    Join Date
    May 2017
    Posts
    301
    Q is a value without units. I have used this online calculator for cascading highpass, lowpass filters. I did not have good results with the bandpass filter type and cascaded highpass and lowpass filters in order to get bandpass filter results.

    https://www.earlevel.com/main/2016/0...ading-filters/

  3. #3
    Junior Member
    Join Date
    Jun 2022
    Posts
    4
    Hey, could you go into further detail as to how you did this exactly? If you're correct about the bandpass quality then I'd probably want to do the same. Actually, what exactly was wrong with the bandpass?

    Thanks.

  4. #4
    Senior Member
    Join Date
    May 2017
    Posts
    301
    In one of my programs I used one bi-quad of high pass and 3 bi-quads of low pass. For the narrow band mode of CW, the bandwidth is split plus and minus from the center frequency of 700 hz. You can ignore the wv variable, this was a Weaver mode radio. I implemented a tone control by varying the Q of the lowpass filter sections - and that sort of works ok.


    Code:
       if( mode == CW ){
           wv = 2500;
           hp = ( bw > 1000 ) ? 200 : 700 - bw/2;
           bw = ( bw > 1000 ) ? bw : 700 + bw/2 ;
       }
       else if( mode == AM || mode == DIGI ) wv = 6000, hp = 100;      // for digi mode, set weaver hole at 3k hz
       else hp = 200, wv = 4000;                                       // SSB
    
       BandWidth.setHighpass(0,hp,0.70710678);
       BandWidth.setLowpass(1,bw,0.51763809 + tone_);
       BandWidth.setLowpass(2,bw,0.70710678 + tone_);
       BandWidth.setLowpass(3,bw,1.9318517 + tone_/2);
    Actually I found I did use a bandpass section in another program. The Q value used was most likely found by trial. ( And it looks like my other Q's are incorrect, I probably wrote this program before I found the online calculator linked above )

    Code:
          if( mode_menu_data.current == 1 ){         // cw/hell modes, change last to bandpass response
             BandWidth.setLowpass(0,sel,0.67); 
             BandWidth.setLowpass(1,sel,1.10);
             BandWidth.setLowpass(2,sel,0.707);     
             BandWidth.setBandpass(3,700,2.5);
          }

  5. #5
    Junior Member
    Join Date
    Jun 2022
    Posts
    4
    Quote Originally Posted by rcarr View Post
    In one of my programs I used one bi-quad of high pass and 3 bi-quads of low pass. For the narrow band mode of CW, the bandwidth is split plus and minus from the center frequency of 700 hz. You can ignore the wv variable, this was a Weaver mode radio. I implemented a tone control by varying the Q of the lowpass filter sections - and that sort of works ok.


    Code:
       if( mode == CW ){
           wv = 2500;
           hp = ( bw > 1000 ) ? 200 : 700 - bw/2;
           bw = ( bw > 1000 ) ? bw : 700 + bw/2 ;
       }
       else if( mode == AM || mode == DIGI ) wv = 6000, hp = 100;      // for digi mode, set weaver hole at 3k hz
       else hp = 200, wv = 4000;                                       // SSB
    
       BandWidth.setHighpass(0,hp,0.70710678);
       BandWidth.setLowpass(1,bw,0.51763809 + tone_);
       BandWidth.setLowpass(2,bw,0.70710678 + tone_);
       BandWidth.setLowpass(3,bw,1.9318517 + tone_/2);
    Actually I found I did use a bandpass section in another program. The Q value used was most likely found by trial. ( And it looks like my other Q's are incorrect, I probably wrote this program before I found the online calculator linked above )

    Code:
          if( mode_menu_data.current == 1 ){         // cw/hell modes, change last to bandpass response
             BandWidth.setLowpass(0,sel,0.67); 
             BandWidth.setLowpass(1,sel,1.10);
             BandWidth.setLowpass(2,sel,0.707);     
             BandWidth.setBandpass(3,700,2.5);
          }
    Huh, very interesting. Do you remember what is wrong about bandpass filters? It feels like I'd have faster filtering since using a Bandpass will remove a difference equation in calculation.

    For context, I am trying to implement a 8-band graphic equalizer. Do you have any tips?

    My thoughts:
    Would cascading purely lowpass/highpass be quicker? This is mostly just splitting up a signal into different bands.
    How could I "sharpen" the edges of the filters? Cascading doesn't seem to be enough?

    I also found this updated calculator:
    https://www.earlevel.com/main/2021/0...calculator-v3/

    Rather unsure how to proceed.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •