2nd order allpass for phaser?

Started by ElectricDruid, September 27, 2022, 05:37:55 AM

Previous topic - Next topic

ElectricDruid

Has anyone ever had a go at this? I remember Mark H saying he'd once had such a thing demonstrated to him, but that's about all I remember.

I found the following circuit at https://www.rfwireless-world.com/Terminology/All-Pass-Filter-basics-and-types.html:



The design equations for this are:

  • k = 2*π*Fo*C
  • R2 = (2*Q)/k
  • R1 = 1/(2*k*Q)
  • R3 = R1
  • R4 = Q*Q*R3

Now, that implies to me that we can't sweep the frequency using Rs without also affecting the Q. But it would be possible to build it as a switched-capacitor filter and sweep the frequency that way. It'd be like a common-or-garden PWM phaser, except using a switched cap instead of a switched R.

Thoughts? It might not be worth the effort, but unless we try, we'll never know, right?!? ;)


Edit: One more thing! What *should* the Q be for an allpass? I've never thought about it before! Should we design a "butterworth" allpass or a "chebyshev" allpass? (Abusing terminology, but you get the idea, I hope...)

Rob Strand

#1
It's important to separate *circuits* from transfer functions.   Circuits are only an implementation of a transfer function and there may be many circuits which give the same transfer function (a state-variable filter would be an example).   Some circuits are of course more easily tunable than others via the component values.

If you start with the standard first-order all-pass circuit and cascade two of them you get a second order transfer function.   So right there the common circuit already brings something in common with the second order circuit.   So what does that second order circuit bring?
- The ability to set a different Q.  In particular a Q higher than 0.5.
  The common two opamp circuit defaults to Q=0.5.   Different cap values causes Q < 0.5.
  The higher Q brings the notches closer together (IIRC); also more group delay.
- Second order with one opamp.
- less convenient tunability, as in general you want to maintain a constant R2/R1 ratio *but* R2 and R1 are different values, so harder to implement.
- need to select R3, R4 with some degree of accuracy in order to maintain a flat (all-pass) response.

There's another similar circuit to the one you gave  (which has, all-pass, band-pass, and notch versions).  It's the RC <--> CR dual circuit where R1, R2 are replaced by C1 and C2 and the two C's are replace with equal R's.   This gets around the problem of R1 and R2 being different values.   They still however must track to some degree of accuracy.   The tuning resistors aren't ground referenced so the easy way to implement the R's would be optos as they can float.  You would need to check tracking.

The biggest difference sound-wise over standard circuits is the ability to set higher Q's.    (I believe you can add positive feedback to the standard circuit to mess with the Q's.  But the number of opamps is starting to increase.)
If you were to pick a Q of 0.5 then you are only gaining trouble with the second order circuit, as you are choosing a circuit which is more sensitive to tolerances.   The nice thing about the common first-order circuit is it is inherently flat, fairly close to unity gain, and inherently insensitive to mistuning of the resistors.
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

ElectricDruid

Thanks Rob, all good points. And thanks for the pointer about the Q of the typical 1-pole allpass stage we see all the time. I didn't know that, but I suppose that makes sense.

I had a bit of a play with the design equations, and if you swap things around a bit, it starts to look much simpler. Mostly I noticed that R2 is four times R1, and that if Q=1, then R3 and R4 equal R1 too. Now we're talking!

So for Q=1:

  • R1 = R3 = R4 = 1 / (4*Pi*Fo*C)
  • R2 = 4*R1
And that's it! Since there aren't many E24 values that allow "x4", 7K5 and 30K are looking like a good place to start.

More generally:

  • k = 1 / (4*π*Fo*C)
  • R2 = 4*k*Q
  • R1 = R3= k/Q
  • R4 = Q*Q*R1
While optos would work if we swap Rs and Cs, a switched-cap or switched-R can also float, so we have other options. I'm imagining a classic PWM phaser but done with Q=1 second order stages instead.


ElectricDruid

#3
Rob, do you have any references for further sources where I can read up about second order allpass filters?

I've tried that schematic I posted but I can't get unity gain out of it. It's allpass, but -6dB down.

<edit>I found the following useful discussion on StackExchange:

https://electronics.stackexchange.com/questions/306649/second-order-all-pass-filter-using-a-single-op-amp

This points out that the gain for this circuit is R4/(R3+R4), so it can't ever reach unity (although as you push the Q up, you get closer) and for my Q=1 case, I get gain of x0.5, which is what I'm seeing. That's slightly disappointing since it'd imply a fair amount of make up gain if you cascaded several of these stages. But it does work and produce a phaser notch, if you use 2:1 weighting for the mixer resistors when you add the dry signal back in.


