Csound Csound-dev Csound-tekno Search About

[Csnd] all-pass filters

Date2020-06-02 18:34
FromGuillermo Senna
Subject[Csnd] all-pass filters
Hi,

First of all, do you always use a 1-sample delay with a first-order
all-pass filter or can you change the delay time like Schroeder did in
his all-pass sections? Also, can anyone tell me of a way to compute the
gain coefficient for a specific cutoff frequency? I can shift a sine
wave 90 degrees through trial and error, but maybe there's an equation?
It tried this one with the 1-sample delay, but I don't see any phase
shift in the sine wave:

g = (1 − tan( π * fc / sr )) / (1 + tan( π * fc / sr ))

Cheers.

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2020-06-02 23:48
FromVictor Lazzarini
SubjectRe: [Csnd] [EXTERNAL] [Csnd] all-pass filters
If it's a first-order filter, the delay is a single sample. Higher-order allpass filters will
have longer delays. 

Generally you set the filter coefficient according to the fractional delay you want to achieve (g = (1 - d)/(1 + d)). Since the allpass has a nonlinear phase response, this delay is only approximated in the lower part of the spectrum, but it's enough for the applications of tuning a delay line, for example.

If you want 90 degrees shift across the spectrum you need a hilbert transform.
That can be achieved with an allpass filter, but not a first order one. The one used in Csound is a pair of sixth order filters I think.

You can do it as an FIR as well using DFT,
and removing the negative spectrum. The output is then a complex signal in quadrature (called an analytic signal).

HTH

Prof. Victor Lazzarini
Maynooth University
Ireland

> On 2 Jun 2020, at 18:34, Guillermo Senna  wrote:
> 
> *Warning*
> 
> This email originated from outside of Maynooth University's Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.
> 
> Hi,
> 
> First of all, do you always use a 1-sample delay with a first-order
> all-pass filter or can you change the delay time like Schroeder did in
> his all-pass sections? Also, can anyone tell me of a way to compute the
> gain coefficient for a specific cutoff frequency? I can shift a sine
> wave 90 degrees through trial and error, but maybe there's an equation?
> It tried this one with the 1-sample delay, but I don't see any phase
> shift in the sine wave:
> 
> g = (1 − tan( π * fc / sr )) / (1 + tan( π * fc / sr ))
> 
> Cheers.
> 
> Csound mailing list
> Csound@listserv.heanet.ie
> https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flistserv.heanet.ie%2Fcgi-bin%2Fwa%3FA0%3DCSOUND&data=02%7C01%7CVictor.Lazzarini%40mu.ie%7C6ed0a99938044186611508d8071b4092%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637267160917472481&sdata=1wLoSA%2BiHEQRrxprfkCWEGKAxQFGGVPvdzOk3enuMv4%3D&reserved=0
> Send bugs reports to
>        https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcsound%2Fcsound%2Fissues&data=02%7C01%7CVictor.Lazzarini%40mu.ie%7C6ed0a99938044186611508d8071b4092%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637267160917472481&sdata=3LGmo75iWtWD9Fn569UR8ywFRh4oxdSZaDFBiRA8oss%3D&reserved=0
> Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2020-06-03 17:56
FromGuillermo Senna
SubjectRe: [Csnd] [EXTERNAL] [Csnd] all-pass filters
Thanks, Victor. That helped. What happened was that I read about some
all-pass plugin effects that had a knob for selecting the "cutoff
frequency" of the filter, defined as the frequency where the phase shift
equals 90° degrees. I was wondering how to find that. But from what you
wrote I see that that is not what's used in an all-pass interpolator and
that's probably why I'm not finding the equation.

Cheers.

