biquad filter as phaser?

Status
Not open for further replies.

quarterturn

Well-known member
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?
 
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.
 
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.
 
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:
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();
  }
 
Status
Not open for further replies.
Back
Top