Mark Hammer

Sam Hoshuyama has a couple of pages and sample circuits with 2nd order allpass.
https://understandcircuit.seesaa.net/article/201612article_1.html
https://understandcircuit.seesaa.net/article/201701article_8.html
And more here: http://www5b.biglobe.ne.jp/~houshu/synth/

My recollection of hearing 2nd order swept APFs is that notches are closer together.

ElectricDruid

Quote from: Mark Hammer on September 27, 2022, 03:45:02 PM
Sam Hoshuyama has a couple of pages and sample circuits with 2nd order allpass.
https://understandcircuit.seesaa.net/article/201612article_1.html
https://understandcircuit.seesaa.net/article/201701article_8.html
And more here: http://www5b.biglobe.ne.jp/~houshu/synth/
It's been a while since I visited that page, and I'd forgotten what a complete goldmine it is. Amazing stuff. Just lost an hour!!

Quote
My recollection of hearing 2nd order swept APFs is that notches are closer together.
Yes, that fits with what I've seen in my sims. As the Q goes up, the notches get closer together. And if you're going to bother with 2nd order sections, you might as well increase the Q>0.5 because otherwise what's the point?!?

Rob Strand

#6
QuoteMore generally:

    k = 1 / (4*π*Fo*C)
    R2 = 4*k*Q
    R1 = R3= k/Q
    R4 = Q*Q*R1
FWIW,  there's no reason to tie R3 or R4 to the same scaling as R1 and R2 as the divider
is completely independent.

Also, final gain isn't given, as it's not unity.   You can actually eye-ball the low-frequency gain
since it's basically R4/(R3 + R4).  So for your equations that's,
R4/(R3 + R4) = Q*Q*R1 / (R1 + Q*Q*R1) = Q*Q/ (1 + Q*Q)  = 1/(1 + 1/(Q*Q))

So it looks like the R3 and R4 equations are correct.

QuoteThis points out that the gain for this circuit is R4/(R3+R4), so it can't ever reach unity (although as you push the Q up, you get closer) and for my Q=1 case, I get gain of x0.5, which is what I'm seeing. That's slightly disappointing since it'd imply a fair amount of make up gain if you cascaded several of these stages. But it does work and produce a phaser notch, if you use 2:1 weighting for the mixer resistors when you add the dry signal back in.
Yes, Q=1 gives gain of 0.5.

That's the problem with some of these filters, you can't set the gain.  In a few cases you can add more components to generalize the filter.   However, be warned that not all filters have solution for all gains.

I did this compilation of equations and circuits.  It also verifies the response against an all-pass filter made from Sallen and Key Circuit (which I know the equations for) and also against the Q=0.5 case from cascading two first-order all-pass filters.  For completeness I added the RC-CR dual circuit which is not very common but the frequency can be tuned.

For R1 = R2, I'm getting Q=0.5.

Schematics and Equations:

Response Verification:


As far as reference go there's a heap of standard books (Huelssman, Van Valkenburg, Sedra and Bracket) and many more modern books.  They don't always have a solution for each filter.    There's also 100's of papers in the literature, it's pot luck if you find a form that's suitable.   Some papers like Friend's early papers, Sedra 1980 "Optimum configurations for single-amplifier biquadratic filters", give generalized equations.  I tend to fill-in the blanks doing my own calculations.



There seems to be a problem with the image server ATM.


Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

Rob Strand

#7
Here's a re-jig of the all-pass circuit for Q=1 but with equal resistors values.
The idea uses positive feedback to boost the Q to 1 on the equal R, Q0=1/2, circuit.

I took the generalize positive feedback circuit then derived the all-pass conditions with the highest gain.


Schematic