On 2/6/20 19:48, Victor Lazzarini wrote:
> If it's a first-order filter, the delay is a single sample. Higher-order allpass filters will
> have longer delays. 
>
> Generally you set the filter coefficient according to the fractional delay you want to achieve (g = (1 - d)/(1 + d)). Since the allpass has a nonlinear phase response, this delay is only approximated in the lower part of the spectrum, but it's enough for the applications of tuning a delay line, for example.
>
> If you want 90 degrees shift across the spectrum you need a hilbert transform.
> That can be achieved with an allpass filter, but not a first order one. The one used in Csound is a pair of sixth order filters I think.
>
> You can do it as an FIR as well using DFT,
> and removing the negative spectrum. The output is then a complex signal in quadrature (called an analytic signal).
>
> HTH
>
> Prof. Victor Lazzarini
> Maynooth University
> Ireland
>
>> On 2 Jun 2020, at 18:34, Guillermo Senna  wrote:
>>
>> *Warning*
>>
>> This email originated from outside of Maynooth University's Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.
>>
>> Hi,
>>
>> First of all, do you always use a 1-sample delay with a first-order
>> all-pass filter or can you change the delay time like Schroeder did in
>> his all-pass sections? Also, can anyone tell me of a way to compute the
>> gain coefficient for a specific cutoff frequency? I can shift a sine
>> wave 90 degrees through trial and error, but maybe there's an equation?
>> It tried this one with the 1-sample delay, but I don't see any phase
>> shift in the sine wave:
>>
>> g = (1 − tan( π * fc / sr )) / (1 + tan( π * fc / sr ))
>>
>> Cheers.
>>
>> Csound mailing list
>> Csound@listserv.heanet.ie
>> https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flistserv.heanet.ie%2Fcgi-bin%2Fwa%3FA0%3DCSOUND&data=02%7C01%7CVictor.Lazzarini%40mu.ie%7C6ed0a99938044186611508d8071b4092%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637267160917472481&sdata=1wLoSA%2BiHEQRrxprfkCWEGKAxQFGGVPvdzOk3enuMv4%3D&reserved=0
>> Send bugs reports to
>>        https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcsound%2Fcsound%2Fissues&data=02%7C01%7CVictor.Lazzarini%40mu.ie%7C6ed0a99938044186611508d8071b4092%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637267160917472481&sdata=3LGmo75iWtWD9Fn569UR8ywFRh4oxdSZaDFBiRA8oss%3D&reserved=0
>> Discussions of bugs and features can be posted here
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>         https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2020-06-03 18:25
FromVictor Lazzarini
SubjectRe: [Csnd] [EXTERNAL] [Csnd] all-pass filters
Ah, you probably want second-order allpass filters like we use in phasers.
========================
Prof. Victor Lazzarini
Maynooth University
Ireland

