Re: [music-dsp] Allpass filter

2016-12-08 Thread Ethan Duni
>ap := IFFT(FFT(lp)/FFT(p))
>It's simply a complex division in frequency domain.

That won't really work - the denominator there corresponds to an IIR
filter, so you're going to get considerable aliasing doing this.

With considerable zero-padding it may work approximately, but you aren't
going to get an actual allpass filter out of this (except in the trivial
cases of flat filters and such).

The right way to get the allpass is not to use any FFTs, you just use lp
and p directly as the coefficients of an IIR filter. If you want an FIR
approximation to that, then compute the impulse response and
truncate/window it to the desired length.

FFT domain is generally not a good place to design filters - you're only
controlling what happens at the bin centers, and all kinds of wild things
can happen in between them. And it's difficult to account for the
circular/finite length effects.

Ethan Duni

On Thu, Dec 8, 2016 at 7:11 AM, STEFFAN DIEDRICHSEN 
wrote:

>
> On 08.12.2016|KW49, at 15:32, Uli Brueggemann 
> wrote:
>
> It's simply a complex division in frequency domain.
>
>
> That’s correct. I’m not sure, if you need to zero-pad the FFTs to avoid
> time-aliasing since the spectral multiplication is a convolution. But on
> the other hand a spectral division is a deconvolution, so you should be
> fine.
>
> Best,
>
> Steffan
>
> ___
> dupswapdrop: music-dsp mailing list
> music-dsp@music.columbia.edu
> https://lists.columbia.edu/mailman/listinfo/music-dsp
>
___
dupswapdrop: music-dsp mailing list
music-dsp@music.columbia.edu
https://lists.columbia.edu/mailman/listinfo/music-dsp

Re: [music-dsp] Allpass filter

2016-12-08 Thread Ethan Fenn
Yes, that will give you an approximate answer -- if you replace the FFT's
with z transforms and the IFFT with an inverse z transform that will give
you the theoretically exact answer.

And if you actually want to implement this allpass filter you'll have to
deal with the fact that it almost certainly won't be causal, as Evan
pointed out. You'll have to introduce a substantial delay.

-Ethan



On Thu, Dec 8, 2016 at 9:32 AM, Uli Brueggemann 
wrote:

> I guess I have the solution now for my question by Steffan' answer.s
>
> ap := IFFT(FFT(lp)/FFT(p))
>
> It's simply a complex division in frequency domain.
>
> Thanks
> Uli
>
> 2016-12-07 22:14 GMT+01:00 Stefan Stenzel 
> :
>
>>
>> > On 7 Dec 2016, at 13:10 , Uli Brueggemann 
>> wrote:
>> >
>> > Hi,
>> >
>> > I'm searching a solution for an allpass filter calculation with
>> following conditions:
>> >
>> > There is a given pulse response p with a transfer function H. It is
>> possible to derive a linear phase pulse response lp from the magnitude of H.
>>
>>
>> Is the second sentence a known condition or a conclusion?
>>
>> As a conclusion it is wrong. The zeros of a linear phase filter come in
>> reciprocal conjugate pairs, meaning if it has a zero at z it also has one
>> at 1/z.
>> For your sequence p this means any zero z would need to have a
>> corresponding zero at position z or 1/z - very unlikely for an arbitrary
>> pulse response.
>> If the zeros don’t match, it is impossible for H to have the same
>> magnitude. You can only approximate it.
>>
>> Stefan
>>
>> ___
>> dupswapdrop: music-dsp mailing list
>> music-dsp@music.columbia.edu
>> https://lists.columbia.edu/mailman/listinfo/music-dsp
>>
>
>
> ___
> dupswapdrop: music-dsp mailing list
> music-dsp@music.columbia.edu
> https://lists.columbia.edu/mailman/listinfo/music-dsp
>
___
dupswapdrop: music-dsp mailing list
music-dsp@music.columbia.edu
https://lists.columbia.edu/mailman/listinfo/music-dsp

Re: [music-dsp] Allpass filter

2016-12-08 Thread STEFFAN DIEDRICHSEN

> On 08.12.2016|KW49, at 15:32, Uli Brueggemann  
> wrote:
> 
> It's simply a complex division in frequency domain.

