Reply by Paul Russell February 19, 20042004-02-19
Funky wrote:
> > > He he he. Don't we sometimes wish we could turn back the clock;) > Funky > >
Nope - read the whole thread. Paul
Reply by Funky February 19, 20042004-02-19
"Paul Russell" <prussell@sonic.net> wrote in message
news:cowYb.1882$_3.30739@typhoon.sonic.net...
> Funky wrote: > > > > > Yes. I still think you need to exploit the trig identity that sum of
sines
> > equals product of sin and cos, unless you're thinking of another way. > > I don't think so. Given the intial phases and the periods all you need > is a simple state machine. (As others have noted, it gets more > complicated if the amplitudes of the two sine waves are different, but > apparently that is not the case in this instance.) > > Paul
He he he. Don't we sometimes wish we could turn back the clock;) Funky
Reply by Paul Russell February 19, 20042004-02-19
Jerry Avins wrote:
> > > The state switches when the magnitudes of one becomes larger than the > other and they have opposite signs. How is that time determined? >
OK - I missed out a step - sorry. We need to use the identity: sin(A) + sin(B) = 2 * sin((A + B) / 2) * cos((A - B) / 2) All we care about is the sign of the result, so we use the periods and initial phases of the (A + B) / 2 and (A - B) / 2 terms from which we can predict their signs based on zero crossings. The sign of the output is then just the product of these two individual signs. The pseudo code I posted earlier is still more or less correct, but the periods and phases come from the identity above, not the original sine wave periods and phases. Paul
Reply by Paul Russell February 18, 20042004-02-18
Jerry Avins wrote:
> > The state switches when the magnitudes of one becomes larger than the > other and they have opposite signs. How is that time determined? >
Good point - I /thought/ I had this covered but maybe I need to try a simple implementation and see if it actually works before shooting my mouth off further. Paul
Reply by Jerry Avins February 18, 20042004-02-18
Paul Russell wrote:

> Funky wrote: > >> >> But how do I use this to get the same output as multiplying the sum by >> infinity and clipping? >> Yes, I'm being stupid here. >> Funky >> > > The output only has 2 states: +1 and -1. > > (Actually there is probably at least one pathological condition where > the output will always be zero, but I leave this kind of detail as an > exercise for the reader.) > > Paul
The state switches when the magnitudes of one becomes larger than the other and they have opposite signs. How is that time determined? Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
Reply by Paul Russell February 18, 20042004-02-18
Funky wrote:
> > But how do I use this to get the same output as multiplying the sum by > infinity and clipping? > Yes, I'm being stupid here. > Funky >
The output only has 2 states: +1 and -1. (Actually there is probably at least one pathological condition where the output will always be zero, but I leave this kind of detail as an exercise for the reader.) Paul
Reply by Funky February 18, 20042004-02-18
"Paul Russell" <prussell@sonic.net> wrote in message
news:W0RYb.2060$_3.33958@typhoon.sonic.net...
> Funky wrote: > > > > > > Could you explain how the method works or give me some references,
keywords
> > to google please. > > > > Something like this, perhaps: > > + Initialisation > - Calculate the half period of each sine wave in samples (as float, > or perhaps integer + fraction) > - Using the initial phase of each sine wave, calculate the sample > number of the first zero crossing for each sine wave, and the initial sign > - Initialise the output state using the above information > > + For each sample > - If this is a zero crossing for either of the two sine waves > - Update the sign of the relevant sine wave(s) > - Update the sample count(s) for the next zero crossing(s) > - Update the output state > > Paul
But how do I use this to get the same output as multiplying the sum by infinity and clipping? Yes, I'm being stupid here. Funky
Reply by Paul Russell February 18, 20042004-02-18
Funky wrote:
> > > Could you explain how the method works or give me some references, keywords > to google please. >
Something like this, perhaps: + Initialisation - Calculate the half period of each sine wave in samples (as float, or perhaps integer + fraction) - Using the initial phase of each sine wave, calculate the sample number of the first zero crossing for each sine wave, and the initial sign - Initialise the output state using the above information + For each sample - If this is a zero crossing for either of the two sine waves - Update the sign of the relevant sine wave(s) - Update the sample count(s) for the next zero crossing(s) - Update the output state Paul
Reply by Funky February 18, 20042004-02-18
"Jerry Avins" <jya@ieee.org> wrote in message
news:4032ca43$0$3104$61fed72c@news.rcn.com...
> Funky wrote: > > ... > > > > I still think you need to exploit the trig identity that sum of sines > > equals product of sin and cos, unless you're thinking of another way. > > Funky > > There is another way. Find each of the sines. (This need not be a call > to a sine routine. Since they describe a smooth sinewave, it takes about > a dozen lines of assembly code for each sine.) Add them. If the sum is > positive, output 1; if negative, 0 or -1 as you choose. You can use the > same continuous sine generator for (a+b) and (a-b), but why bother? > > Jerry
This doesn't seem an efficient way of doing things since you're waisting time keeping track of the sum between zero crossings, even though the corresponding output is constant. Secondly, the zero crossing point in the output will have more jitter on it than necessary because of the time taken to compute sines, add and then check for the sign. The zero crossing points can be known _exactly_ in advance as those of sin(2*pi*(f1+f2)*t) and cos(2*pi*(f1-f2)*t) i.e t = n/(2*(f1+f2)); t = (1/2 +n )/(2*(f1-f2)) A timer is loaded with the value for the next zero crossing time interval and the output is inverted on each overflow interrupt. Simple. Thanks for the interest shown. Funky
> Engineering is the art of making what you want from things you can get. > &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295; >
Reply by Funky February 18, 20042004-02-18
"Paul Russell" <prussell@sonic.net> wrote in message
news:cowYb.1882$_3.30739@typhoon.sonic.net...
> Funky wrote: > > > > > Yes. I still think you need to exploit the trig identity that sum of
sines
> > equals product of sin and cos, unless you're thinking of another way. > > I don't think so. Given the intial phases and the periods all you need > is a simple state machine. (As others have noted, it gets more > complicated if the amplitudes of the two sine waves are different, but > apparently that is not the case in this instance.)
Could you explain how the method works or give me some references, keywords to google please. Funky
> Paul