> On 3 Jun 2020, at 17:56, Guillermo Senna  wrote:
> 
> Thanks, Victor. That helped. What happened was that I read about some
> all-pass plugin effects that had a knob for selecting the "cutoff
> frequency" of the filter, defined as the frequency where the phase shift
> equals 90° degrees. I was wondering how to find that. But from what you
> wrote I see that that is not what's used in an all-pass interpolator and
> that's probably why I'm not finding the equation.
> 
> Cheers.
> 
> On 2/6/20 19:48, Victor Lazzarini wrote:
>> If it's a first-order filter, the delay is a single sample. Higher-order allpass filters will
>> have longer delays. 
>> 
>> Generally you set the filter coefficient according to the fractional delay you want to achieve (g = (1 - d)/(1 + d)). Since the allpass has a nonlinear phase response, this delay is only approximated in the lower part of the spectrum, but it's enough for the applications of tuning a delay line, for example.
>> 
>> If you want 90 degrees shift across the spectrum you need a hilbert transform.
>> That can be achieved with an allpass filter, but not a first order one. The one used in Csound is a pair of sixth order filters I think.
>> 
>> You can do it as an FIR as well using DFT,
>> and removing the negative spectrum. The output is then a complex signal in quadrature (called an analytic signal).
>> 
>> HTH
>> 
>> Prof. Victor Lazzarini
>> Maynooth University
>> Ireland
>> 
>>> On 2 Jun 2020, at 18:34, Guillermo Senna  wrote:
>>> 
>>> *Warning*
>>> 
>>> This email originated from outside of Maynooth University's Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.
>>> 
>>> Hi,
>>> 
>>> First of all, do you always use a 1-sample delay with a first-order
>>> all-pass filter or can you change the delay time like Schroeder did in
>>> his all-pass sections? Also, can anyone tell me of a way to compute the
>>> gain coefficient for a specific cutoff frequency? I can shift a sine
>>> wave 90 degrees through trial and error, but maybe there's an equation?
>>> It tried this one with the 1-sample delay, but I don't see any phase
>>> shift in the sine wave:
>>> 
>>> g = (1 − tan( π * fc / sr )) / (1 + tan( π * fc / sr ))
>>> 
>>> Cheers.
>>> 
>>> Csound mailing list
>>> Csound@listserv.heanet.ie
>>> https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flistserv.heanet.ie%2Fcgi-bin%2Fwa%3FA0%3DCSOUND&data=02%7C01%7CVictor.Lazzarini%40mu.ie%7C75c741b90c30463f0e0308d807df1e91%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637268002155122108&sdata=%2FXdIT2g7vCvKO72crb11jGxbtrRHLCNq9xPX3m%2FDhAI%3D&reserved=0
>>> Send bugs reports to
>>>       https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcsound%2Fcsound%2Fissues&data=02%7C01%7CVictor.Lazzarini%40mu.ie%7C75c741b90c30463f0e0308d807df1e91%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637268002155122108&sdata=sEA%2FUWRAktZQWNP56aVtPPQTlOG3y0w1ErSp%2BMk%2FKPU%3D&reserved=0
>>> Discussions of bugs and features can be posted here
>> Csound mailing list
>> Csound@listserv.heanet.ie
>> https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flistserv.heanet.ie%2Fcgi-bin%2Fwa%3FA0%3DCSOUND&data=02%7C01%7CVictor.Lazzarini%40mu.ie%7C75c741b90c30463f0e0308d807df1e91%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637268002155122108&sdata=%2FXdIT2g7vCvKO72crb11jGxbtrRHLCNq9xPX3m%2FDhAI%3D&reserved=0
>> Send bugs reports to
>>        https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcsound%2Fcsound%2Fissues&data=02%7C01%7CVictor.Lazzarini%40mu.ie%7C75c741b90c30463f0e0308d807df1e91%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637268002155122108&sdata=sEA%2FUWRAktZQWNP56aVtPPQTlOG3y0w1ErSp%2BMk%2FKPU%3D&reserved=0
>> Discussions of bugs and features can be posted here
> 
> Csound mailing list
> Csound@listserv.heanet.ie
> https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flistserv.heanet.ie%2Fcgi-bin%2Fwa%3FA0%3DCSOUND&data=02%7C01%7CVictor.Lazzarini%40mu.ie%7C75c741b90c30463f0e0308d807df1e91%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637268002155122108&sdata=%2FXdIT2g7vCvKO72crb11jGxbtrRHLCNq9xPX3m%2FDhAI%3D&reserved=0
> Send bugs reports to
>        https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcsound%2Fcsound%2Fissues&data=02%7C01%7CVictor.Lazzarini%40mu.ie%7C75c741b90c30463f0e0308d807df1e91%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637268002155122108&sdata=sEA%2FUWRAktZQWNP56aVtPPQTlOG3y0w1ErSp%2BMk%2FKPU%3D&reserved=0
> Discussions of bugs and features can be posted here


Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2020-06-03 20:58
FromGuillermo Senna
SubjectRe: [Csnd] [EXTERNAL] [Csnd] all-pass filters
But then I guess the "cutoff freq" would be the frequency with a 180°
phase shift. Anyway, I think I intuitively understand now what's going
on with the APF coefficient. For those interested, I made a plugin with
Cabbage and then used a Phase/Freq Wheel to see the effect a 1st order
APF has over the phase of a pulse. Here's a clip:

