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

Thread: biquad filter as phaser?

  1. #1

    biquad filter as phaser?

    Anyone try using the biquad filter with four notch stages as a phaser effect? Just sweep them up and down with some sort of equal spacing, right?

  2. #2
    Not quite - to sound the same as most analogue ones you want to sweep them up and down with equal logarithmic spacing. Still easy to do, just choose the ratio you want and then multiply the base notch frequency by that ratio n times.

  3. #3
    Eh it's going to be another deep dive. I'd like to just grab data from a low-frequency sine object to sweep the notch frequency but I don't think that's possible. I'll see if it can be done simply in main() with a micros() polling timer and a sin() function.

  4. #4
    Here's my first attempt:

    Code:
    // 2 millseconds for the sinewave LFO update
    #define LFO_PERIOD 3000L
    // 2 seconds for LFO cycle
    // 2 ms is 500 updates/s
    // so 1000 would be 2 seconds
    #define BIQUAD_LFO_RANGE 1500
    
    // biquad filter frequency
    // sweep up to 5000 Hz
    #define BIQUAD_MAX 5000
    in main():

    Code:
      // update the biquad filter frequency
      if ((micros() - biquadLfoUpdateTimer) >= LFO_PERIOD)
      {
        lfoIndex++;
        if (lfoIndex > BIQUAD_LFO_RANGE)
          lfoIndex = 0;
        biquadFrequency = ((1 + sin((( 2.0 * M_PI) / BIQUAD_LFO_RANGE) * lfoIndex)) * BIQUAD_MAX) + 60;
        biquad1.setNotch(0, biquadFrequency, 0.3);
        biquad2.setNotch(0, biquadFrequency, 0.3);
        biquadLfoUpdateTimer = micros();
      }
    BTW there's two biquads because I'm processing the stereo output of the ensemble chorus. I'm trying for the 'small stone phaser' sound.
    Last edited by quarterturn; 09-27-2019 at 05:04 PM. Reason: derp

  5. #5
    This sounds pretty good:

    Code:
      // update the biquad filter frequency
      if ((micros() - biquadLfoUpdateTimer) >= LFO_PERIOD)
      {
        lfoIndex++;
        if (lfoIndex > BIQUAD_LFO_RANGE)
          lfoIndex = 0;
        biquad1.setNotch(0, ((sin((( 2.0 * M_PI) / BIQUAD_LFO_RANGE) * lfoIndex)) * 750) + 1000, 0.9);
        biquad2.setNotch(0, ((sin((( 2.0 * M_PI) / BIQUAD_LFO_RANGE) * lfoIndex)) * 750) + 1000, 0.9);
        biquad1.setNotch(1, ((sin((( 2.0 * M_PI) / BIQUAD_LFO_RANGE) * lfoIndex)) * 1000) + 2000, 0.9);
        biquad2.setNotch(1, ((sin((( 2.0 * M_PI) / BIQUAD_LFO_RANGE) * lfoIndex)) * 1000) + 2000, 0.9);
        biquad1.setNotch(2, ((sin((( 2.0 * M_PI) / BIQUAD_LFO_RANGE) * lfoIndex)) * 3000) + 5000, 0.9);
        biquad2.setNotch(2, ((sin((( 2.0 * M_PI) / BIQUAD_LFO_RANGE) * lfoIndex)) * 3000) + 5000, 0.9);
        biquadLfoUpdateTimer = micros();
      }

Posting Permissions

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