That’s correct. I’m not sure, if you need to zero-pad the FFTs to avoid 
time-aliasing since the spectral multiplication is a convolution. But on the 
other hand a spectral division is a deconvolution, so you should be fine. 

Best,

Steffan ___
dupswapdrop: music-dsp mailing list
music-dsp@music.columbia.edu
https://lists.columbia.edu/mailman/listinfo/music-dsp

Re: [music-dsp] Allpass filter

2016-12-08 Thread Uli Brueggemann
I guess I have the solution now for my question by Steffan' answer.s

ap := IFFT(FFT(lp)/FFT(p))

It's simply a complex division in frequency domain.

Thanks
Uli

2016-12-07 22:14 GMT+01:00 Stefan Stenzel :

>
> > On 7 Dec 2016, at 13:10 , Uli Brueggemann 
> wrote:
> >
> > Hi,
> >
> > I'm searching a solution for an allpass filter calculation with
> following conditions:
> >
> > There is a given pulse response p with a transfer function H. It is
> possible to derive a linear phase pulse response lp from the magnitude of H.
>
>
> Is the second sentence a known condition or a conclusion?
>
> As a conclusion it is wrong. The zeros of a linear phase filter come in
> reciprocal conjugate pairs, meaning if it has a zero at z it also has one
> at 1/z.
> For your sequence p this means any zero z would need to have a
> corresponding zero at position z or 1/z - very unlikely for an arbitrary
> pulse response.
> If the zeros don’t match, it is impossible for H to have the same
> magnitude. You can only approximate it.
>
> Stefan
>
> ___
> dupswapdrop: music-dsp mailing list
> music-dsp@music.columbia.edu
> https://lists.columbia.edu/mailman/listinfo/music-dsp
>
___
dupswapdrop: music-dsp mailing list
music-dsp@music.columbia.edu
https://lists.columbia.edu/mailman/listinfo/music-dsp

Re: [music-dsp] Allpass filter

2016-12-07 Thread Stefan Stenzel

> On 7 Dec 2016, at 13:10 , Uli Brueggemann  wrote:
> 
> Hi,
> 
> I'm searching a solution for an allpass filter calculation with following 
> conditions:
> 
> There is a given pulse response p with a transfer function H. It is possible 
> to derive a linear phase pulse response lp from the magnitude of H.


Is the second sentence a known condition or a conclusion?

As a conclusion it is wrong. The zeros of a linear phase filter come in 
reciprocal conjugate pairs, meaning if it has a zero at z it also has one at 
1/z.
For your sequence p this means any zero z would need to have a corresponding 
zero at position z or 1/z - very unlikely for an arbitrary pulse response.
If the zeros don’t match, it is impossible for H to have the same magnitude. 
You can only approximate it.

Stefan

___
dupswapdrop: music-dsp mailing list
music-dsp@music.columbia.edu
https://lists.columbia.edu/mailman/listinfo/music-dsp

Re: [music-dsp] Allpass filter

2016-12-07 Thread Evan Balster
>
> *The magnitude of ap = 1, so ap applies only phase shifts. Its group delay
> is inverse to the group delay of p.*
>

I think the idea here is to derive a filter with the same magnitude
characteristics as p, but zero group delay --- so as to transform arbitrary
filters into zero-phase / zero-delay filters.  Generally, deriving one of
these for a causal filter p is possible, but will result in an anti-causal
ap filter that can't be implemented, because it requires information from
the future.  The zero-phase lp filter will generally require information
from the past *and *the future.  If you're willing to tolerate a long,
constant delay (increasing in proportion to the accuracy of the magnitude
response) you can approximate your lp filter with a symmetric FIR filter
design.

Sadly you can't cheat the laws of filter theory --- at least, not without
venturing outside it.

– Evan Balster
creator of imitone 

On Wed, Dec 7, 2016 at 12:53 PM, Ethan Duni  wrote:

> I'm not sure I quite follow what the goal is here? If you already have lp
> and p, then there aren't any additional calculations needed to obtain ap -
> it's an IIR filter with numerator coefficients given by lp, and denominator
> coefficients given by p. The pulse response is obtained by running the
> filter for a pulse input.
>
> Is the goal to get an FIR approximation of ap? As Stefan has pointed out,
> an FIR allpass is a simple delay. If you are willing to relax the allpass
> criterion, you can get an FIR approximation by just truncating the pulse
> response at whatever length is sufficient for your application.
>
> Unless I'm missing something, seems like all of the difficulties are in
> obtaining p and lp in the first place?
>
> Ethan
>
> On Wed, Dec 7, 2016 at 4:10 AM, Uli Brueggemann  > wrote:
>
>> Hi,
>>
>> I'm searching a solution for an allpass filter calculation with following
>> conditions:
>>
>> There is a given pulse response p with a transfer function H. It is
>> possible to derive a linear phase pulse response lp from the magnitude of H.
>>
>> Now there is an equation
>> p * ap = lp  (* = convolution, ap = allpass)
>>
>> Thus
>> ap = lp * p^-1
>>
>> The magnitude of ap = 1, so ap applies only phase shifts. Its group delay
>> is inverse to the group delay of p.
>>
>> Is there a solution to elegantly calculate the pulse response ap ? The
>> calculation of p^-1 may be difficult or numerically unstable.
>>
>> Cheers
>> Uli
>>
>>
>>
>> ___
>> dupswapdrop: music-dsp mailing list
>> music-dsp@music.columbia.edu
>> https://lists.columbia.edu/mailman/listinfo/music-dsp
>>
>
>
> ___
> dupswapdrop: music-dsp mailing list
> music-dsp@music.columbia.edu
> https://lists.columbia.edu/mailman/listinfo/music-dsp
>
___
dupswapdrop: music-dsp mailing list
music-dsp@music.columbia.edu
https://lists.columbia.edu/mailman/listinfo/music-dsp

Re: [music-dsp] Allpass filter

2016-12-07 Thread Stefan Sullivan
A linear phase all-pass filter is a delay.

Stefan

On Dec 7, 2016 4:30 AM, "STEFFAN DIEDRICHSEN"  wrote:

>
> On 07.12.2016|KW49, at 13:10, Uli Brueggemann 
> wrote:
>
> Is there a solution to elegantly calculate the pulse response ap ? The
> calculation of p^-1 may be difficult or numerically unstable.
>
>
>
> A spectral inversion can be a challenging at times. However, lp/p should
> be fine to calculate, since the amplitudes of lp and p are identical,
> otherwise the result won’t be an allpass. (Which might be a strategy to
> “condition” the alpass filter, if the amplitude is not 1. at all bins ….)
>
> Best,
>
> Steffan
>
> ___
> dupswapdrop: music-dsp mailing list
> music-dsp@music.columbia.edu
> https://lists.columbia.edu/mailman/listinfo/music-dsp
>
___
dupswapdrop: music-dsp mailing list
music-dsp@music.columbia.edu
https://lists.columbia.edu/mailman/listinfo/music-dsp

Re: [music-dsp] Allpass filter

2016-12-07 Thread STEFFAN DIEDRICHSEN

> On 07.12.2016|KW49, at 13:10, Uli Brueggemann  
> wrote:
> 
> Is there a solution to elegantly calculate the pulse response ap ? The 
> calculation of p^-1 may be difficult or numerically unstable.


A spectral inversion can be a challenging at times. However, lp/p should be 
fine to calculate, since the amplitudes of lp and p are identical, otherwise 
the result won’t be an allpass. (Which might be a strategy to “condition” the 
alpass filter, if the amplitude is not 1. at all bins ….)

Best,

Steffan ___
dupswapdrop: music-dsp mailing list
music-dsp@music.columbia.edu
https://lists.columbia.edu/mailman/listinfo/music-dsp

Re: [music-dsp] Allpass filter

2016-12-07 Thread Remy Muller

sounds like a good candidate for Wiener deconvolution:

https://en.wikipedia.org/wiki/Wiener_deconvolution

On 07/12/16 13:10, Uli Brueggemann wrote:

Hi,

I'm searching a solution for an allpass filter calculation with 
following conditions:


There is a given pulse response p with a transfer function H. It is 
possible to derive a linear phase pulse response lp from the magnitude 
of H.


Now there is an equation
p * ap = lp  (* = convolution, ap = allpass)

Thus
ap = lp * p^-1


___
dupswapdrop: music-dsp mailing list
music-dsp@music.columbia.edu
https://lists.columbia.edu/mailman/listinfo/music-dsp