some DSP questions ( FIR )

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.
in another thread:

http://www.diyaudio.com/forums/multi-way/5699-cant-reproduce-square-wave.html

i expressed my concern to John K that "fixing" phase response just once around the whole speaker system may not work the same way as "fixing" phase response of each driver individually and then properly combining them.

John seems to think that it is the same. Myself i don't know. So let's figure it out.

Let's start by asking some questions:

1 - can FIR filter fix the impulse response of a system that is NOT minimum phase ? in other words can a FIR filter be used to restore a system that is not minimum phase back to minimum phase ?

2 - lets say a midrange is a minimum phase device and a tweeter is a minimum phase device. but when their output is combined - is it guaranteed to be minimum phase ? what if the drivers have massive phase roll and/or physical offset ?

let's get some input on this and we'll take it from there.

John - what's your take on this ?
 
Last edited:
In another thread Ferrit37 linked me to these which explain what can be done with impulse responses.
The video on this page explains it well
http://www.eaw.com/technology/proprietary/GunnessFocusing/

http://www.eaw.com/info/EAW/Technical_Papers/NT_Whitepaper.pdf

Here is what I did last night to approximately linearize my monitors' PR.

Approximate normal FR and PR
http://img10.imageshack.us/i/aproximatefrpr.png/

Approximate Offset
http://img4.imageshack.us/i/aproximateoffset.png/

Approximate Convolved Speaker output
http://img195.imageshack.us/i/vstconvolve.png/

See the thing I am attempting here is to offset the phase distortions introduced by the Linkwitz-Riley filters in my monitors - which leaves the PR at -180 and +180 at the crossover frequency.

I do not think you could do this for each driver isolated, only for the combined output of your speakers.

Another link of interest Frontiers
 
Last edited:
John was correct. Now figure out why you thought he wasn't and correct that thinking.

1) can FIR filter fix the impulse response of a system that is NOT minimum phase ? in other words can a FIR filter be used to restore a system that is not minimum phase back to minimum phase ?

Yes, an IIR filter can't, but an FIR can.

2 - lets say a midrange is a minimum phase device and a tweeter is a minimum phase device. but when their output is combined - is it guaranteed to be minimum phase ? what if the drivers have massive phase roll and/or physical offset ?

No it is not guaranteed to be minimum phase, but it can be. It all depends on the specifics, there are no generalities in this regard. But, as John knows, I'm not big on "minimum phase". It's a convenient concept for some situations in signal processing, but not required. And there is no reason to believe that it has anything to do with sound quality. The ear is not minimum phase!
 
this whole business made me realize that its been quite some time since i actually had to think about things.

my brain feels almost like your body would if you tried walking after a year in coma or perhaps in space.

i should be charged with criminal neglect for not exercising my brain. i need to get back in college somehow or something.
 
Yes, an IIR filter can't, but an FIR can.

ok what Wikipedia is telling me is that an inverse of non minimum phase system is unstable.

think of a system whose impulse response consists of two impulses - one at time zero and one delayed by t. what kind of signal can we feed into it so we would get only one impulse at the output ? i thought about it and here is the answer: we need to feed an infinite series of impulses alternating between positive and negative. this way everything cancels except impulse at time zero.

then i did more thinking about it and realized that if the second impulse in the impulse response is larger than the first then the series must be ever increasing which is an impossible condition to meet ( instability ).

the reason Gunness could do what he did for EAW is because the signal he was inverting had one property - the "echo" in the phase plug or "resonance" in the cone and horn was ever decreasing. this made the processing stable.

however in a general case ( for example two speakers separated by time delay but of equal loudness or with delayed speaker being louder ) it seems inverting such a system is impossible.

what do you say to that Geddes ?
 
think of a system whose impulse response consists of two impulses - one at time zero and one delayed by t. what kind of signal can we feed into it so we would get only one impulse at the output ? i thought about it and here is the answer: we need to feed an infinite series of impulses alternating between positive and negative. this way everything cancels except impulse at time zero.

what do you say to that Geddes ?

The question is ill posed. You should say "what kind of a prefilter would make the dual impulse response system (as you posed above) look like a single impulse response system. That's easy, a filter with a second impulse inverted from the second impulse in the system being corrected. This filter will then correct ANY signal. This is called echo cancellation - its done all the time.

