[comp.dsp] Non-Linear Interpolation-Help!

isr@rodan.acs.syr.edu (Michael S. Schechter - ISR group account) (01/09/90)

Hi, I need to generate 'nice' sine-wave signals with a 56001 chip.
The built-in ROM table makes this rather simple, except I need
to interpolate (depending on frequency) as many as 40 points between
the sine wave table values. No, I don't have enough memory to store
a full quarter-cycle of my waveform. If interpolating 40 points is
undoable, I HAVE to be able to get at least 10 points.
 Knowing virtually nothing about signal processing, I'm wondering if
someone could tell me where I could find a non-linear interpolation
method for sine waves. Preferably this would be source on a manufacturer's
BBS somewhere so I could get it quickly.
  I just found out 4 days ago that this "whenever it gets done" project
has to be finished by MARCH, so I need the information ASAP.
BTW, can someone tell me the # for TI's 320x0 BBS?
---Thanks,
 Mike Schechter                        InterNet:isr@rodan.acs.syr.edu 
Computer Systems Engineer,             BITNET:  SENSORY@SUNRISE
Institute for Sensory Research,
Merrill Lane, Syracuse,NY,13210 USA

bart@videovax.tv.tek.com (Bart Massey) (01/09/90)

My comments below are just MHO.  Further details are available on request,
in my abundant spare time :-).

> Hi, I need to generate 'nice' sine-wave signals with a 56001 chip.
> The built-in ROM table makes this rather simple, except I need
> to interpolate (depending on frequency) as many as 40 points between
> the sine wave table values. No, I don't have enough memory to store
> a full quarter-cycle of my waveform. If interpolating 40 points is
> undoable, I HAVE to be able to get at least 10 points.

Hmmm.  40 * 256 = 10K, so you need better than 1/10K accuracy, which is
about 14 bits.  If it were me, I'd be inclined to pitch the built-in table
at this point, and go with standard methods of calculating sin(x).  Many of
these run *really fast* on the 56K, because of the 1-cycle
multiply-and-add.  Note that a simple Taylor series will have only about 10
MACs if coded optimally, once you've reflected your angles into the range
-pi/4..pi/4 (using Taylor cos(x) for the rest of the range -pi/2..pi/2).  If
you want something faster, the Berkeley folks used Tschebychev approximation
via the Remez exchange method to get some really tight polynomials for
sin(x), although I don't pretend to be able to duplicate their work...

The thing to note, unfortunately, is that most methods of interpolating
between table entries that are better than linear interpolation involve
using more table entries.  Because calculating the appropriate table indices
is no faster than MAC on the 56K, it's real easy to spend more time getting
ready to finesse the calculation than you would have spent just brute forcing
it.

Good luck!
					Bart Massey
					..tektronix!videovax.tv.tek.com!bart
					..tektronix!reed.bitnet!bart

judd@blake.acs.washington.edu (Randall Judd) (01/10/90)

In article <1697@rodan.acs.syr.edu>, isr@rodan.acs.syr.edu (Michael S. Schechter - ISR group account) writes:
> 
> Hi, I need to generate 'nice' sine-wave signals with a 56001 chip.
> The built-in ROM table makes this rather simple, except I need
> to interpolate (depending on frequency) as many as 40 points between
> the sine wave table values. No, I don't have enough memory to store
> a full quarter-cycle of my waveform. If interpolating 40 points is
> undoable, I HAVE to be able to get at least 10 points.
> ---Thanks,
>  Mike Schechter                        InterNet:isr@rodan.acs.syr.edu 

Have you thought about using 
       sin(theta + Dtheta)=sin(theta)*cos(Dtheta) + cos(theta)*sin(Dtheta)
       cos(theta + Dtheta)=cos(theta)*cos(Dtheta) - sin(theta)*sin(Dtheta)
which are of the form
       a(n+1)=a(n)b0+b(n)a0  and b(n+1)=b(n)b0-a(n)a0

You would want to update your sin and cos at table values (to prevent error
propagation), and if Dtheta is a constant you would only need to calculate 
cos(Dtheta) and sin(Dtheta) once, or load it in as a constant.  Since Dtheta 
is small you should be able to use a short taylor series.