maury wrote:> Fred, > Since he is using a sinusoid for the test signal, the LMS will have an > infinite number of solutions, not a unique solution. The coefficients > of the adaptive filter will be a sinusoid rather than a single non- > zero coefficient with others zero.Maury, I'm not sure what you're telling us. Maybe you can illuminate? I can imagine that the LMS will have a number of effective delays (solutions) that will work - depending on the length of the filter. For a finite-length filter that's not "infinite" but I get the concept... or do I? I would hope that the LMS implementation would be well enough behaved that this reality doesn't mess up convergence to a single solution. The devil is in the details isn't it? I really don't get why the coefficients would be sinusoidal. In a noise canceller this might make sense if the "desired signal" is a sinusoid and the "noise reference" is white noise. In that case we'd want a narrow bandpass filter and *then* the coefficients would be sinusoidal. But, as I'm sure you know, if the reference is only noise, the filter wil shut off completely to reach an output minimum. But, the "noise reference" here is a sinusoid at the correct frequency - at least in the model I postulated and as I understood the OP. What is needed for a minimum at the output is a particular delay and a particular amplitude. And, *that* is a FIR with a single non-zero coefficient. Did I miss something? Fred
adaptive sine-wave cancellation
Started by ●November 18, 2008
Reply by ●November 21, 20082008-11-21
Reply by ●November 21, 20082008-11-21
On Nov 21, 2:03�pm, "Fred Marshall" <fmarshallx@remove_the_x.acm.org> wrote:> maury wrote: > > Fred, > > Since he is using a sinusoid for the test signal, the LMS will have an > > infinite number of solutions, not a unique solution. �The coefficients > > of the adaptive filter will be a sinusoid rather than a single non- > > zero coefficient with others zero. > > Maury, > > I'm not sure what you're telling us. �Maybe you can illuminate? > I can imagine that the LMS will have a number of effective delays > (solutions) that will work - depending on the length of the filter. �For a > finite-length filter that's not "infinite" but I get the concept... or do I? > > I would hope that the LMS implementation would be well enough behaved that > this reality doesn't mess up convergence to a single solution. �The devil is > in the details isn't it? > > I really don't get why the coefficients would be sinusoidal. �In a noise > canceller this might make sense if the "desired signal" is a sinusoid and > the "noise reference" is white noise. �In that case we'd want a narrow > bandpass filter and *then* the coefficients would be sinusoidal. �But, as > I'm sure you know, if the reference is only noise, the filter wil shut off > completely to reach an output minimum. > > But, the "noise reference" here is a sinusoid at the correct frequency - at > least in the model I postulated and as I understood the OP. �What is needed > for a minimum at the output is a particular delay and a particular > amplitude. �And, *that* is a FIR with a single non-zero coefficient. > > Did I miss something? > > FredAnytime the input to a LMS is a sinusoid, the adaptive will not have a unique solution. In fact, it can be the cause of instability in anotherwise stable adaptive filter. The LMS algorithm attempts to model the Weiner filter h = R(x)^-1 r(xd) h is the set of adaptive filter coefficients, R(x)^-1 is the inverse of the input autocorrelation matrix, and r(xd) is the crosscorrelation vector of the input and the desired signal. If the input is a sinusoid, the matrix inverse of the input correlation matrix does not exist. This doesn't mean that the filter won't adapt, but it does mean that there is not a UNIQUE solution. If you can find Clarkson's paper he gives a very good explanation of this, and derives a transfer function that can be used in these cases (I did some study with him). The OP said "I drive a speaker with a sine-wave of known frequency = w." Therefore, if he uses the lms algorithm, it won't have a unique solution. He just needs to be aware of this, and know that the filter coefficients won't be an impulse. The best signal to use to test adaptive filters, in my opinion, is gaussian white noise. Unfortunately, he can't put noise on the system he has. Robert, can you put a small amount of noise on the signal? Almost any amount would help. Maurice Givens
Reply by ●November 21, 20082008-11-21
On Nov 21, 2:03�pm, "Fred Marshall" <fmarshallx@remove_the_x.acm.org> wrote:> maury wrote: > > Fred, > > Since he is using a sinusoid for the test signal, the LMS will have an > > infinite number of solutions, not a unique solution. �The coefficients > > of the adaptive filter will be a sinusoid rather than a single non- > > zero coefficient with others zero. > > Maury, > > I'm not sure what you're telling us. �Maybe you can illuminate? > I can imagine that the LMS will have a number of effective delays > (solutions) that will work - depending on the length of the filter. �For a > finite-length filter that's not "infinite" but I get the concept... or do I? > > I would hope that the LMS implementation would be well enough behaved that > this reality doesn't mess up convergence to a single solution. �The devil is > in the details isn't it? > > I really don't get why the coefficients would be sinusoidal. �In a noise > canceller this might make sense if the "desired signal" is a sinusoid and > the "noise reference" is white noise. �In that case we'd want a narrow > bandpass filter and *then* the coefficients would be sinusoidal. �But, as > I'm sure you know, if the reference is only noise, the filter wil shut off > completely to reach an output minimum. > > But, the "noise reference" here is a sinusoid at the correct frequency - at > least in the model I postulated and as I understood the OP. �What is needed > for a minimum at the output is a particular delay and a particular > amplitude. �And, *that* is a FIR with a single non-zero coefficient. > > Did I miss something? > > FredFred, Am off for week-end duty, if you have another question, I will look at it Monday when I return. Maurice
Reply by ●November 22, 20082008-11-22
On Nov 22, 4:03�am, "Fred Marshall" <fmarshallx@remove_the_x.acm.org> wrote:> maury wrote: > > Fred, > > Since he is using a sinusoid for the test signal, the LMS will have an > > infinite number of solutions, not a unique solution. �The coefficients > > of the adaptive filter will be a sinusoid rather than a single non- > > zero coefficient with others zero. > > Maury, > > I'm not sure what you're telling us. �Maybe you can illuminate? > I can imagine that the LMS will have a number of effective delays > (solutions) that will work - depending on the length of the filter. �For a > finite-length filter that's not "infinite" but I get the concept... or do I? > > I would hope that the LMS implementation would be well enough behaved that > this reality doesn't mess up convergence to a single solution. �The devil is > in the details isn't it? > > I really don't get why the coefficients would be sinusoidal. �In a noise > canceller this might make sense if the "desired signal" is a sinusoid and > the "noise reference" is white noise. �In that case we'd want a narrow > bandpass filter and *then* the coefficients would be sinusoidal. �But, as > I'm sure you know, if the reference is only noise, the filter wil shut off > completely to reach an output minimum. > > But, the "noise reference" here is a sinusoid at the correct frequency - at > least in the model I postulated and as I understood the OP. �What is needed > for a minimum at the output is a particular delay and a particular > amplitude. �And, *that* is a FIR with a single non-zero coefficient. > > Did I miss something? > > FredWell, if you don't think there are an infinite number of solutions you have missed something. Perhaps you are looking at the various possible delays as independent solutions the adaption might home to. However. it can also mix a little of delay 1 with a little of delay 2 and a little of delay 3. There are an infinite number of ways these amounts can mix to arrive at a precise match. Steve
Reply by ●November 22, 20082008-11-22
steveu@coppice.org wrote:> On Nov 22, 4:03 am, "Fred Marshall" <fmarshallx@remove_the_x.acm.org> > wrote: >> maury wrote: >>> Fred, >>> Since he is using a sinusoid for the test signal, the LMS will have >>> an infinite number of solutions, not a unique solution. The >>> coefficients of the adaptive filter will be a sinusoid rather than >>> a single non- zero coefficient with others zero. >> >> Maury, >> >> I'm not sure what you're telling us. Maybe you can illuminate? >> I can imagine that the LMS will have a number of effective delays >> (solutions) that will work - depending on the length of the filter. >> For a finite-length filter that's not "infinite" but I get the >> concept... or do I? >> >> I would hope that the LMS implementation would be well enough >> behaved that this reality doesn't mess up convergence to a single >> solution. The devil is in the details isn't it? >> >> I really don't get why the coefficients would be sinusoidal. In a >> noise canceller this might make sense if the "desired signal" is a >> sinusoid and the "noise reference" is white noise. In that case we'd >> want a narrow bandpass filter and *then* the coefficients would be >> sinusoidal. But, as I'm sure you know, if the reference is only >> noise, the filter wil shut off completely to reach an output minimum. >> >> But, the "noise reference" here is a sinusoid at the correct >> frequency - at least in the model I postulated and as I understood >> the OP. What is needed for a minimum at the output is a particular >> delay and a particular amplitude. And, *that* is a FIR with a single >> non-zero coefficient. >> >> Did I miss something? >> >> Fred > > Well, if you don't think there are an infinite number of solutions you > have missed something. Perhaps you are looking at the various possible > delays as independent solutions the adaption might home to. However. > it can also mix a little of delay 1 with a little of delay 2 and a > little of delay 3. There are an infinite number of ways these amounts > can mix to arrive at a precise match. > > SteveOK. Thanks. I was missing the (likely) need for fractional delay. Let me translate into my own language: "Find a filter with exact amplitude and phase response at a single frequency and "don't care" everywhere else. There are an infinite number of filter realizations that will pass through this point." So, that suggests there may need to be some constraints added that lead to a practical filter and reduce the number of possible solutions. And, now I understand why one would add some noise to the reference - so it tends to "shut off" the filter at all frequencies not of interest. And, that would be the constraint that reduces the number of solutions. All this said, I'm concerned how the canceller gets its input. Is the signal driving spkr 1 available? I've not quite figured that out. At first the OP said that the input was a stable sinusoid - which, if really true, is one thing. But now it appears that the input is a slowly varying sinusoid. So, where does the reference / the signal to manipulate in the filter to subtract / come from? Fred
Reply by ●November 22, 20082008-11-22
On Nov 22, 1:26�pm, "Fred Marshall" <fmarshallx@remove_the_x.acm.org> wrote:> ste...@coppice.org wrote: > > On Nov 22, 4:03 am, "Fred Marshall" <fmarshallx@remove_the_x.acm.org> > > wrote: > >> maury wrote: > >>> Fred, > >>> Since he is using a sinusoid for the test signal, the LMS will have > >>> an infinite number of solutions, not a unique solution. The > >>> coefficients of the adaptive filter will be a sinusoid rather than > >>> a single non- zero coefficient with others zero. > > >> Maury, > > >> I'm not sure what you're telling us. Maybe you can illuminate? > >> I can imagine that the LMS will have a number of effective delays > >> (solutions) that will work - depending on the length of the filter. > >> For a finite-length filter that's not "infinite" but I get the > >> concept... or do I? > > >> I would hope that the LMS implementation would be well enough > >> behaved that this reality doesn't mess up convergence to a single > >> solution. The devil is in the details isn't it? > > >> I really don't get why the coefficients would be sinusoidal. In a > >> noise canceller this might make sense if the "desired signal" is a > >> sinusoid and the "noise reference" is white noise. In that case we'd > >> want a narrow bandpass filter and *then* the coefficients would be > >> sinusoidal. But, as I'm sure you know, if the reference is only > >> noise, the filter wil shut off completely to reach an output minimum. > > >> But, the "noise reference" here is a sinusoid at the correct > >> frequency - at least in the model I postulated and as I understood > >> the OP. What is needed for a minimum at the output is a particular > >> delay and a particular amplitude. And, *that* is a FIR with a single > >> non-zero coefficient. > > >> Did I miss something? > > >> Fred > > > Well, if you don't think there are an infinite number of solutions you > > have missed something. Perhaps you are looking at the various possible > > delays as independent solutions the adaption might home to. However. > > it can also mix a little of delay 1 with a little of delay 2 and a > > little of delay 3. There are an infinite number of ways these amounts > > can mix to arrive at a precise match. > > > Steve > > OK. �Thanks. �I was missing the (likely) need for fractional delay. > > Let me translate into my own language: > > "Find a filter with exact amplitude and phase response at a single frequency > and "don't care" everywhere else. �There are an infinite number of filter > realizations that will pass through this point." > > So, that suggests there may need to be some constraints added that lead to a > practical filter and reduce the number of possible solutions. > > And, now I understand why one would add some noise to the reference - so it > tends to "shut off" the filter at all frequencies not of interest. �And, > that would be the constraint that reduces the number of solutions. > > All this said, I'm concerned how the canceller gets its input. �Is the > signal driving spkr 1 available? �I've not quite figured that out. �At first > the OP said that the input was a stable sinusoid - which, if really true, is > one thing. �But now it appears that the input is a slowly varying sinusoid. > So, where does the reference / the signal to manipulate in the filter to > subtract / come from? > > Fred- Hide quoted text - > > - Show quoted text -Here is a little more background. I am trying to cancel the sinusoidal components of a fan. The fan motor gives out a tach pulse; to keep things simple lets assume it is at the fundamental frequency of the fan noise. Lets also assume that I only care about cancelling the fundamental component. This fan is controlled such that it varies in rpm over a period of a few seconds (in response feedback from the item being cooled by the fan). I have a microphone located near my head and I wish to cancel the fundamental. So I can lock a sine-wave oscillator to the fan frequency using a digital pll and a sine-wave generator. So the only two signals I can access are the tach pulse and the microphone output. A few important facts; 1) There is an unknown transfer function between the tach pulse and the microphone. 2) There is an unknown transfer function between the cancellation speaker and the microphone. 3) The cancellation speaker has a frequency-dependant phase response that can be quite severe, because at the lowest fan frequency, the cancellation signal is approaching the low-frequency limit of the speaker, and there are resonances in this range. 4) The fan cannot be turned off to measure the speaker-to-microphone cancellation path. 5) The wavelengths involved are such that the phase shift of the cancellation path cannot be limited to some narrow range; any value between 0 and 2PI is possible. 6) The LMS algorithm works well only when the adaptive filter is connected directly to the error-subtractor. If the adaptive filter connects to the error-subtractor through an additional known path, you have to use the Filtered-X algorithm, where a copy of this path is applied to the input signal and then used in the update equation. If you don't do this then the algorithm will not converge. 7) I can't use this technique because I don't know this path, and can't measure it. 8) I can't measure it for 2 reasons; a) The fan cannot be turned off b) The listener would object to any sine-wave sweeps. So this is my problem! Bob Adams
Reply by ●November 23, 20082008-11-23
On Wed, 19 Nov 2008 04:19:04 -0800, Robert Adams wrote:> On Nov 18, 10:43 pm, Tim Wescott <t...@justseemywebsite.com> wrote: >> On Tue, 18 Nov 2008 16:45:02 -0800, Robert Adams wrote: >> > I am trying to solve the following problem; >> >> > I drive a speaker with a sine-wave of known frequency = w. A second >> > speaker is driven with a signal that attempts to cancel the sound of >> > the first speaker at a nearby microphone. >> >> > So the problem is to find the amplitude and phase of the cancellation >> > signal that drives the cancellation speaker. >> >> > The transfer function from either speaker to the microphone is >> > unknown and possibly slowly time-varying. It is not possible to >> > measure it, as the user does not expect to hear any "calibration" >> > signals. >> >> > Currently I use the following algorithm >> >> > let the microphone signal = M, and the cancellation signal C = A*cos >> > (w*t) + B*sin(w*t) >> >> > update A and B according to >> >> > A sub(n+1) = A sub(n) + alpha*M*cos(w*t) >> >> > B sub(n+1) = B sub(n) - alpha*M*sin(w*t) >> >> > where alpha is a small update coefficient. >> >> > This works well when the phase-shift of the path from cancellation >> > speaker to microphone is small (< 90 degrees), but with large phase >> > shifts the polarity of the adaptive algorithm is reversed and the >> > whole thing blows up. >> >> > If the speaker-to-mic phase shifts were known, one could of course >> > pre- compensate the phase of the compensation signal and life would >> > be good again; but this is not possible. Also, the signal to the main >> > speaker cannot be tuned off. >> >> > Another complication is that the listener must perceive the sound >> > gracefully decaying to zero, so this rules out any trial-and-error >> > type of procedure. >> >> > Any suggestions? >> >> > Bob Adams >> >> If the first speaker's frequency is _really_ well known you should be >> able to acquire the signal, then monitor the change as the second >> speaker starts up, so you know the phase shift and gain from the second >> speaker and can adjust the phase and amplitude accordingly. >> >> If you don't know that first speaker's frequency all that well I'd >> suggest a moderately wide, very low level pseudo noise signal coming >> from the second speaker that you can acquire, use to capture the phase >> shift and gain, then adjust your cancellation phase and gain >> accordingly. >> >> Good luck... >> >> -- >> >> Tim Wescott >> Wescott Design Serviceshttp://www.wescottdesign.com >> >> Do you need to implement control loops in software? "Applied Control >> Theory for Embedded Systems" gives you just what it says. See details >> athttp://www.wescottdesign.com/actfes/actfes.html- Hide quoted text - >> >> - Show quoted text - > > Tim > > > Thanks for the suggestions. Yes, the frequency is very well known, so on > initial startup I could do as you suggest. The problem is that the > frequency varies over about a 2:1 range over a period of a few seconds, > and as the frequency varies the phase of the cancellation path can vary > by a lot; so I would need to "re-start" which means setting the > cancellation path to zero and then trying a few different cancellation > phases to see which one pushes the error in the right direction; and the > listener would of course experience a loss of cancellation during this > time. > > > BobNo matter what you do there's going to be some residual. I think you need to use the fact that the startup and sweep of the source spreads the bandwidth, then try to acquire a phase & amplitude vs. frequency map that you can use to steer your noise damper. I don't see how you can do it right from the get-go unless you can accurately measure the amplitude and time delay of the very first sound that comes out of the 'main' speaker, and correct for that. Even so -- there's going to be some residual. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" gives you just what it says. See details at http://www.wescottdesign.com/actfes/actfes.html
Reply by ●November 23, 20082008-11-23
Robert Adams wrote: (snip)> > Another complication is that the listener must perceive the sound > gracefully decaying to zero, so this rules out any trial-and-error > type of procedure. > > Any suggestions? >Bob, Based on a sampling of the posts so far, they have concentrated on the immediate task as stated, to cancel the signal at the microphone. I don't think the following has been covered: When cancellation does occurs it will be only in the immediate region of the microphone. Unfortunately, the rest of the room will experience a standing-wave pattern with peaks up to 6 dB greater, and an average level that is 3 dB greater. This may not suit your application. An example: Assume a frequency of 1000 Hz (wavelength around 30 cm.) Assume widely separated speakers. Assume the listener has one ear almost in contact with the microphone. When 100% cancellation is achieved at the ear near the microphone, the level at the other ear will depend on the direction in which the head is turned. At 1000 Hz the ears are separated by around half a wavelength, so there could be up to 100% reinforcement in amplitue (6dB increase in level) at the other ear. This effect decreases the closer you place the two speakers. Unfortunately, unless the listener blocks up on ear and holds the mic. close to the other ear then he will never perceive the sound "... gracefully decaying to zero ..." as you require. Regards, John
Reply by ●November 24, 20082008-11-24
On Nov 22, 1:47�pm, Robert Adams <robert.ad...@analog.com> wrote:> This fan is controlled such that it varies in rpm over a period of a > few seconds (in response feedback from the item being cooled by the > fan)....> 8) I can't measure it for 2 reasons; > � � �a) The fan cannot be turned off > � � �b) The listener would object to any sine-wave sweeps.The fan itself is potentially already executing frequency sweeps. All your cancellation waveform modulation has to be is less objectionable than the fan's. You might be able to get away with pseudo-random modulation of your cancellation signal near the threshold of perceptibility. Use a matching filter to estimate the delay of this narrowly modulated signal. Then use the error constellation to center the cancellation signal. If the fan controller behaves similar to some sort of linear system, track it with an adaptive filter, and predict ahead by your estimated cancellation signal delay. Make sure your liability insurance covers busted eardrums. Just some random wild ideas. IMHO. YMMV. -- rhn A.T nicholson d.0.t C-o-M http://www.nicholson.com/rhn/dsp.html