https://drive.google.com/file/d/1xLOQn2Xr7iO-A5ZYcuR7k7dKKO-T70dQ/view?usp=sharing

Bigger radius means higher frequency and then 12 o'clock is 0° degrees,
3 o'clock is 90° and 6 o'clock is 180° of phase shift.

So, when the gain coefficient is set to -1 all frequencies have 0° phase
distortion (except probably Nyquist?). From then on, moving the slider
towards 1 starts shifting -the higher frequencies first- towards a
complete phase inversion. The original question is then what's the
equation for finding the coefficient to get a specific frequency at 3
o'clock.

Cheers.


On 3/6/20 14:25, Victor Lazzarini wrote:
> Ah, you probably want second-order allpass filters like we use in phasers.
> ========================
> Prof. Victor Lazzarini
> Maynooth University
> Ireland
>
>> On 3 Jun 2020, at 17:56, Guillermo Senna  wrote:
>>
>> Thanks, Victor. That helped. What happened was that I read about some
>> all-pass plugin effects that had a knob for selecting the "cutoff
>> frequency" of the filter, defined as the frequency where the phase shift
>> equals 90° degrees. I was wondering how to find that. But from what you
>> wrote I see that that is not what's used in an all-pass interpolator and
>> that's probably why I'm not finding the equation.
>>
>> Cheers.
>>
>> On 2/6/20 19:48, Victor Lazzarini wrote:
>>> If it's a first-order filter, the delay is a single sample. Higher-order allpass filters will
>>> have longer delays. 
>>>
>>> Generally you set the filter coefficient according to the fractional delay you want to achieve (g = (1 - d)/(1 + d)). Since the allpass has a nonlinear phase response, this delay is only approximated in the lower part of the spectrum, but it's enough for the applications of tuning a delay line, for example.
>>>
>>> If you want 90 degrees shift across the spectrum you need a hilbert transform.
>>> That can be achieved with an allpass filter, but not a first order one. The one used in Csound is a pair of sixth order filters I think.
>>>
>>> You can do it as an FIR as well using DFT,
>>> and removing the negative spectrum. The output is then a complex signal in quadrature (called an analytic signal).
>>>
>>> HTH
>>>
>>> Prof. Victor Lazzarini
>>> Maynooth University
>>> Ireland
>>>
>>>> On 2 Jun 2020, at 18:34, Guillermo Senna  wrote:
>>>>
>>>> *Warning*
>>>>
>>>> This email originated from outside of Maynooth University's Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.
>>>>
>>>> Hi,
>>>>
>>>> First of all, do you always use a 1-sample delay with a first-order
>>>> all-pass filter or can you change the delay time like Schroeder did in
>>>> his all-pass sections? Also, can anyone tell me of a way to compute the
>>>> gain coefficient for a specific cutoff frequency? I can shift a sine
>>>> wave 90 degrees through trial and error, but maybe there's an equation?
>>>> It tried this one with the 1-sample delay, but I don't see any phase
>>>> shift in the sine wave:
>>>>
>>>> g = (1 − tan( π * fc / sr )) / (1 + tan( π * fc / sr ))
>>>>
>>>> Cheers.
>>>>
>>>> Csound mailing list
>>>> Csound@listserv.heanet.ie
>>>> https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flistserv.heanet.ie%2Fcgi-bin%2Fwa%3FA0%3DCSOUND&data=02%7C01%7CVictor.Lazzarini%40mu.ie%7C75c741b90c30463f0e0308d807df1e91%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637268002155122108&sdata=%2FXdIT2g7vCvKO72crb11jGxbtrRHLCNq9xPX3m%2FDhAI%3D&reserved=0
>>>> Send bugs reports to
>>>>       https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcsound%2Fcsound%2Fissues&data=02%7C01%7CVictor.Lazzarini%40mu.ie%7C75c741b90c30463f0e0308d807df1e91%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637268002155122108&sdata=sEA%2FUWRAktZQWNP56aVtPPQTlOG3y0w1ErSp%2BMk%2FKPU%3D&reserved=0
>>>> Discussions of bugs and features can be posted here
>>> Csound mailing list
>>> Csound@listserv.heanet.ie
>>> https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flistserv.heanet.ie%2Fcgi-bin%2Fwa%3FA0%3DCSOUND&data=02%7C01%7CVictor.Lazzarini%40mu.ie%7C75c741b90c30463f0e0308d807df1e91%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637268002155122108&sdata=%2FXdIT2g7vCvKO72crb11jGxbtrRHLCNq9xPX3m%2FDhAI%3D&reserved=0
>>> Send bugs reports to
>>>        https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcsound%2Fcsound%2Fissues&data=02%7C01%7CVictor.Lazzarini%40mu.ie%7C75c741b90c30463f0e0308d807df1e91%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637268002155122108&sdata=sEA%2FUWRAktZQWNP56aVtPPQTlOG3y0w1ErSp%2BMk%2FKPU%3D&reserved=0
>>> Discussions of bugs and features can be posted here
>> Csound mailing list
>> Csound@listserv.heanet.ie
>> https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flistserv.heanet.ie%2Fcgi-bin%2Fwa%3FA0%3DCSOUND&data=02%7C01%7CVictor.Lazzarini%40mu.ie%7C75c741b90c30463f0e0308d807df1e91%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637268002155122108&sdata=%2FXdIT2g7vCvKO72crb11jGxbtrRHLCNq9xPX3m%2FDhAI%3D&reserved=0
>> Send bugs reports to
>>        https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcsound%2Fcsound%2Fissues&data=02%7C01%7CVictor.Lazzarini%40mu.ie%7C75c741b90c30463f0e0308d807df1e91%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637268002155122108&sdata=sEA%2FUWRAktZQWNP56aVtPPQTlOG3y0w1ErSp%2BMk%2FKPU%3D&reserved=0
>> Discussions of bugs and features can be posted here
>
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>         https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2020-06-04 00:08
FromGuillermo Senna
SubjectRe: [Csnd] [EXTERNAL] [Csnd] all-pass filters
Solved! I just had the plus and minus sign inverted in the all-pass.
This is the right equation for finding the cutoff frequency:

g = (tan( π * fc / sr ) - 1) / (tan( π * fc / sr ) + 1)


Cheers.

On 3/6/20 14:25, Victor Lazzarini wrote:
> Ah, you probably want second-order allpass filters like we use in phasers.
> ========================
> Prof. Victor Lazzarini
> Maynooth University
> Ireland
>
>> On 3 Jun 2020, at 17:56, Guillermo Senna  wrote:
>>
>> Thanks, Victor. That helped. What happened was that I read about some
>> all-pass plugin effects that had a knob for selecting the "cutoff
>> frequency" of the filter, defined as the frequency where the phase shift
>> equals 90° degrees. I was wondering how to find that. But from what you
>> wrote I see that that is not what's used in an all-pass interpolator and
>> that's probably why I'm not finding the equation.
>>
>> Cheers.
>>
>> On 2/6/20 19:48, Victor Lazzarini wrote:
>>> If it's a first-order filter, the delay is a single sample. Higher-order allpass filters will
>>> have longer delays. 
>>>
>>> Generally you set the filter coefficient according to the fractional delay you want to achieve (g = (1 - d)/(1 + d)). Since the allpass has a nonlinear phase response, this delay is only approximated in the lower part of the spectrum, but it's enough for the applications of tuning a delay line, for example.
>>>
>>> If you want 90 degrees shift across the spectrum you need a hilbert transform.
>>> That can be achieved with an allpass filter, but not a first order one. The one used in Csound is a pair of sixth order filters I think.
>>>
>>> You can do it as an FIR as well using DFT,
>>> and removing the negative spectrum. The output is then a complex signal in quadrature (called an analytic signal).
>>>
>>> HTH
>>>
>>> Prof. Victor Lazzarini
>>> Maynooth University
>>> Ireland
>>>
>>>> On 2 Jun 2020, at 18:34, Guillermo Senna  wrote:
>>>>
>>>> *Warning*
>>>>
>>>> This email originated from outside of Maynooth University's Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.
>>>>
>>>> Hi,
>>>>
>>>> First of all, do you always use a 1-sample delay with a first-order
>>>> all-pass filter or can you change the delay time like Schroeder did in
>>>> his all-pass sections? Also, can anyone tell me of a way to compute the
>>>> gain coefficient for a specific cutoff frequency? I can shift a sine
>>>> wave 90 degrees through trial and error, but maybe there's an equation?
>>>> It tried this one with the 1-sample delay, but I don't see any phase
>>>> shift in the sine wave:
>>>>
>>>> g = (1 − tan( π * fc / sr )) / (1 + tan( π * fc / sr ))
>>>>
>>>> Cheers.
>>>>
>>>> Csound mailing list
>>>> Csound@listserv.heanet.ie
>>>> https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flistserv.heanet.ie%2Fcgi-bin%2Fwa%3FA0%3DCSOUND&data=02%7C01%7CVictor.Lazzarini%40mu.ie%7C75c741b90c30463f0e0308d807df1e91%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637268002155122108&sdata=%2FXdIT2g7vCvKO72crb11jGxbtrRHLCNq9xPX3m%2FDhAI%3D&reserved=0
>>>> Send bugs reports to
>>>>       https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcsound%2Fcsound%2Fissues&data=02%7C01%7CVictor.Lazzarini%40mu.ie%7C75c741b90c30463f0e0308d807df1e91%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637268002155122108&sdata=sEA%2FUWRAktZQWNP56aVtPPQTlOG3y0w1ErSp%2BMk%2FKPU%3D&reserved=0
>>>> Discussions of bugs and features can be posted here
>>> Csound mailing list
>>> Csound@listserv.heanet.ie
>>> https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flistserv.heanet.ie%2Fcgi-bin%2Fwa%3FA0%3DCSOUND&data=02%7C01%7CVictor.Lazzarini%40mu.ie%7C75c741b90c30463f0e0308d807df1e91%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637268002155122108&sdata=%2FXdIT2g7vCvKO72crb11jGxbtrRHLCNq9xPX3m%2FDhAI%3D&reserved=0
>>> Send bugs reports to
>>>        https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcsound%2Fcsound%2Fissues&data=02%7C01%7CVictor.Lazzarini%40mu.ie%7C75c741b90c30463f0e0308d807df1e91%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637268002155122108&sdata=sEA%2FUWRAktZQWNP56aVtPPQTlOG3y0w1ErSp%2BMk%2FKPU%3D&reserved=0
>>> Discussions of bugs and features can be posted here
>> Csound mailing list
>> Csound@listserv.heanet.ie
>> https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flistserv.heanet.ie%2Fcgi-bin%2Fwa%3FA0%3DCSOUND&data=02%7C01%7CVictor.Lazzarini%40mu.ie%7C75c741b90c30463f0e0308d807df1e91%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637268002155122108&sdata=%2FXdIT2g7vCvKO72crb11jGxbtrRHLCNq9xPX3m%2FDhAI%3D&reserved=0
>> Send bugs reports to
>>        https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcsound%2Fcsound%2Fissues&data=02%7C01%7CVictor.Lazzarini%40mu.ie%7C75c741b90c30463f0e0308d807df1e91%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637268002155122108&sdata=sEA%2FUWRAktZQWNP56aVtPPQTlOG3y0w1ErSp%2BMk%2FKPU%3D&reserved=0
>> Discussions of bugs and features can be posted here
>
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>         https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2020-06-04 08:03
FromVictor Lazzarini
SubjectRe: [Csnd] [EXTERNAL] [Csnd] all-pass filters
Ah, now I see what you meant when you were asking about a "cutoff" frequency. 