But the real point for us, is that this correction can only be done at a single point in space, or electrically where there is no spatial aspects. Correcting a echo in the acoustic domain CANNOT be done globally, only at a point. And consider what happens at other points, where the second impulse is delayed from the first by a different amount. At these points I now have three impulse in the impulse response because the prefilter has added one that now does not line up with the second one because the time delay is different. This is precisely why I say that acoustic "room correction" is a waste of time and will likely only make things worse not better. (It is conceivable that a correction filter like this could make a really bad loudspeaker better, but this would never occur in the general case.
 
But the real point for us, is that this correction can only be done at a single point in space, or electrically where there is no spatial aspects. Correcting a echo in the acoustic domain CANNOT be done globally, only at a point. And consider what happens at other points, where the second impulse is delayed from the first by a different amount. At these points I now have three impulse in the impulse response because the prefilter has added one that now does not line up with the second one because the time delay is different. This is precisely why I say that acoustic "room correction" is a waste of time and will likely only make things worse not better. (It is conceivable that a correction filter like this could make a really bad loudspeaker better, but this would never occur in the general case.

let's not get ahead of ourselves. yes 3 dimensional reality is a nightmare. let's clear 1-dimensional issues out of the way first.
 
The question is ill posed. You should say "what kind of a prefilter would make the dual impulse response system (as you posed above) look like a single impulse response system. That's easy, a filter with a second impulse inverted from the second impulse in the system being corrected. This filter will then correct ANY signal. This is called echo cancellation - its done all the time.

let me see if i get what you're saying. you want to cascade prefilter with the system such the combination is unity. in other words your prefilter is the inverse of the system.

you claim that a positive impulse followed by a negative impulse at a time t will realize such a prefilter ?

i don't think so.

i mean if one impulse goes in one should come out but is that what will actually happen ?

after the prefilter you will have one positive and one negative pulse going into the system. the positive one will convolve with positive in system to produce the desired output. then negative impulse will convolve with positive just as the positive is convolving with the second positive resulting in cancellation - so far so good ! now comes the problem - the negative impulse now convolves with the second positive of the system resulting in unwanted negative at the output.

are we talking about the same thing here ?
 
Are you trying to correct the magnitude and phase response of each driver so that they sum acoustically as the crossover design expects? Or are you trying to correct for the time offset due to non-coincident acoustic centers?

The driver itself shouldn't generate reflections. Only the cabinet and the room should do that. Where are the two impulses coming from?
 
i don't think so.

are we talking about the same thing here ?

Yes, we are. And I think that you will find that what I am saying is correct, or at least I think that it is correct. Its precisely what an echo canceller does. But I would have to think about this being in the time domain rather than the frequency domain. A quick review of Fourier transforms would answer the question, but its late here.
 
Are you trying to correct the magnitude and phase response of each driver so that they sum acoustically as the crossover design expects? Or are you trying to correct for the time offset due to non-coincident acoustic centers?

The driver itself shouldn't generate reflections. Only the cabinet and the room should do that. Where are the two impulses coming from?

its just purely theoretical. no speakers. i am still disagreeing with Geddes in the most basic theory - no point in moving on to speakers until we clear this step.
 
Yes, we are. And I think that you will find that what I am saying is correct, or at least I think that it is correct. Its precisely what an echo canceller does. But I would have to think about this being in the time domain rather than the frequency domain. A quick review of Fourier transforms would answer the question, but its late here.

well i see echo as a completely different problem.

in echo you have a series of exponentially decaying signals in which case an impulse followed by an inverted and attenuated impulse will do precisely what is needed. the two impulses of the prefilter will produce two exponentially decaying series which will cancel out everywhere except at time zero.

however this will not work when instead of echo ( exponential decay ) or resonance ( also exponential decay ) you simply have two identical impulses in the system ( no decay and no series ).

if the system to be corrected has only two signals ( instead of series ) then the prefilter itself will need to be a series. and if the system to be corrected doesn't have any sort of decay ( if the second impulse is not smaller than the first ) then the prefilter series will not have decay either so will not be possible to realize.

now this is all coming out of my head, not some book, so it may be wrong. hopefully you can think about it when you have had some sleep.

i am not even sure how this relates back the original problem but as long as we already raised this question might as well finish it :)
 
The question is ill posed. You should say "what kind of a prefilter would make the dual impulse response system (as you posed above) look like a single impulse response system. That's easy, a filter with a second impulse inverted from the second impulse in the system being corrected. This filter will then correct ANY signal. This is called echo cancellation - its done all the time.
I'm afraid not, and there's no need to go to Fourier to see this can't work - but to take a Fourier perspective, suppose the echo is the same amplitude as the original. There will then be a frequency at which the original and echo are 180 degrees out of phase and cancel perfectly, so the transfer function has zero magnitude at that frequency. What transfer function can you cascade with it that will turn that 0 back into 1?

Sticking in the time domain, the original system with echo has a response

y(t) = x(t) + a*x(t-T) where a = echo level and T is the delay of the echo.

The simple correction filter proposed would replace x(t) by x(t) - a*x(t-T), so we then would get

y(t) = x(t) - a*x(t-T) + a*[x(t-T) -a*x(t-2T)] = x(t) - a^2*x(t-2T)

Here we see the problem Borat pointed out - to correct the new 'echo of an echo' the system has acquired, the correction filter needs a further correction for the a^2 term. When we deal with that there will be a further term with higher powers of a to correct. If a is less than 1 these terms will eventually get small enough that they can be ignored (though the filter may be very long by then if a is not small to start with), but with a>=1 the corrections either stay the same or get ever larger, requiring a correction filter of infinite length.
 
I'm afraid not, and there's no need to go to Fourier to see this can't work - but to take a Fourier perspective, suppose the echo is the same amplitude as the original. There will then be a frequency at which the original and echo are 180 degrees out of phase and cancel perfectly, so the transfer function has zero magnitude at that frequency. What transfer function can you cascade with it that will turn that 0 back into 1?

Sticking in the time domain, the original system with echo has a response

y(t) = x(t) + a*x(t-T) where a = echo level and T is the delay of the echo.

The simple correction filter proposed would replace x(t) by x(t) - a*x(t-T), so we then would get

y(t) = x(t) - a*x(t-T) + a*[x(t-T) -a*x(t-2T)] = x(t) - a^2*x(t-2T)

Here we see the problem Borat pointed out - to correct the new 'echo of an echo' the system has acquired, the correction filter needs a further correction for the a^2 term. When we deal with that there will be a further term with higher powers of a to correct. If a is less than 1 these terms will eventually get small enough that they can be ignored (though the filter may be very long by then if a is not small to start with), but with a>=1 the corrections either stay the same or get ever larger, requiring a correction filter of infinite length.

John

Thanks

I believe that you are quite correct. I thought about this later and had suspicion that this was the case. Thanks for the nice simple explaination.

I guess the point here is that a perfect correction IS possible albeit not simple and not possible to do perfectly in a finite length filter. This is the meaning of Borat's comment that the non-minimum phase Transfer Function was not invertable. But it could be done to any desired level of accuracy.

Thanks again for the correction. Just goes to show how easily our first guess intuition can be wrong.
 
Borat's question was the case of two sources, not an echo. Apply the correction filter only to the first source.


y(t) = y1(t) + y2(t)

y1(t) = x(t)

y2(t) = ax(t-T)


Correct y1(t) = x(t) - ax(t-T) and

y(t) = x(t) .

This is the baic idea of noise cancelation headphones....active noise control.... where you want to hear x but x is contaminated by an outisde source, y2. It's not echo cancelation though.
 
Borat's question was the case of two sources, not an echo. Apply the correction filter only to the first source.


y(t) = y1(t) + y2(t)

y1(t) = x(t)

y2(t) = ax(t-T)


Correct y1(t) = x(t) - ax(t-T) and

y(t) = x(t) .

This is the baic idea of noise cancelation headphones....active noise control.... where you want to hear x but x is contaminated by an outisde source, y2. It's not echo cancelation though.

first of all thanks for stopping by.

but now what you've done here is you applied different processing to y1 and y2 which is what i was thinking necessary.

you were previously saying that you can apply the filter to the entire finished speaker ( comprised of both y1 and y2 ) which would mean the same processing applied to y1 and y2.

we already established that if y1 and y2 combine in a way that produces non-minimum phase y then we can't guarantee recovery of x in every case.

all that's left to figure out is - is a regular analog crossover such a system that doesn't lend itself to recovery of original signal ? there are no frequencies where response goes to zero - that is encouraging.

An externally hosted image should be here but it was not working when we last tested it.


but the straight vertical lines in this graph worry me. would a FIR filter be able to sort such phase response out ?
 
Last edited:
What does unwrapping the phase do? I was looking at the differences of a filter with that turned on and off last night when you typed that and I was actually thinking it should be the opposite - uncheck unwrapp phase.

I was only doing 2nd order but I did it like this. Made a clean log sweep, then I ran it through a second order LR crossover DSP but summed the HP and LP before the output. This gives me a flat FR with just the phase distortion. Then do 1/crossover to get the inverse filter and export.

When I used unwrap phase the filter points were in the positive instead of the negative - so 200 instead of -180.
 
What does unwrapping the phase do? I was looking at the differences of a filter with that turned on and off last night when you typed that and I was actually thinking it should be the opposite - uncheck unwrapp phase.

I was only doing 2nd order but I did it like this. Made a clean log sweep, then I ran it through a second order LR crossover DSP but summed the HP and LP before the output. This gives me a flat FR with just the phase distortion. Then do 1/crossover to get the inverse filter and export.

When I used unwrap phase the filter points were in the positive instead of the negative - so 200 instead of -180.

Phase wraping is just for displaying the phase in a convient manor. The phase is continuous. It does not wrap. But form a steady state AC point of view +180 is identical to -180 so rather than have the phase axis from 0 to 720 (or what ever) the plot just wraps at 180 degrees.
 
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.