Response verified against Q=1 non equal R circuit.  (I left the Dual RC CR circuit in there, which already had equal R's)

Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

amptramp

Quote from: Mark Hammer on September 27, 2022, 03:45:02 PM
Sam Hoshuyama has a couple of pages and sample circuits with 2nd order allpass.
https://understandcircuit.seesaa.net/article/201612article_1.html
https://understandcircuit.seesaa.net/article/201701article_8.html
And more here: http://www5b.biglobe.ne.jp/~houshu/synth/

My recollection of hearing 2nd order swept APFs is that notches are closer together.

Thanks, I never would have found these on my own!

ElectricDruid

Quote from: Mark Hammer on September 27, 2022, 03:45:02 PM
My recollection of hearing 2nd order swept APFs is that notches are closer together.

One other thing on this point of the notches being closer together;

Mark, you've often said that you consider the sweet spot for guitar phasers to be about 6 stages (e.g. three notches) because beyond that, they start to move out into parts of the spectrum where there isn't much guitar signal energy anyway and therefore not a lot for  notch to work with. Sensible enough. But it occurred to me that there's an implicit assumption of Q=0.5 phase shift stages in this - not unreasonably, given their apparent ubiquity. If you start to use 2nd order stages and increase the Q, the notches get closer together and you can have more notches before they start to go outside the guitar spectrum. It makes quite a difference. In my sim, a standard Q=0.5 phaser with eight of the the typical phase shift stages gave me the lowest notch at 140Hz and the highest at 3.4KHz. For a 2nd order design with Q=1, adjusting the lowest notch to the same 140Hz put the highest notch at 1080Hz, 1.65 octaves lower. I haven't worked out how many extra notches we could get "in the same space" (same frequency range) for given Q values, but it looks like it could be as much as twice as many.

Ok, back to the practical problems of actually doing it...;)


Mark Hammer

That's an interesting proposition, Tom.

I've noted before that Mike Irwin (where IS he?  I miss him.) once demoed for me a 24-stage phaser he made.  Using white noise as his signal source, it sounded spectacular, and strikingly like top-notch flanging.  But of course white noise gives one something to notch-filter nearly everywhere in the audible spectrum.

He also demoed a 3-notch 2-pole allpass phaser.  I couldn't tell you what the Q of the allpass stages was, since it was never discussed.  I might have a schematic of it somewhere, but I think it was in the form of "R1, C1, R2, etc." rather than specific values.

One of the concomitants of "closer" notches is that it *really* focuses attention on where the notches are at the moment.  From an attentional analysis, one of the big differences between phase-shifters and Uni-vibes is that the shallowness and breadth of the "dips" that a Vibe yields allow attention to be diverted from the modulation itself to the melody/notes being played.  In contrast, phasers - especially with a bit of feedback to increase resonance - almost force attention to be fixated on the current location of the notches in the spectrum (unless modulation speed is fast enough to simply lose track).  Not that 4 closely-space notches could NOT sound interesting, musical, aurally pleasing, and quite audible across the entire sweep cycle, but upping the Q a bit would likely RIVET one's attention.  I suppose that could be bad OR good, depending on the application and mix.  I'm sure Alex Lifeson could make it sound good, and maybe Joe Satriani as well, but there's a whole lot of players for whom it might be disruptive and distracting.

ElectricDruid

Here's one interesting possibility with 2nd order stages. This is a 4-notch SVF-based phaser. It uses the AP=2LP+2HP-1 formula to create phase shift stages, since those give constant gain with changing Q, unlike the bandpass output - another possible formula would be AP=1-2BP. Obviously the circuit is a monster since each stage is four op-amps, plus pwm switches to control it, but the SVF is a very solid design and not fussy about tolerances, so it should be simple and reliable to build. Just a question of space.

Anyway, as you vary the Q, the notches spread out and get closer together.  Rather than sweeping everything up and down, two go up, two go down, and the spacing changes. Compare the red or orange traces to the green or cyan to see what's going on. I'd like to hear what this sounds like.


anotherjim

Seems like a job for daughter boards to me. If your SVF stage circuit is ready, make a bunch of them on their own boards with breadboard-friendly connectors and try it.

StephenGiles

I found a couple of samples Mike Irwin did of his one BBD TZ Flanger - slightly off topic I know, but I'm trying to find some Mike Irwin stuff on phasers I saved years ago.

https://www.dropbox.com/s/2xv2vfzqh5ma2a2/TZ-5.mp3?dl=0
https://www.dropbox.com/s/vv35c289cn71v37/TZ-6.mp3?dl=0
"I want my meat burned, like St Joan. Bring me pickles and vicious mustards to pierce the tongue like Cardigan's Lancers.".

puretube

Quote from: StephenGiles on October 01, 2022, 05:10:50 PM
I found a couple of samples Mike Irwin did of his one BBD TZ Flanger - slightly off topic I know, but I'm trying to find some Mike Irwin stuff on phasers I saved years ago.

https://www.dropbox.com/s/2xv2vfzqh5ma2a2/TZ-5.mp3?dl=0
https://www.dropbox.com/s/vv35c289cn71v37/TZ-6.mp3?dl=0
Guess I need to try to fire up this little thing that I found yesterday again, to see/listen what the heck I`ve done there, a long while ago with 6 discreet phaseshiftstages + a quadrature LFO ... (can`t remember).