Mike Moser-Booth mmoserbooth at gmail.com
Mon Oct 7 02:06:10 CEST 2013

```Yeah, my [filterplot.mmb] abstraction actually wraps the phase to -pi to pi
and scales that to -1 to 1. I don't remember why I did the scaling. ;-)
Also, I don't know if it matters with how you're analyzing [phaseshift~],
but the frequency axis is non-linear. You can change it by sending a
[linfreq 1( message (I think I forgot to put that in the helpfile).

You're right that a second-order filter doesn't necessarily mean it is a
biquad structure, but as long as it is a linear filter, you can recreate
any second-order filter using a biquad. You just put in 0 for the
coefficients you aren't using. However, second-order all-pass filters are
likely going to be biquads, since the feedforward and feedback coefficients
will be inverses of each other (i.e. b0 = a2, b1 = a1, b2 = a0).

Anyway, I don't have access to Max these, so I can't really look at it.
There is this filter described here (
https://ccrma.stanford.edu/~jos/pasp/Phasing_2nd_Order_Allpass_Filters.html)
that gives a response similar to what you described with f = 4kHz and R =
.1, but I don't think that's the one given what it says in the
[phaseshift~] reference page. The paper describe this filter says R should
be exp(-pi * bandwidth / samplerate), and that usually results in .5 < R <
1.

Hope that helps at all.
.mmb

On Sat, Oct 5, 2013 at 7:14 PM, Alexandre Torres Porres <porres at gmail.com>wrote:

> hi mmb, thanks for showing up :)
>
> hmmmm, my problem was that the phase response graph generated from your Pd
> patch based on RBJ looks different than the one from max's phaseshift. But
> it just occurred to me that one thing about it might only be a matter of
> normalizing it and displaying in the same way.
>
> For example, your patch gives us a drop from 0 to -1 and then from 1 to 0,
> while phaseshift in Max is from 0 to -2pi continuously. I'm now considering
> that both behaviours could be related, only that your patch "wraps" it
> around -1 back to 1. What do you think?
>
> But even so, there's also the issue of getting the Q parameter to behave
> in the same way. Max's phaseshift, when set to Q = 0.1 and freq = 4KHz will
> give you a linear drop from 0 to -2pi. Now, I can't seem to get that based
> on RBJ's cookbook formulas and your patch. But then, another thing I
> haven't thought of might be a difference in the scale plot...
>
> One way or another, the Q parameter seems off.
>
> So, as you can see, there are these plotting differences, but I know what
> you mean, that is what I was suspecting too, it sure looks like the same
> thing at a first glance, meaning you can get to it from a biquad
> coefficient perspective. The problem is that max's phaseshift isn't very
> clear about what it really is, other than saying it is a second order
> filter. But that doesn't have to imply it is the same as a second order
>
> Thanks
>
>
> 2013/10/5 Mike Moser-Booth <mmoserbooth at gmail.com>
>
>> From looking at the helpfile for [phaseshift~], this sounds very much
>> like the all-pass filter from Robert Bristow-Johnson's EQ Cookbook. You can
>> calculate the biquad coefficients for it like this:
>>
>> w0 = 2*pi*frequency_in_Hz / sample_rate
>> alpha = sin(w0)*sinh(ln(2)/2*Q*w0/sin(w0))
>>
>> fb1 = 2*cos(w0) / (1+alpha)
>> fb2 = (-1+alpha) / (1+alpha)
>> ff1 = -fb2
>> ff2 = -fb1
>> ff3 = 1
>>
>> .mmb
>>
>>
>> On Sat, Oct 5, 2013 at 12:31 PM, Alexandre Torres Porres <
>> porres at gmail.com> wrote:
>>
>>> > the phase response given in phaseshift's help file suggest otherwise.
>>>
>>> it's more like the response from miller's H14 example...
>>>
>>> So I guess you can have a 2nd order one (lie phaseshift) by putting two
>>> of these together, right? And I suspect it doesn't really need to have
>>> anything to do biquad just for being "2nd order", huh?
>>>
>>> cheers
>>>
>>>
>>> 2013/10/5 Alexandre Torres Porres <porres at gmail.com>
>>>
>>>> Anyway, next on my list is finding out how to implement max's
>>>> [phaseshift~], which is also an allpass filter. There's no Pd clone for it
>>>> so it seems, right?
>>>>
>>>> Well, it doesn't really what it is other than a 2nd order filter. From
>>>> that I could think you can generate it with [biquad~], but the phase
>>>> response given in phaseshift's help file suggest otherwise.
>>>>
>>>> any contributions welcome
>>>>
>>>> thanks a lot
>>>>
>>>> 2013/10/5 Alexandre Torres Porres <porres at gmail.com>
>>>>
>>>>> but this way it won't be the same as cyclone's [allpass~], the way I
>>>>> did it is equivalent to it (and max's).
>>>>>
>>>>> cheers
>>>>>
>>>>>
>>>>> 2013/10/3 Chris Clepper <cgclepper at gmail.com>
>>>>>
>>>>>> You only need one delay line for the allpass.
>>>>>>
>>>>>> feedforward = input * -gain
>>>>>> feedback = delayout * gain
>>>>>> delayin = input + feedback
>>>>>> output = delayout + feedforward
>>>>>>
>>>>>> http://www.spinsemi.com/knowledge_base/effects.html#Reverberation
>>>>>>
>>>>>>
>>>>>> On Thu, Oct 3, 2013 at 11:29 AM, Alexandre Torres Porres <
>>>>>> porres at gmail.com> wrote:
>>>>>>
>>>>>>> i hope i guess i figured it out on how to implement it with delay
>>>>>>> lines. see attachment. And I realize you can't do this with [fexpr~] or
>>>>>>> [biquad~] because the sample delay length is kinda big for that, right?
>>>>>>>
>>>>>>> cheers
>>>>>>>
>>>>>>>
>>>>>>> 2013/10/3 Alexandre Torres Porres <porres at gmail.com>
>>>>>>>
>>>>>>>> cool, but do you know how to implement cyclone's [allpass~] with
>>>>>>>> it?
>>>>>>>>
>>>>>>>> It's really unclear to me what is the relation of this pass filter
>>>>>>>> with the one you can generate with biquad coefficients, or with raw
>>>>>>>> poles/zeros objects for that matter.
>>>>>>>>
>>>>>>>> Well, one way or another, it's also unclear to me how to do it with
>>>>>>>> delay lines.
>>>>>>>>
>>>>>>>> seems that it is related to a comb filter, right?
>>>>>>>>
>>>>>>>> cheers
>>>>>>>>
>>>>>>>>
>>>>>>>> 2013/10/2 Chris Clepper <cgclepper at gmail.com>
>>>>>>>>
>>>>>>>>> Allpass for reverb is easy to do with delwrite~ and vd~.  I used
>>>>>>>>> 32 of them today to recreate a famous 'deep space' reverb.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Wed, Oct 2, 2013 at 1:53 AM, Alexandre Torres Porres <
>>>>>>>>> porres at gmail.com> wrote:
>>>>>>>>>
>>>>>>>>>> hi there, i see the biquad's coefficients can be set as an
>>>>>>>>>> allpass filter, generated by frequency and "Q" parameters. But can it do
>>>>>>>>>> the same as cyclone's [allpass~] filer? If yes, them how since the
>>>>>>>>>> parameters for [allpass~] are different (delaytime and such).
>>>>>>>>>>
>>>>>>>>>> One way or another, I guess that my real question is: how to
>>>>>>>>>> implement [allpass~] from vanilla objects?
>>>>>>>>>>
>>>>>>>>>> thanks
>>>>>>>>>>
>>>>>>>>>> _______________________________________________
>>>>>>>>>> Pd-list at iem.at mailing list
>>>>>>>>>> UNSUBSCRIBE and account-management ->
>>>>>>>>>> http://lists.puredata.info/listinfo/pd-list
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>> _______________________________________________
>>> Pd-list at iem.at mailing list
>>> UNSUBSCRIBE and account-management ->
>>> http://lists.puredata.info/listinfo/pd-list
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20131006/f9b5e434/attachment-0001.htm>
```