| View previous topic :: View next topic |
| Author |
Message |
Robert Adams Guest
|
Posted: Wed Nov 19, 2008 12:45 am Post subject: adaptive sine-wave cancellation |
|
|
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 |
|
| |
|
Back to top |
Tim Wescott Guest
|
Posted: Wed Nov 19, 2008 9:28 am Post subject: Re: adaptive sine-wave cancellation |
|
|
On Tue, 18 Nov 2008 16:45:02 -0800, Robert Adams wrote:
| Quote: | 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 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 |
|
| |
|
Back to top |
Vladimir Vassilevsky Guest
|
Posted: Wed Nov 19, 2008 9:28 am Post subject: Re: adaptive sine-wave cancellation |
|
|
"Robert Adams" <robert.adams@analog.com> wrote in message
news:50766897-75fa-479d-96da-fb6b9e2937e9@z6g2000pre.googlegroups.com...
| Quote: | 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.
|
The update equation signs should be the same for A and B:
A -= Alpha x M x cos (wt)
B -= Alpha x M x sin(wt)
Vladimir Vassilevsky
DSP and Mixed Signal Consultant
www.abvolt.com |
|
| |
|
Back to top |
Robert Adams Guest
|
Posted: Wed Nov 19, 2008 12:12 pm Post subject: Re: adaptive sine-wave cancellation |
|
|
On Nov 18, 11:45 pm, "Vladimir Vassilevsky"
<antispam_bo...@hotmail.com> wrote:
| Quote: | "Robert Adams" <robert.ad...@analog.com> wrote in message
news:50766897-75fa-479d-96da-fb6b9e2937e9@z6g2000pre.googlegroups.com...
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.
The update equation signs should be the same for A and B:
A -= Alpha x M x cos (wt)
B -= Alpha x M x sin(wt)
Vladimir Vassilevsky
DSP and Mixed Signal Consultantwww.abvolt.com- Hide quoted text -
- Show quoted text -
|
Yes, this was a typo, sorry.
Bob |
|
| |
|
Back to top |
Robert Adams Guest
|
Posted: Wed Nov 19, 2008 12:19 pm Post subject: Re: adaptive sine-wave cancellation |
|
|
On Nov 18, 10:43 pm, Tim Wescott <t...@justseemywebsite.com> wrote:
| Quote: | 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.
Bob |
|
| |
|
Back to top |
Robert Adams Guest
|
Posted: Wed Nov 19, 2008 6:38 pm Post subject: Re: adaptive sine-wave cancellation |
|
|
On Nov 19, 8:07 am, jim <"sjedgingN0sp"@m...@mwt.net> wrote:
| Quote: | 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.
I think you are trying to do too much at once.
Try holding the cancel signal at a constant volume until it reaches the
correct phase. In other words, normalize A and B so that always
A^2+B^2=[some constant]. That means as A grows B will shrink or visa versa.
If your process is working correctly it should reach a steady state for A
and B fairly shortly. At that point it should be canceling as much as it can
at that particular volume and you can then allow the amplitude of C to also
vary.
-jim
----== Posted via Pronews.Com - Unlimited-Unrestricted-Secure Usenet News==----http://www.pronews.comThe #1 Newsgroup Service in the World! >100,000 Newsgroups
---= - Total Privacy via Encryption =---- Hide quoted text -
- Show quoted text -
|
Jim
I think this is a good idea, thanks!
Bob |
|
| |
|
Back to top |
maury Guest
|
Posted: Wed Nov 19, 2008 6:44 pm Post subject: Re: adaptive sine-wave cancellation |
|
|
On Nov 18, 6:45 pm, Robert Adams <robert.ad...@analog.com> wrote:
| Quote: | 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
|
It seems that you need to know in which direction to drive the anti-
signal. That implies a gradient. Also, it looks lilke you might be
trying to apply the gradient with your update equations. IF THAT IS
THE CASE, I may be wrong, but it appears to me that
A(n+1) = A(n) + alpha M cos(wt), and
B(n+1) = B(n) + alpha M sin(wt)
is NOT the gradient of the squared error, [M - (A'cos(wt) + B'sin(wt))]
^2, where A' and B' are estimates A and B in M = Acos(wt) + Bsin
(wt). Nor is it the gradient of the error M - (A'cos(wt) + B'sin
(wt)).
As I said, I may be wrong, but you might want to address your update
equations again.
Maurice Givens |
|
| |
|
Back to top |
jim Guest
|
Posted: Wed Nov 19, 2008 7:07 pm Post subject: Re: adaptive sine-wave cancellation |
|
|
Robert Adams wrote:
| Quote: |
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.
|
I think you are trying to do too much at once.
Try holding the cancel signal at a constant volume until it reaches the
correct phase. In other words, normalize A and B so that always
A^2+B^2=[some constant]. That means as A grows B will shrink or visa versa.
If your process is working correctly it should reach a steady state for A
and B fairly shortly. At that point it should be canceling as much as it can
at that particular volume and you can then allow the amplitude of C to also
vary.
-jim
----== Posted via Pronews.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.pronews.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= - Total Privacy via Encryption =--- |
|
| |
|
Back to top |
Glen Herrmannsfeldt Guest
|
Posted: Thu Nov 20, 2008 1:33 am Post subject: Re: adaptive sine-wave cancellation |
|
|
Robert Adams wrote:
| Quote: | 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.
|
I think you should be able to follow it if it is sufficiently
slow, and not if the change is too fast. The PLL literature
should explain the how fast phase can change and keep the lock
as a function of the PLL parameters.
It seems to me that you want a PLL for the phase/frequency
part and additional circuitry to lock the amplitude.
(Call it ALL for Amplitude Locked Loop.) Then you need
sufficient damping in the two such that the combination
doesn't oscillate.
-- glen |
|
| |
|
Back to top |
Robert Adams Guest
|
Posted: Thu Nov 20, 2008 3:08 am Post subject: Re: adaptive sine-wave cancellation |
|
|
On Nov 19, 2:33 pm, Glen Herrmannsfeldt <g...@ugcs.caltech.edu> wrote:
| Quote: | Robert Adams wrote:
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.
I think you should be able to follow it if it is sufficiently
slow, and not if the change is too fast. The PLL literature
should explain the how fast phase can change and keep the lock
as a function of the PLL parameters.
It seems to me that you want a PLL for the phase/frequency
part and additional circuitry to lock the amplitude.
(Call it ALL for Amplitude Locked Loop.) Then you need
sufficient damping in the two such that the combination
doesn't oscillate.
-- glen
|
I already have a locked frequency, but the phase is the problem. I
only have access to the microphone signal to steer the adaptation
algorithm and this is the sum of the signal I am trying to cancel and
the phase-shifted anti-noise signal I am generating. So what do I use
as a reference to lock the phase to?
Bob |
|
| |
|
Back to top |
Robert Adams Guest
|
Posted: Thu Nov 20, 2008 3:19 am Post subject: Re: adaptive sine-wave cancellation |
|
|
On Nov 19, 1:44 pm, maury <maury...@core.com> wrote:
| Quote: | On Nov 18, 6:45 pm, Robert Adams <robert.ad...@analog.com> 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
It seems that you need to know in which direction to drive the anti-
signal. That implies a gradient. Also, it looks lilke you might be
trying to apply the gradient with your update equations. IF THAT IS
THE CASE, I may be wrong, but it appears to me that
A(n+1) = A(n) + alpha M cos(wt), and
B(n+1) = B(n) + alpha M sin(wt)
is NOT the gradient of the squared error, [M - (A'cos(wt) + B'sin(wt))]
^2, where A' and B' are estimates A and B in M = Acos(wt) + Bsin
(wt). Nor is it the gradient of the error M - (A'cos(wt) + B'sin
(wt)).
As I said, I may be wrong, but you might want to address your update
equations again.
Maurice Givens- Hide quoted text -
- Show quoted text -
|
Maurice
I agree that this is not the ideal gradient but it works extremely
well when the phase shift between the correction speaker and the
microphone is small. I think ANY gradient will become confused (and in
fact will switch polarity completely) in the presence of large amounts
of phase shift.
In a sense this problem is similar to the problem solved by the
Filtered-X LMS algorithm, where there is another transfer function in
series with the adaptive FIR before the error is taken. In my case the
"other" trasnfer function is the cancellation-speaker-to-microphone
path, but since we are talking only about sine-waves here, this path
can be characterized simply by the amplitude and phase at the
frequency of interest.
In the Filtered-X LMS, the problem is solved by having a copy of the
transfer function that exists in series with the adaptive FIR. In my
case I cannot measure this path, which is the problem; if I knew the
amplitude/phase of the cancellation-speaker-to-microphone path I could
easily compensate for it.
Bob
Bob |
|
| |
|
Back to top |
Fred Marshall Guest
|
Posted: Thu Nov 20, 2008 8:27 am Post subject: Re: adaptive sine-wave cancellation |
|
|
Robert Adams wrote:
| Quote: | 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
|
This looks to me like a classical line canceller application.
input--------->----------------------[spkr 1]->(+)----+----> e[n]
^ |
. ^ |
. | |
. | |
noise ->----------------------->[LMS]-[spkr2 ]---+ |
^ |
| |
+--------------------+
Adaptive line-cancelling filter
LMS adaptive filter adjusts to minimize e[n] which cancels noise
in the signal by subtracting filtered version of noise.
The LMS filter adjusts the amplitude and phase of its
periodic input components to cancel the periodic noise
component in the signal.
In your case, e(n) is the output of the microphone.
The "noise" is the signal you're going to use to cancel the "input". i.e. a
replica of the sinusoid.
The LMS filter adjusts the amplitude and phase of the drive to spkr2 so that
it minimizes the output of the microphone.
See:
http://www.owlnet.rice.edu/~ryanking/elec431/compare.html
http://plaza.ufl.edu/badavis/EEL6502_Project_1.html
etc.
Now, your implementation assumes that both the signal and the cancelling
signal (the noise reference here) are sinusoids of the same frequency.
Then, the LMS filter might simplify into a simple magnitude and delay which
would be an LMS filter with weights [ 0 0 0 ....0 0 0 0 k 0 0 0 0 0 0 0
........0] where the location of the single weight of gain k is determined to
make the delay what you want.
Thus, your implementation isn't all that different except it's expressed in
continous time.
One of the tricks of the trade is to adjust the amplitude steps at each
iterative step, trading convergence time against end results. Bigger steps,
faster convergence, worse results. Smaller steps, slower convergence,
better results .... as long as the situation is static!!!
Fred |
|
| |
|
Back to top |
Jerry Avins Guest
|
Posted: Thu Nov 20, 2008 9:06 am Post subject: Re: adaptive sine-wave cancellation |
|
|
Glen Herrmannsfeldt wrote:
| Quote: | Robert Adams wrote:
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.
I think you should be able to follow it if it is sufficiently
slow, and not if the change is too fast. The PLL literature
should explain the how fast phase can change and keep the lock
as a function of the PLL parameters.
It seems to me that you want a PLL for the phase/frequency
part and additional circuitry to lock the amplitude.
(Call it ALL for Amplitude Locked Loop.) Then you need
sufficient damping in the two such that the combination
doesn't oscillate.
|
The time lag between speaker output and microphone input is likely to
make this a very difficult loop to stabilize if the signal to be
canceled can vary at all rapidly. If the canceling speaker is within a
tenth of a wavelength of the microphone at all frequencies with
significant gain, simple negative feedback from microphone to speaker
should work.
Jerry
--
Engineering is the art of making what you want from things you can get.
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ |
|
| |
|
Back to top |
Jerry Avins Guest
|
Posted: Thu Nov 20, 2008 9:06 am Post subject: Re: adaptive sine-wave cancellation |
|
|
Robert Adams wrote:
| Quote: | On Nov 19, 1:44 pm, maury <maury...@core.com> wrote:
On Nov 18, 6:45 pm, Robert Adams <robert.ad...@analog.com> 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
It seems that you need to know in which direction to drive the anti-
signal. That implies a gradient. Also, it looks lilke you might be
trying to apply the gradient with your update equations. IF THAT IS
THE CASE, I may be wrong, but it appears to me that
A(n+1) = A(n) + alpha M cos(wt), and
B(n+1) = B(n) + alpha M sin(wt)
is NOT the gradient of the squared error, [M - (A'cos(wt) + B'sin(wt))]
^2, where A' and B' are estimates A and B in M = Acos(wt) + Bsin
(wt). Nor is it the gradient of the error M - (A'cos(wt) + B'sin
(wt)).
As I said, I may be wrong, but you might want to address your update
equations again.
Maurice Givens- Hide quoted text -
- Show quoted text -
Maurice
I agree that this is not the ideal gradient but it works extremely
well when the phase shift between the correction speaker and the
microphone is small. I think ANY gradient will become confused (and in
fact will switch polarity completely) in the presence of large amounts
of phase shift.
In a sense this problem is similar to the problem solved by the
Filtered-X LMS algorithm, where there is another transfer function in
series with the adaptive FIR before the error is taken. In my case the
"other" trasnfer function is the cancellation-speaker-to-microphone
path, but since we are talking only about sine-waves here, this path
can be characterized simply by the amplitude and phase at the
frequency of interest.
|
Think of it as a servo. Phase is only a frequency-dependent
manifestation of delay.
| Quote: | In the Filtered-X LMS, the problem is solved by having a copy of the
transfer function that exists in series with the adaptive FIR. In my
case I cannot measure this path, which is the problem; if I knew the
amplitude/phase of the cancellation-speaker-to-microphone path I could
easily compensate for it.
|
Can't you find that with a test tone? If you know the delay, you can
calculate phase at any frequency.
Jerry
--
Engineering is the art of making what you want from things you can get.
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ |
|
| |
|
Back to top |
Robert Adams Guest
|
Posted: Thu Nov 20, 2008 11:30 am Post subject: Re: adaptive sine-wave cancellation |
|
|
On Nov 20, 1:17 am, Jerry Avins <j...@ieee.org> wrote:
| Quote: | Robert Adams wrote:
On Nov 19, 1:44 pm, maury <maury...@core.com> wrote:
On Nov 18, 6:45 pm, Robert Adams <robert.ad...@analog.com> 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
It seems that you need to know in which direction to drive the anti-
signal. That implies a gradient. Also, it looks lilke you might be
trying to apply the gradient with your update equations. IF THAT IS
THE CASE, I may be wrong, but it appears to me that
A(n+1) = A(n) + alpha M cos(wt), and
B(n+1) = B(n) + alpha M sin(wt)
is NOT the gradient of the squared error, [M - (A'cos(wt) + B'sin(wt))]
^2, where A' and B' are estimates A and B in M = Acos(wt) + Bsin
(wt). Nor is it the gradient of the error M - (A'cos(wt) + B'sin
(wt)).
As I said, I may be wrong, but you might want to address your update
equations again.
Maurice Givens- Hide quoted text -
- Show quoted text -
Maurice
I agree that this is not the ideal gradient but it works extremely
well when the phase shift between the correction speaker and the
microphone is small. I think ANY gradient will become confused (and in
fact will switch polarity completely) in the presence of large amounts
of phase shift.
In a sense this problem is similar to the problem solved by the
Filtered-X LMS algorithm, where there is another transfer function in
series with the adaptive FIR before the error is taken. In my case the
"other" trasnfer function is the cancellation-speaker-to-microphone
path, but since we are talking only about sine-waves here, this path
can be characterized simply by the amplitude and phase at the
frequency of interest.
Think of it as a servo. Phase is only a frequency-dependent
manifestation of delay.
In the Filtered-X LMS, the problem is solved by having a copy of the
transfer function that exists in series with the adaptive FIR. In my
case I cannot measure this path, which is the problem; if I knew the
amplitude/phase of the cancellation-speaker-to-microphone path I could
easily compensate for it.
Can't you find that with a test tone? If you know the delay, you can
calculate phase at any frequency.
Jerry
--
Engineering is the art of making what you want from things you can get.
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ- Hide quoted text -
- Show quoted text -
|
Jerry
The problem with this is that the frequency varies slowly over a
period of a few seconds, and it just so happens that the lowest
frequency is in the "resoanance" range of the speaker, and hence
undergoes a pretty dramatic change in phase shift.
I thought about pre-computing a table of frequency versus phase shift
for the speaker plus the acoustic path; however, speaker manufacturing
tolerances as well as acoustic paths are known to be highly variable,
so I am worried about robustness.
There is also the fact that the listener in this application would not
expect any test tones or other un-natural sounding experiements to
determine the phase.
Bob |
|
| |
|
Back to top |
|