Prof. Victor Lazzarini
Maynooth University
Ireland

> On 4 Jun 2020, at 00:08, Guillermo Senna  wrote:
> 
> Solved! I just had the plus and minus sign inverted in the all-pass.
> This is the right equation for finding the cutoff frequency:
> 
> g = (tan( π * fc / sr ) - 1) / (tan( π * fc / sr ) + 1)
> 
> 
> Cheers.
> 
>> On 3/6/20 14:25, Victor Lazzarini wrote:
>> Ah, you probably want second-order allpass filters like we use in phasers.
>> ========================
>> Prof. Victor Lazzarini
>> Maynooth University
>> Ireland
>> 
>>>> On 3 Jun 2020, at 17:56, Guillermo Senna  wrote:
>>> 
>>> Thanks, Victor. That helped. What happened was that I read about some
>>> all-pass plugin effects that had a knob for selecting the "cutoff
>>> frequency" of the filter, defined as the frequency where the phase shift
>>> equals 90° degrees. I was wondering how to find that. But from what you
>>> wrote I see that that is not what's used in an all-pass interpolator and
>>> that's probably why I'm not finding the equation.
>>> 
>>> Cheers.
>>> 
>>> On 2/6/20 19:48, Victor Lazzarini wrote:
>>>> If it's a first-order filter, the delay is a single sample. Higher-order allpass filters will
>>>> have longer delays. 
>>>> 
>>>> Generally you set the filter coefficient according to the fractional delay you want to achieve (g = (1 - d)/(1 + d)). Since the allpass has a nonlinear phase response, this delay is only approximated in the lower part of the spectrum, but it's enough for the applications of tuning a delay line, for example.
>>>> 
>>>> If you want 90 degrees shift across the spectrum you need a hilbert transform.
>>>> That can be achieved with an allpass filter, but not a first order one. The one used in Csound is a pair of sixth order filters I think.
>>>> 
>>>> You can do it as an FIR as well using DFT,
>>>> and removing the negative spectrum. The output is then a complex signal in quadrature (called an analytic signal).
>>>> 
>>>> HTH
>>>> 
>>>> Prof. Victor Lazzarini
>>>> Maynooth University
>>>> Ireland
>>>> 
>>>>> On 2 Jun 2020, at 18:34, Guillermo Senna  wrote:
>>>>> 
>>>>> *Warning*
>>>>> 
>>>>> This email originated from outside of Maynooth University's Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.
>>>>> 
>>>>> Hi,
>>>>> 
>>>>> First of all, do you always use a 1-sample delay with a first-order
>>>>> all-pass filter or can you change the delay time like Schroeder did in
>>>>> his all-pass sections? Also, can anyone tell me of a way to compute the
>>>>> gain coefficient for a specific cutoff frequency? I can shift a sine
>>>>> wave 90 degrees through trial and error, but maybe there's an equation?
>>>>> It tried this one with the 1-sample delay, but I don't see any phase
>>>>> shift in the sine wave:
>>>>> 
>>>>> g = (1 − tan( π * fc / sr )) / (1 + tan( π * fc / sr ))
>>>>> 
>>>>> Cheers.
>>>>> 
>>>>> Csound mailing list
>>>>> Csound@listserv.heanet.ie
>>>>> https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flistserv.heanet.ie%2Fcgi-bin%2Fwa%3FA0%3DCSOUND&data=02%7C01%7CVictor.Lazzarini%40mu.ie%7C19d38950ae5d4fca63d108d80813052c%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637268225071229463&sdata=LfIjxUOWorFpirdrxHflC3zxWQJyZVDiip7gEn%2Fvnl0%3D&reserved=0
>>>>> Send bugs reports to
>>>>>      https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcsound%2Fcsound%2Fissues&data=02%7C01%7CVictor.Lazzarini%40mu.ie%7C19d38950ae5d4fca63d108d80813052c%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637268225071229463&sdata=otxRb8uMmothEvYi60FCmUM1yiSS7a04C9upyw0FUOo%3D&reserved=0
>>>>> Discussions of bugs and features can be posted here
>>>> Csound mailing list
>>>> Csound@listserv.heanet.ie
>>>> https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flistserv.heanet.ie%2Fcgi-bin%2Fwa%3FA0%3DCSOUND&data=02%7C01%7CVictor.Lazzarini%40mu.ie%7C19d38950ae5d4fca63d108d80813052c%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637268225071229463&sdata=LfIjxUOWorFpirdrxHflC3zxWQJyZVDiip7gEn%2Fvnl0%3D&reserved=0
>>>> Send bugs reports to
>>>>       https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcsound%2Fcsound%2Fissues&data=02%7C01%7CVictor.Lazzarini%40mu.ie%7C19d38950ae5d4fca63d108d80813052c%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637268225071229463&sdata=otxRb8uMmothEvYi60FCmUM1yiSS7a04C9upyw0FUOo%3D&reserved=0
>>>> Discussions of bugs and features can be posted here
>>> Csound mailing list
>>> Csound@listserv.heanet.ie
>>> https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flistserv.heanet.ie%2Fcgi-bin%2Fwa%3FA0%3DCSOUND&data=02%7C01%7CVictor.Lazzarini%40mu.ie%7C19d38950ae5d4fca63d108d80813052c%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637268225071229463&sdata=LfIjxUOWorFpirdrxHflC3zxWQJyZVDiip7gEn%2Fvnl0%3D&reserved=0
>>> Send bugs reports to
>>>       https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcsound%2Fcsound%2Fissues&data=02%7C01%7CVictor.Lazzarini%40mu.ie%7C19d38950ae5d4fca63d108d80813052c%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637268225071229463&sdata=otxRb8uMmothEvYi60FCmUM1yiSS7a04C9upyw0FUOo%3D&reserved=0
>>> Discussions of bugs and features can be posted here
>> 
>> Csound mailing list
>> Csound@listserv.heanet.ie
>> https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flistserv.heanet.ie%2Fcgi-bin%2Fwa%3FA0%3DCSOUND&data=02%7C01%7CVictor.Lazzarini%40mu.ie%7C19d38950ae5d4fca63d108d80813052c%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637268225071239455&sdata=g%2B6WrxykGL2kSQWaSnSQT1hul4UwVa5dcrnlSbVZcdg%3D&reserved=0
>> Send bugs reports to
>>        https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcsound%2Fcsound%2Fissues&data=02%7C01%7CVictor.Lazzarini%40mu.ie%7C19d38950ae5d4fca63d108d80813052c%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637268225071239455&sdata=h1EuYdo8UcpVELn%2BSwgEjyYGgfrduhRWT%2Ft9ZDIJk7E%3D&reserved=0
>> Discussions of bugs and features can be posted here
> 
> Csound mailing list
> Csound@listserv.heanet.ie
> https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flistserv.heanet.ie%2Fcgi-bin%2Fwa%3FA0%3DCSOUND&data=02%7C01%7CVictor.Lazzarini%40mu.ie%7C19d38950ae5d4fca63d108d80813052c%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637268225071239455&sdata=g%2B6WrxykGL2kSQWaSnSQT1hul4UwVa5dcrnlSbVZcdg%3D&reserved=0
> Send bugs reports to
>        https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcsound%2Fcsound%2Fissues&data=02%7C01%7CVictor.Lazzarini%40mu.ie%7C19d38950ae5d4fca63d108d80813052c%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637268225071239455&sdata=h1EuYdo8UcpVELn%2BSwgEjyYGgfrduhRWT%2Ft9ZDIJk7E%3D&reserved=0
> Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here